Flag invoice case quantity diffs for receiving, when applicable
This commit is contained in:
parent
1be88bb667
commit
1daf4022fb
|
@ -2111,11 +2111,27 @@ class PurchaseBatchHandler(BatchHandler):
|
|||
if batch.order_quantities_known and (
|
||||
self.get_units_shipped(row) != self.get_units_accounted_for(row)):
|
||||
row.status_code = row.STATUS_ORDERED_RECEIVED_DIFFER
|
||||
|
||||
elif case_quantity_differs:
|
||||
cost = row.product.cost_for_vendor(batch.vendor)
|
||||
row.status_code = row.STATUS_CASE_QUANTITY_DIFFERS
|
||||
row.status_text = "batch has {} but master cost has {}".format(
|
||||
repr(row.case_quantity), repr(cost.case_size))
|
||||
|
||||
# the canonical "case size" for the row will always
|
||||
# match the master cost record on file, but the
|
||||
# invoice may have a different value. there will be
|
||||
# false alarms e.g. for 6-pack soda, so we only flag
|
||||
# these if *totals* also do not match, *and* if the
|
||||
# case UOM is being received
|
||||
elif (row.invoice_case_size is not None
|
||||
and row.invoice_case_size != row.case_quantity
|
||||
and row.invoice_total is not None
|
||||
and row.invoice_total_calculated != row.invoice_total
|
||||
and (row.cases_ordered or row.cases_shipped)):
|
||||
row.status_code = row.STATUS_CASE_QUANTITY_DIFFERS
|
||||
row.status_text = f"master has {row.case_quantity} but invoice has {row.invoice_case_size}"
|
||||
|
||||
# TODO: is this right? should out of stock just be a filter for
|
||||
# the user to specify, or should it affect status?
|
||||
elif row.out_of_stock:
|
||||
|
|
Loading…
Reference in a new issue