| Line 4... |
Line 4... |
| 4 |
@author: Amar
|
4 |
@author: Amar
|
| 5 |
'''
|
5 |
'''
|
| 6 |
from elixir.entity import Entity
|
6 |
from elixir.entity import Entity
|
| 7 |
from elixir.fields import Field
|
7 |
from elixir.fields import Field
|
| 8 |
from elixir.options import using_options, using_table_options
|
8 |
from elixir.options import using_options, using_table_options
|
| 9 |
from shop2020.thriftpy.purchase.ttypes import PurchaseReturn as TPurchaseReturn, PurchaseReturnInventoryType
|
9 |
from shop2020.thriftpy.purchase.ttypes import PurchaseReturn as TPurchaseReturn, PurchaseReturnInventoryType, SettlementType, PrReasonType
|
| 10 |
from shop2020.utils.Utils import to_java_date
|
10 |
from shop2020.utils.Utils import to_java_date
|
| 11 |
from sqlalchemy.types import Integer, Float, DateTime, Boolean, Enum
|
11 |
from sqlalchemy.types import Integer, Float, DateTime, Boolean, Enum, String
|
| 12 |
import datetime
|
12 |
import datetime
|
| 13 |
|
13 |
|
| 14 |
class PurchaseReturn(Entity):
|
14 |
class PurchaseReturn(Entity):
|
| 15 |
'''
|
15 |
'''
|
| 16 |
classdocs
|
16 |
classdocs
|
| Line 20... |
Line 20... |
| 20 |
amount = Field(Float)
|
20 |
amount = Field(Float)
|
| 21 |
returnTimestamp = Field(DateTime)
|
21 |
returnTimestamp = Field(DateTime)
|
| 22 |
isSettled = Field(Boolean)
|
22 |
isSettled = Field(Boolean)
|
| 23 |
type = Field(Enum('REAL', 'VIRTUAL'), default = 'REAL', server_default='REAL')
|
23 |
type = Field(Enum('REAL', 'VIRTUAL'), default = 'REAL', server_default='REAL')
|
| 24 |
returnInventoryType = Field(Enum('GOOD', 'BAD'), default = 'GOOD', server_default='GOOD')
|
24 |
returnInventoryType = Field(Enum('GOOD', 'BAD'), default = 'GOOD', server_default='GOOD')
|
| - |
|
25 |
currentSettlementType = Field(Enum('CREDIT_NOTE','REPLACEMENT','AGAINST_GRN'))
|
| - |
|
26 |
latestSettlementDate = Field(DateTime)
|
| - |
|
27 |
purchaseReturnType = Field(Enum('WRONG_GRN','ACTUAL_PR','REPLACEMENT'))
|
| - |
|
28 |
reasonText = Field(String(1024))
|
| - |
|
29 |
documentNumber = Field(String(1024))
|
| - |
|
30 |
createdBy = Field(String(255))
|
| - |
|
31 |
unsettledAmount = Field(Float)
|
| 25 |
using_options(shortnames=True)
|
32 |
using_options(shortnames=True)
|
| 26 |
using_table_options(mysql_engine="InnoDB")
|
33 |
using_table_options(mysql_engine="InnoDB")
|
| 27 |
|
34 |
|
| 28 |
def __init__(self, vendorId, amount):
|
35 |
def __init__(self, vendorId, amount):
|
| 29 |
'''
|
36 |
'''
|
| Line 40... |
Line 47... |
| 40 |
t_purchaseReturn.vendorId = self.vendorId
|
47 |
t_purchaseReturn.vendorId = self.vendorId
|
| 41 |
t_purchaseReturn.amount = self.amount
|
48 |
t_purchaseReturn.amount = self.amount
|
| 42 |
t_purchaseReturn.returnTimestamp = to_java_date(self.returnTimestamp)
|
49 |
t_purchaseReturn.returnTimestamp = to_java_date(self.returnTimestamp)
|
| 43 |
t_purchaseReturn.isSettled = self.isSettled
|
50 |
t_purchaseReturn.isSettled = self.isSettled
|
| 44 |
t_purchaseReturn.returnInventoryType = PurchaseReturnInventoryType._NAMES_TO_VALUES[self.returnInventoryType]
|
51 |
t_purchaseReturn.returnInventoryType = PurchaseReturnInventoryType._NAMES_TO_VALUES[self.returnInventoryType]
|
| - |
|
52 |
if self.currentSettlementType:
|
| - |
|
53 |
t_purchaseReturn.currentSettlementType = SettlementType._NAMES_TO_VALUES[self.currentSettlementType]
|
| - |
|
54 |
if self.latestSettlementDate:
|
| - |
|
55 |
t_purchaseReturn.latestSettlementDate = to_java_date(self.latestSettlementDate)
|
| - |
|
56 |
if self.purchaseReturnType:
|
| - |
|
57 |
t_purchaseReturn.purchaseReturnType = PrReasonType._NAMES_TO_VALUES[self.purchaseReturnType]
|
| - |
|
58 |
if self.reasonText:
|
| - |
|
59 |
t_purchaseReturn.reasonText = self.reasonText
|
| - |
|
60 |
if self.documentNumber:
|
| - |
|
61 |
t_purchaseReturn.documentNumber = self.documentNumber
|
| - |
|
62 |
if self.createdBy:
|
| - |
|
63 |
t_purchaseReturn.createdBy = self.createdBy
|
| - |
|
64 |
if self.unsettledAmount:
|
| - |
|
65 |
t_purchaseReturn.unsettledAmount = self.unsettledAmount
|
| 45 |
return t_purchaseReturn
|
66 |
return t_purchaseReturn
|
| 46 |
|
67 |
|