This commit is contained in:
2026-03-16 14:46:11 +01:00
parent 498da9a728
commit e78eb80d08

View File

@@ -72,7 +72,7 @@ class Fee(ModelSQL,ModelView):
states={ states={
'readonly': (Bool(Eval('mode') != 'ppack') & Bool(Eval('mode') != 'perqt')), 'readonly': (Bool(Eval('mode') != 'ppack') & Bool(Eval('mode') != 'perqt')),
}) })
packing_category = fields.Function(fields.Many2One('product.uom.category',"Packing Category"),'get_packing_category') packing_category = fields.Function(fields.Many2One('product.uom.category',"Packing Category"),'on_change_with_packing_category')
inherit_shipment = fields.Boolean("Inh Sh",states={ inherit_shipment = fields.Boolean("Inh Sh",states={
'invisible': (Eval('shipment_in')), 'invisible': (Eval('shipment_in')),
}) })
@@ -110,7 +110,7 @@ class Fee(ModelSQL,ModelView):
if lqt: if lqt:
return lqt[0].id return lqt[0].id
def get_packing_category(self, name): def on_change_with_packing_category(self, name=None):
UnitCategory = Pool().get('product.uom.category') UnitCategory = Pool().get('product.uom.category')
packing = UnitCategory.search(['name','=','Packing']) packing = UnitCategory.search(['name','=','Packing'])
if packing: if packing:
@@ -151,26 +151,26 @@ class Fee(ModelSQL,ModelView):
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):
# if self.mode != 'ppack' and self.mode != 'perqt': if self.mode != 'ppack' and self.mode != 'perqt':
# line = self.line line = self.line
# if not line: if not line:
# line = self.sale_line line = self.sale_line
# if line: if line:
# if line.lots: if line.lots:
# if len(line.lots) == 1: if len(line.lots) == 1:
# return line.lots[0].lot_unit_line return line.lots[0].lot_unit_line
# else: else:
# return line.lots[1].lot_unit_line return line.lots[1].lot_unit_line
# if self.shipment_in: if self.shipment_in:
# Lot = Pool().get('lot.lot') Lot = Pool().get('lot.lot')
# lots = Lot.search([('lot_shipment_in','=',self.shipment_in.id)]) lots = Lot.search([('lot_shipment_in','=',self.shipment_in.id)])
# logger.info("ON_CHANGE_WITH_UNIT:%s",lots) logger.info("ON_CHANGE_WITH_UNIT:%s",lots)
# if lots: if lots:
# return lots[0].lot_unit_line return lots[0].lot_unit_line
# else: else:
# return self.unit return self.unit
def get_lots(self, name): def get_lots(self, name):
logger.info("GET_LOTS_LINE:%s",self.line) logger.info("GET_LOTS_LINE:%s",self.line)