Exemple #1
0
 def create_purchase_order(self):
     # Create local purchase order
     po = PurchaseOrder(supplier="Apple", created_by=self.created_by)
     po.location = self.created_by.get_location()
     po.reference = self.reference
     po.sales_order = self.order
     po.save()
     return po
Exemple #2
0
 def create_purchase_order(self):
     # Create local purchase order
     po = PurchaseOrder(supplier="Apple", created_by=self.created_by)
     po.location = self.created_by.get_location()
     po.reference = self.reference
     po.sales_order = self.order
     po.save()
     return po
Exemple #3
0
    def order(self, user, po=None):
        """
        Purchase this Service Part
        """
        if po is None:
            po = PurchaseOrder()
            po.location = user.get_location()
            po.sales_order = self.repair.order
            po.reference = self.repair.reference
            po.confirmation = self.repair.confirmation
            po.created_by = user
            po.supplier = "Apple"
            po.save()

        self.purchase_order = po
        poi = PurchaseOrderItem(purchase_order=po)
        poi.code = self.part_number
        poi.title = self.part_title
        poi.order_item = self.order_item
        poi.product = self.order_item.product
        poi.price = self.order_item.get_purchase_price()

        poi.save()

        if po.submitted_at is None:
            po.submit(user)

        self.save()