This commit is contained in:
2026-03-16 14:41:29 +01:00
parent eac35b849f
commit 498da9a728
2 changed files with 20 additions and 21 deletions

View File

@@ -151,26 +151,26 @@ class Fee(ModelSQL,ModelView):
if self.auto_calculation:
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')
def on_change_with_unit(self, name=None):
if self.mode != 'ppack' and self.mode != 'perqt':
line = self.line
if not line:
line = self.sale_line
if line:
if line.lots:
if len(line.lots) == 1:
return line.lots[0].lot_unit_line
else:
return line.lots[1].lot_unit_line
if self.shipment_in:
Lot = Pool().get('lot.lot')
lots = Lot.search([('lot_shipment_in','=',self.shipment_in.id)])
logger.info("ON_CHANGE_WITH_UNIT:%s",lots)
if lots:
return lots[0].lot_unit_line
else:
return self.unit
# @fields.depends('price','mode','_parent_line.lots','_parent_sale_line.lots','shipment_in')
# def on_change_with_unit(self, name=None):
# if self.mode != 'ppack' and self.mode != 'perqt':
# line = self.line
# if not line:
# line = self.sale_line
# if line:
# if line.lots:
# if len(line.lots) == 1:
# return line.lots[0].lot_unit_line
# else:
# return line.lots[1].lot_unit_line
# if self.shipment_in:
# Lot = Pool().get('lot.lot')
# lots = Lot.search([('lot_shipment_in','=',self.shipment_in.id)])
# logger.info("ON_CHANGE_WITH_UNIT:%s",lots)
# if lots:
# return lots[0].lot_unit_line
# else:
# return self.unit
def get_lots(self, name):
logger.info("GET_LOTS_LINE:%s",self.line)

View File

@@ -7,7 +7,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="supplier"/>
<field name="mode"/>
<field name="unit"/>
<field name="packing_category"/>
<field name="auto_calculation" width="60"/>
<field name="price"/>
<field name="currency"/>