main #7
@@ -129,6 +129,7 @@ class Fee(ModelSQL,ModelView):
|
|||||||
if line:
|
if line:
|
||||||
if line.lots:
|
if line.lots:
|
||||||
qt = sum([e.get_current_quantity_converted(0,self.unit) for e in line.lots])
|
qt = sum([e.get_current_quantity_converted(0,self.unit) for e in line.lots])
|
||||||
|
qt_ = sum([e.get_current_quantity_converted(0) for e in line.lots])
|
||||||
unit = line.lots[0].lot_unit_line
|
unit = line.lots[0].lot_unit_line
|
||||||
logger.info("ON_CHANGE_WITH_QT0:%s",qt)
|
logger.info("ON_CHANGE_WITH_QT0:%s",qt)
|
||||||
logger.info("ON_CHANGE_WITH_SI:%s",self.shipment_in)
|
logger.info("ON_CHANGE_WITH_SI:%s",self.shipment_in)
|
||||||
@@ -138,6 +139,7 @@ class Fee(ModelSQL,ModelView):
|
|||||||
logger.info("ON_CHANGE_WITH_LOTS:%s",lots)
|
logger.info("ON_CHANGE_WITH_LOTS:%s",lots)
|
||||||
if lots:
|
if lots:
|
||||||
qt = sum([e.get_current_quantity_converted(0,self.unit) for e in lots])
|
qt = sum([e.get_current_quantity_converted(0,self.unit) for e in lots])
|
||||||
|
qt_ = sum([e.get_current_quantity_converted(0) for e in lots])
|
||||||
unit = lots[0].lot_unit_line
|
unit = lots[0].lot_unit_line
|
||||||
if not qt:
|
if not qt:
|
||||||
logger.info("ON_CHANGE_WITH_QT1:%s",qt)
|
logger.info("ON_CHANGE_WITH_QT1:%s",qt)
|
||||||
@@ -146,13 +148,14 @@ class Fee(ModelSQL,ModelView):
|
|||||||
lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id])
|
lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id])
|
||||||
if lqts:
|
if lqts:
|
||||||
qt = Decimal(lqts[0].lot_quantity)
|
qt = Decimal(lqts[0].lot_quantity)
|
||||||
|
qt_ = qt
|
||||||
unit = lqts[0].lot_unit
|
unit = lqts[0].lot_unit
|
||||||
logger.info("ON_CHANGE_WITH_QT2:%s",qt)
|
logger.info("ON_CHANGE_WITH_QT2:%s",qt)
|
||||||
if self.mode != 'ppack':
|
if self.mode != 'ppack':
|
||||||
return qt
|
return qt
|
||||||
else:
|
else:
|
||||||
if self.auto_calculation:
|
if self.auto_calculation:
|
||||||
return (qt * Decimal(unit.factor) / Decimal(self.unit.factor)).to_integral_value(rounding=ROUND_UP)
|
return (qt_ * Decimal(unit.factor) / Decimal(self.unit.factor)).to_integral_value(rounding=ROUND_UP)
|
||||||
|
|
||||||
@fields.depends('price','mode','_parent_line.lots','_parent_sale_line.lots','shipment_in')
|
@fields.depends('price','mode','_parent_line.lots','_parent_sale_line.lots','shipment_in')
|
||||||
def on_change_with_unit(self, name=None):
|
def on_change_with_unit(self, name=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user