Changeset abbce27 in rattail


Ignore:
Timestamp:
06/27/18 13:55:32 (2 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
adb85b8
Parents:
e44e830
Message:

Allow user to overwrite unit cost for inventory batch rows

also, allow unit cost to be zero

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/batch/inventory.py

    re44e830 rabbce27  
    130130            row.variance = self.total_units(row) - row.previous_units_on_hand
    131131
    132         # dynamic?
    133         row.unit_cost = self.get_unit_cost(row)
     132        # TODO: is this a sufficient check?  need to avoid overwriting a cost
     133        # value which has been manually set, but this also means the first
     134        # value that lands will stick, and e.g. new cost would be ignored
     135        if row.unit_cost is None:
     136            row.unit_cost = self.get_unit_cost(row)
     137
    134138        self.refresh_totals(row)
    135139
     
    149153        batch = row.batch
    150154
    151         if row.unit_cost:
     155        if row.unit_cost is not None:
    152156            row.total_cost = row.unit_cost * (row.full_unit_quantity or 0)
    153157            batch.total_cost = (batch.total_cost or 0) + row.total_cost
Note: See TracChangeset for help on using the changeset viewer.