Subversion Repositories SmartDukaan

Rev

Rev 10295 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

'''
Created on 29-Jul-2011

@author: Chandranshu
'''
from elixir.entity import Entity
from elixir.fields import Field
from sqlalchemy.types import Integer, String
from elixir.options import using_options, using_table_options

from shop2020.thriftpy.purchase.ttypes import Supplier as TSupplier

class Supplier(Entity):
    '''
    classdocs
    '''
    id = Field(Integer, primary_key=True, autoincrement=True)
    name = Field(String(30))
    phone = Field(String(12))
    fax = Field(String(12))
    tin = Field(String(10))
    pan = Field(String(10))
    headName = Field(String(30))
    headDesignation = Field(String(20))
    headEmail = Field(String(50))
    contactName = Field(String(30))
    contactPhone = Field(String(12))
    contactFax = Field(String(12))
    contactEmail = Field(String(50))
    registeredAddress = Field(String(100))
    communicationAddress = Field(String(100))
    stateId = Field(Integer)
    poValidityLimit = Field(Integer)
    using_options(shortnames=True)
    using_table_options(mysql_engine="InnoDB")
    
    def __init__(self):
        '''
        Constructor
        '''
        pass
    
    def to_thrift_object(self):
        t_supplier = TSupplier()
        t_supplier.id = self.id
        t_supplier.name = self.name
        t_supplier.phone = self.phone
        t_supplier.fax = self.fax
        t_supplier.tin = self.tin
        t_supplier.pan = self.pan
        t_supplier.headName = self.headName
        t_supplier.headDesignation = self.headDesignation
        t_supplier.headEmail = self.headEmail
        t_supplier.contactName = self.contactName
        t_supplier.contactPhone = self.contactPhone
        t_supplier.contactFax = self.contactFax
        t_supplier.contactEmail = self.contactEmail
        t_supplier.registeredAddress = self.registeredAddress
        t_supplier.communicationAddress = self.communicationAddress
        t_supplier.stateId = self.stateId
        t_supplier.poValidityLimit = self.poValidityLimit
        
        return t_supplier