Lot invoicing + Fee padding

This commit is contained in:
2026-06-23 15:28:11 +02:00
parent 2998d8d570
commit cf7aa7f5b5
2 changed files with 35 additions and 5 deletions

View File

@@ -4767,7 +4767,7 @@ class LotInvoice(Wizard):
val['fee_quantity'] = f.quantity
val['fee_price'] = f.price
val['fee_unit'] = purchase_line.unit.id
val['fee_amount'] = f.amount
val['fee_amount'] = self._fee_display_amount(f, act)
val['fee_landed_cost'] = f.fee_landed_cost
fee_pur.append(val)
if line:
@@ -4796,7 +4796,7 @@ class LotInvoice(Wizard):
val['fee_quantity'] = f.quantity
val['fee_price'] = f.price
val['fee_unit'] = current_sale_line.unit.id
val['fee_amount'] = f.amount
val['fee_amount'] = self._fee_display_amount(f, act)
val['fee_landed_cost'] = f.fee_landed_cost
fee_sale.append(val)
if sale_line:
@@ -4818,9 +4818,20 @@ class LotInvoice(Wizard):
'pp_pur': pp_pur,
'fee_sale': fee_sale,
'pp_sale': pp_sale,
'action': act
}
'action': act
}
@staticmethod
def _fee_display_amount(fee, action):
if (
action == 'final'
and getattr(fee, 'state', None) == 'invoiced'
and getattr(fee, 'add_padding', False)):
with Transaction().set_context(
_purchase_trade_ignore_fee_padding=True):
return fee.amount
return fee.amount
def transition_invoicing(self):
Lot = Pool().get('lot.lot')
Purchase = Pool().get('purchase.purchase')