From 50b262dbd254b1029e4dd1f7e9fd9bc1644cd2d0 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Tue, 23 Jun 2026 13:54:14 +0200 Subject: [PATCH] Lot invoicing + Fee padding --- modules/purchase_trade/lot.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/purchase_trade/lot.py b/modules/purchase_trade/lot.py index a96c452..7a3fc9a 100755 --- a/modules/purchase_trade/lot.py +++ b/modules/purchase_trade/lot.py @@ -5036,6 +5036,14 @@ class LotInvoiceStart(ModelView): if getattr(line, 'lot', None)] return self._split_sale_padding(self.sale_padding, lots) + @classmethod + def _split_sale_padding(cls, padding, lots): + padding = Decimal(str(padding or 0)) + if not padding or not lots: + return {} + share = padding / Decimal(len(lots)) + return {lot.id: share for lot in lots} + @staticmethod def _record_key(record): return getattr(record, 'id', None) or id(record)