Subversion Repositories SmartDukaan

Rev

Rev 5443 | Go to most recent revision | 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)
5443 mandeep.dh 25
    using_options(shortnames=True)
26
    using_table_options(mysql_engine="InnoDB")
27
 
28
    def __init__(self, ):
29
        '''
30
        Constructor
31
        '''
32
        pass
33
 
34
    def to_thrift_object(self):
35
        t_invoice = TInvoice()
36
        t_invoice.id = self.id
37
        t_invoice.invoiceNumber = self.invoiceNumber
38
        t_invoice.date = to_java_date(self.date)
39
        t_invoice.numItems = self.numItems
40
        t_invoice.receivedFrom = self.receivedFrom
41
        t_invoice.supplierId = self.supplierId
7410 amar.kumar 42
        t_invoice.warehouseId = self.warehouseId
5443 mandeep.dh 43
 
44
        return t_invoice