This commit is contained in:
2026-03-10 12:54:46 +01:00
parent d609864822
commit 5f49e01495

View File

@@ -102,14 +102,14 @@ class Fee(ModelSQL,ModelView):
Date = Pool().get('ir.date')
return Date.today()
# @classmethod
# def default_qt_state(cls):
# LotQtType = Pool().get('lot.qt.type')
# lqt = LotQtType.search([('name','=','BL')])
# if lqt:
# return lqt[0].id
@classmethod
def default_qt_state(cls):
LotQtType = Pool().get('lot.qt.type')
lqt = LotQtType.search([('name','=','BL')])
if lqt:
return lqt[0].id
@fields.depends('price','unit','auto_calculation','mode','_parent_line.unit','_parent_line.lots','_parent_sale_line.unit','_parent_sale_line.lots','_parent_shipment_in.id')
@fields.depends('price','unit','auto_calculation','mode','_parent_line.unit','_parent_line.lots','_parent_sale_line.unit','_parent_sale_line.lots','_parent_shipment_in')
def on_change_with_quantity(self, name=None):
qt = None
unit = None
@@ -122,7 +122,6 @@ 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)])
@@ -133,11 +132,12 @@ class Fee(ModelSQL,ModelView):
if not qt:
logger.info("ON_CHANGE_WITH_QT1:%s",qt)
LotQt = Pool().get('lot.qt')
lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id])
if lqts:
qt = Decimal(lqts[0].lot_quantity)
unit = lqts[0].lot_unit
logger.info("ON_CHANGE_WITH_QT2:%s",qt)
if self.shipment_in:
lqts = LotQt.search(['lot_shipment_in','=',self.shipment_in.id])
if lqts:
qt = Decimal(lqts[0].lot_quantity)
unit = lqts[0].lot_unit
logger.info("ON_CHANGE_WITH_QT2:%s",qt)
if self.mode != 'ppack':
return qt
else: