diff --git a/tailbone/views/purchasing/batch.py b/tailbone/views/purchasing/batch.py index 8941de1c..746ae4d3 100644 --- a/tailbone/views/purchasing/batch.py +++ b/tailbone/views/purchasing/batch.py @@ -662,6 +662,9 @@ class PurchasingBatchView(BatchMasterView): f.set_type('invoice_unit_cost', 'currency') f.set_type('invoice_total', 'currency') + # upc + f.set_type('upc', 'gpc') + if self.creating: f.remove_fields( 'upc', diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index 88acc16c..b61c53af 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -775,6 +775,9 @@ class ReceivingBatchView(PurchasingBatchView): parent_rows = [row for row in batch.truck_dump_batch.active_rows() if row.product_uuid == old_row.product_uuid] + # NOTE: "confirmed" are the proper amounts which exist in the + # parent batch. "claimed" are the amounts claimed by this row. + # get existing "confirmed" and "claimed" amounts for all # (possibly related) truck dump parent rows confirmed = {} @@ -882,7 +885,7 @@ class ReceivingBatchView(PurchasingBatchView): # next we'd prefer to add to an existing claim, of any kind elif row.truck_dump_claims: claim = row.truck_dump_claims[0] - setattr(claim, key, getattr(claim, key) + amount) + setattr(claim, key, (getattr(claim, key) or 0) + amount) else: # otherwise we must create a new claim...