コード例 #1
0
    def reserve_fabric(self,
                       fabric,
                       quantity,
                       acknowledgement_id,
                       employee=None):
        """
        Internal method to apply the new quantity to the obj and
        create or update a log of the quantity change
        """

        #Create log to track quantity changes
        try:
            log = Log.objects.get(acknowledgement_id=acknowledgement_id,
                                  supply_id=fabric.id)
        except Log.DoesNotExist:
            log = Log(supply=fabric, acknowledgement_id=acknowledgement_id)

        # Get log quantity for fabric cut later
        original_qty = log.quantity or 0

        # Set log attributes
        log.action = "RESERVE"
        log.quantity = quantity
        log.employee = employee
        log.message = u"Reserve {0}{1} of {2} for Ack#{3}".format(
            quantity, fabric.units, fabric.description, acknowledgement_id)

        # Save log
        log.save()
コード例 #2
0
    def reserve_fabric(self, fabric, quantity, acknowledgement_id, employee=None):
        """
        Internal method to apply the new quantity to the obj and
        create or update a log of the quantity change
        """



        #Create log to track quantity changes
        try:
            log = Log.objects.get(acknowledgement_id=acknowledgement_id, supply_id=fabric.id)
        except Log.DoesNotExist:
            log = Log(supply=fabric, acknowledgement_id=acknowledgement_id)

        # Get log quantity for fabric cut later
        original_qty = log.quantity or 0

        # Set log attributes
        log.action = "RESERVE"
        log.quantity = quantity
        log.employee = employee
        log.message = u"Reserve {0}{1} of {2} for Ack#{3}".format(quantity,
                                                                  fabric.units,
                                                                  fabric.description,
                                                                  acknowledgement_id)

        # Save log
        log.save()