def update(self,supplierOrderItems=[]): dao = SupplierOrderDao() values = [(so.id,so.supplier_id,so.supplier_contact_id,so.owner_id,so.owner_contact_id,so.owner_po_number,so.owner_po_date) for so in supplierOrderItems] dao.update(values) ids = [(so.id) for so in supplierOrderItems] updatedSupplierOrders = self.get(ids) return updatedSupplierOrders
def get(self,ids=[]): dao = SupplierOrderDao() rows = dao.get(ids) supplierOrders = [] for row in rows: supplierOrders.append(SupplierOrder(row[0],row[1],row[2],row[3],row[4],row[5],row[6])) self.decorate(supplierOrders) return supplierOrders
def insert(self,supplierOrders=[]): dao = SupplierOrderDao() values = [(so.supplier_id,so.supplier_contact_id,so.owner_id,so.owner_contact_id,so.owner_po_number,so.owner_po_date) for so in supplierOrders] ids = dao.insert(values) newSupplierOrders = self.get(ids) #set the default phone and email types return newSupplierOrders
def addOrderItem(self,so,oi): dao = SupplierOrderDao() dao.joinOrderItem(so.id,oi.id) so.items.append(oi) return (self.get([so.id]))