Changeset 5120841 in tailbone


Ignore:
Timestamp:
03/11/19 12:20:56 (4 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
9b1efc3
Parents:
8bb09f5
Message:

Fix PO unit cost calculation for ordering row, batch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tailbone/views/purchasing/ordering.py

    r8bb09f5 r5120841  
    265265                    batch.rowcount += 1
    266266                self.handler.refresh_row(row)
     267                if row.po_unit_cost:
     268                    row.po_total = row.po_unit_cost * self.handler.get_units_ordered(row)
     269                    batch.po_total = (batch.po_total or 0) + row.po_total
    267270            else:
    268271                row.removed = True
     
    270273        elif cases_ordered or units_ordered:
    271274            row = model.PurchaseBatchRow()
    272             row.sequence = max([0] + [r.sequence for r in batch.data_rows]) + 1
    273275            row.product = product
    274             batch.data_rows.append(row)
    275276            row.cases_ordered = cases_ordered or None
    276277            row.units_ordered = units_ordered or None
    277             self.handler.refresh_row(row)
    278             batch.rowcount = (batch.rowcount or 0) + 1
     278            self.handler.add_row(batch, row)
     279            if row.po_unit_cost:
     280                row.po_total = row.po_unit_cost * self.handler.get_units_ordered(row)
     281                batch.po_total = (batch.po_total or 0) + row.po_total
    279282
    280283        return {
Note: See TracChangeset for help on using the changeset viewer.