Subversion Repositories SmartDukaan

Rev

Rev 7410 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5443 mandeep.dh 1
'''
2
Created on 29-Jul-2011
3
 
4
@author: Chandranshu
5
'''
6
from elixir.entity import Entity
7
from elixir.fields import Field
8
from elixir.options import using_options, using_table_options
9
from shop2020.thriftpy.purchase.ttypes import Invoice as TInvoice
10
from shop2020.utils.Utils import to_java_date
11
from sqlalchemy.types import Integer, String, DateTime
12
 
13
 
14
class Invoice(Entity):
15
    '''
16
    classdocs
17
    '''
18
    id = Field(Integer, primary_key=True, autoincrement=True)
19
    invoiceNumber = Field(String(20))
20
    date = Field(DateTime)
21
    numItems = Field(Integer)
22
    receivedFrom = Field(String(20))
23
    supplierId = Field(Integer)
7410 amar.kumar 24
    warehouseId = Field(Integer)
11219 manish.sha 25
    invoiceDate = Field(DateTime)
5443 mandeep.dh 26
    using_options(shortnames=True)
27
    using_table_options(mysql_engine="InnoDB")
28
 
29
    def __init__(self, ):
30
        '''
31
        Constructor
32
        '''
33
        pass
34
 
35
    def to_thrift_object(self):
36
        t_invoice = TInvoice()
37
        t_invoice.id = self.id
38
        t_invoice.invoiceNumber = self.invoiceNumber
39
        t_invoice.date = to_java_date(self.date)
40
        t_invoice.numItems = self.numItems
41
        t_invoice.receivedFrom = self.receivedFrom
42
        t_invoice.supplierId = self.supplierId
7410 amar.kumar 43
        t_invoice.warehouseId = self.warehouseId
11219 manish.sha 44
        t_invoice.invoiceDate = to_java_date(self.invoiceDate)
5443 mandeep.dh 45
 
46
        return t_invoice