| 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
|
9 |
from shop2020.thriftpy.purchase.ttypes import PurchaseReturn as TPurchaseReturn, PurchaseReturnInventoryType
|
| 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
|
| 12 |
import datetime
|
12 |
import datetime
|
| 13 |
|
13 |
|
| 14 |
class PurchaseReturn(Entity):
|
14 |
class PurchaseReturn(Entity):
|
| Line 19... |
Line 19... |
| 19 |
vendorId = Field(Integer)
|
19 |
vendorId = Field(Integer)
|
| 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 |
using_options(shortnames=True)
|
25 |
using_options(shortnames=True)
|
| 25 |
using_table_options(mysql_engine="InnoDB")
|
26 |
using_table_options(mysql_engine="InnoDB")
|
| 26 |
|
27 |
|
| 27 |
def __init__(self, vendorId, amount):
|
28 |
def __init__(self, vendorId, amount):
|
| 28 |
'''
|
29 |
'''
|
| Line 38... |
Line 39... |
| 38 |
t_purchaseReturn.id = self.id
|
39 |
t_purchaseReturn.id = self.id
|
| 39 |
t_purchaseReturn.vendorId = self.vendorId
|
40 |
t_purchaseReturn.vendorId = self.vendorId
|
| 40 |
t_purchaseReturn.amount = self.amount
|
41 |
t_purchaseReturn.amount = self.amount
|
| 41 |
t_purchaseReturn.returnTimestamp = to_java_date(self.returnTimestamp)
|
42 |
t_purchaseReturn.returnTimestamp = to_java_date(self.returnTimestamp)
|
| 42 |
t_purchaseReturn.isSettled = self.isSettled
|
43 |
t_purchaseReturn.isSettled = self.isSettled
|
| - |
|
44 |
t_purchaseReturn.returnInventoryType = PurchaseReturnInventoryType._NAMES_TO_VALUES[self.returnInventoryType]
|
| 43 |
return t_purchaseReturn
|
45 |
return t_purchaseReturn
|
| 44 |
|
46 |
|