diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index 050b693..99bf636 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -100,7 +100,7 @@ class Fee(ModelSQL,ModelView): if lqt: return lqt[0].id - @fields.depends('line','sale_line','unit','auto_calculation','mode','_parent_line.unit','_parent_line.lots','_parent_sale_line.unit','_parent_sale_line.lots','_parent_shipment_in.id') + @fields.depends('unit','auto_calculation','mode','_parent_line.unit','_parent_line.lots','_parent_sale_line.unit','_parent_sale_line.lots','_parent_shipment_in.id') def on_change_with_quantity(self, name=None): qt = None unit = None @@ -113,6 +113,13 @@ class Fee(ModelSQL,ModelView): qt = sum([e.get_current_quantity() for e in line.lots]) unit = line.lots[0].lot_unit_line logger.info("ON_CHANGE_WITH_QT0:%s",qt) + logger.info("ON_CHANGE_WITH_SHIPMENT_IN:%s",self.shipment_in) + if self.shipment_in: + Lot = Pool().get('lot.lot') + lots = Lot.search([('lot_shipment_in','=',self.shipment_in.id)]) + logger.info("ON_CHANGE_WITH_LOTS:%s",lots) + if lots: + qt = sum([e.get_current_quantity() for e in lots]) if not qt: logger.info("ON_CHANGE_WITH_QT1:%s",qt) LotQt = Pool().get('lot.qt')