def get(self, purchase_id): ''' Returns Purchase info. :param Purchase_id: :return: ''' entity = self._get(purchase_id) purchase = DynamicObject(entity_to_dic(entity)) store = get_current_transaction_store() item_entities = \ store.find(PurchasesCommentEntity, PurchasesCommentEntity.purchase_id == purchase_id).order_by(PurchasesCommentEntity.purchase_comment_date) purchase.items = [] for item in item_entities: purchase.items.append(DynamicObject(entity_to_dic(item))) return purchase
def get(self, invoice_id): ''' Returns invoice info. :param invoice_id: :return: ''' entity = self._get(invoice_id) invoice = DynamicObject(entity_to_dic(entity)) store = get_current_transaction_store() item_entities = \ store.find(InvoiceItemEntity, InvoiceItemEntity.invoice_id == invoice_id).order_by(InvoiceItemEntity.item_row) invoice.items = [] for item in item_entities: invoice.items.append(DynamicObject(entity_to_dic(item))) return invoice