From 18c3cf21c638010f4c8968151e86dd6ef203372f Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 09:36:45 +0100 Subject: [PATCH 001/618] 17.01.26 --- modules/purchase_trade/fee.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index 2eb09c8..ea66da6 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -370,8 +370,8 @@ class Fee(ModelSQL,ModelView): #if reception of moves done we need to generate accrual for fee StockMove = Pool().get('stock.move') feelots = FeeLots.search(['fee','=',record.id]) - for lot in feelots: - move = lot.get_received_move() + for fl in feelots: + move = fl.lot.get_received_move() if move: Warning = Pool().get('res.user.warning') warning_name = Warning.format("Lot ever received", []) -- 2.49.1 From 8e38ceb13e3817ba9858894b5badc3619e9b76c4 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 09:47:06 +0100 Subject: [PATCH 002/618] 17.01.26 --- modules/purchase_trade/fee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index ea66da6..bc7e87a 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -376,7 +376,7 @@ class Fee(ModelSQL,ModelView): Warning = Pool().get('res.user.warning') warning_name = Warning.format("Lot ever received", []) if Warning.check(warning_name): - raise Warning(warning_name, + raise UserWarning(warning_name, "By clicking yes, an accrual for this fee will be created") AccountMove = Pool().get('account.move') account_move = move._get_account_stock_move_fee(record.id) -- 2.49.1 From b43db20bc4c23d9cc9dea4fa61a477245fa0282a Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 09:53:19 +0100 Subject: [PATCH 003/618] 17.01.26 --- modules/purchase_trade/lot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/purchase_trade/lot.py b/modules/purchase_trade/lot.py index ee7bac2..c35d076 100755 --- a/modules/purchase_trade/lot.py +++ b/modules/purchase_trade/lot.py @@ -583,7 +583,7 @@ class Lot(metaclass=PoolMeta): lm = sorted(self.lot_move, key=lambda x: x.sequence, reverse=True) for m in lm: if m.move.from_location.type == 'supplier' and m.move.state == 'done': - return m + return m.move return None def GetShipment(self,type): -- 2.49.1 From 9b887a6b4c0b25f4e6a75536078dcbbb21138f40 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 09:59:48 +0100 Subject: [PATCH 004/618] 17.01.26 --- modules/purchase_trade/fee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index bc7e87a..0bb54b2 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -379,7 +379,7 @@ class Fee(ModelSQL,ModelView): raise UserWarning(warning_name, "By clicking yes, an accrual for this fee will be created") AccountMove = Pool().get('account.move') - account_move = move._get_account_stock_move_fee(record.id) + account_move = move._get_account_stock_move_fee(record) AccountMove.save([account_move]) return records -- 2.49.1 From b38f7553a6c68aebbe4484a0e433282bc6b3aa3d Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 14:03:45 +0100 Subject: [PATCH 005/618] 17.01.26 --- modules/purchase/purchase.py | 142 +++++++++++++++++------------------ 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index 078bd72..ca5acbb 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1857,77 +1857,77 @@ class Line(sequence_ordered(), ModelSQL, ModelView): else: lots_to_invoice = self.lots for l in lots_to_invoice: - #if l.lot_type == 'physic': - invoice_line = InvoiceLine() - invoice_line.type = self.type - invoice_line.currency = self.currency - invoice_line.company = self.company - invoice_line.description = self.description - invoice_line.note = self.note - invoice_line.origin = self - qt, gross_qt = l.get_hist_quantity(0) - quantity = float(qt) - quantity = Uom.compute_qty(l.lot_unit_line, quantity, self.unit) - if self.unit: - quantity = self.unit.round(quantity) - invoice_line.unit_price = l.get_lot_price() - invoice_line.product = l.lot_product - invoice_line.quantity = quantity - if not invoice_line.quantity: - return [] - invoice_line.unit = self.unit - invoice_line.taxes = self.taxes - if self.company.purchase_taxes_expense: - invoice_line.taxes_deductible_rate = 0 - elif self.product: - invoice_line.taxes_deductible_rate = ( - self.product.supplier_taxes_deductible_rate_used) - invoice_line.invoice_type = 'in' - if self.product: - invoice_line.account = self.product.account_stock_in_used - if not invoice_line.account: - raise AccountError( - gettext('purchase' - '.msg_purchase_product_missing_account_expense', - purchase=self.purchase.rec_name, - product=self.product.rec_name)) - else: - invoice_line.account = account_config.get_multivalue( - 'default_category_account_expense', company=self.company.id) - if not invoice_line.account: - raise AccountError( - gettext('purchase' - '.msg_purchase_missing_account_expense', - purchase=self.purchase.rec_name)) - if action == 'prov': - invoice_line.description = 'Pro forma' - elif action == 'final': - invoice_line.description = 'Final' - elif action == 'service': - invoice_line.description = 'Service' - #invoice_line.stock_moves = self._get_invoice_line_moves() - #invoice_line.stock_moves = [l.get_current_supplier_move()] - invoice_line.lot = l.id - if self.product.type == 'service': - invoice_line.unit_price = self.unit_price - invoice_line.product = self.product - invoice_line.stock_moves = [] - Fee = Pool().get('fee.fee') - fee = Fee.search(['purchase','=',self.purchase.id]) - if fee: - invoice_line.fee = fee[0] - lines.append(invoice_line) - logger.info("GETINVLINE:%s",self.product.type) - logger.info("GETINVLINE2:%s",l.invoice_line_prov) - if l.invoice_line_prov and self.product.type != 'service': - invoice_line_, = InvoiceLine.copy([l.invoice_line_prov], default={ - 'invoice': None, - 'quantity': -l.invoice_line_prov.quantity, - 'unit_price': l.invoice_line_prov.unit_price, - 'party': l.invoice_line_prov.invoice.party, - 'origin': str(self), - }) - lines.append(invoice_line_) + if l.lot_type == 'physic': + invoice_line = InvoiceLine() + invoice_line.type = self.type + invoice_line.currency = self.currency + invoice_line.company = self.company + invoice_line.description = self.description + invoice_line.note = self.note + invoice_line.origin = self + qt, gross_qt = l.get_hist_quantity(0) + quantity = float(qt) + quantity = Uom.compute_qty(l.lot_unit_line, quantity, self.unit) + if self.unit: + quantity = self.unit.round(quantity) + invoice_line.unit_price = l.get_lot_price() + invoice_line.product = l.lot_product + invoice_line.quantity = quantity + if not invoice_line.quantity: + return [] + invoice_line.unit = self.unit + invoice_line.taxes = self.taxes + if self.company.purchase_taxes_expense: + invoice_line.taxes_deductible_rate = 0 + elif self.product: + invoice_line.taxes_deductible_rate = ( + self.product.supplier_taxes_deductible_rate_used) + invoice_line.invoice_type = 'in' + if self.product: + invoice_line.account = self.product.account_stock_in_used + if not invoice_line.account: + raise AccountError( + gettext('purchase' + '.msg_purchase_product_missing_account_expense', + purchase=self.purchase.rec_name, + product=self.product.rec_name)) + else: + invoice_line.account = account_config.get_multivalue( + 'default_category_account_expense', company=self.company.id) + if not invoice_line.account: + raise AccountError( + gettext('purchase' + '.msg_purchase_missing_account_expense', + purchase=self.purchase.rec_name)) + if action == 'prov': + invoice_line.description = 'Pro forma' + elif action == 'final': + invoice_line.description = 'Final' + elif action == 'service': + invoice_line.description = 'Service' + #invoice_line.stock_moves = self._get_invoice_line_moves() + #invoice_line.stock_moves = [l.get_current_supplier_move()] + invoice_line.lot = l.id + if self.product.type == 'service': + invoice_line.unit_price = self.unit_price + invoice_line.product = self.product + invoice_line.stock_moves = [] + Fee = Pool().get('fee.fee') + fee = Fee.search(['purchase','=',self.purchase.id]) + if fee: + invoice_line.fee = fee[0] + lines.append(invoice_line) + logger.info("GETINVLINE:%s",self.product.type) + logger.info("GETINVLINE2:%s",l.invoice_line_prov) + if l.invoice_line_prov and self.product.type != 'service': + invoice_line_, = InvoiceLine.copy([l.invoice_line_prov], default={ + 'invoice': None, + 'quantity': -l.invoice_line_prov.quantity, + 'unit_price': l.invoice_line_prov.unit_price, + 'party': l.invoice_line_prov.invoice.party, + 'origin': str(self), + }) + lines.append(invoice_line_) return lines def _get_invoice_line_quantity(self): -- 2.49.1 From 39c9d83f1be9fcef9017cc75c446b8c4d2fb2fd8 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 14:12:11 +0100 Subject: [PATCH 006/618] 17.01.26 --- modules/purchase/purchase.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index ca5acbb..ec2fadb 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1873,6 +1873,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView): invoice_line.unit_price = l.get_lot_price() invoice_line.product = l.lot_product invoice_line.quantity = quantity + logger.info("GETINVOICELINE_QT:%s",quantity) if not invoice_line.quantity: return [] invoice_line.unit = self.unit -- 2.49.1 From 5d7d0ffe5b155c578d4fbb1d9acc547df924db0f Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 16:54:51 +0100 Subject: [PATCH 007/618] 17.01.26 --- modules/purchase_trade/fee.py | 76 ++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index 0bb54b2..ebceaa1 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -174,7 +174,7 @@ class Fee(ModelSQL,ModelView): return round(self.price / self.quantity,4) elif self.mode == 'perqt': return self.price - elif self.mode == 'pprice': + elif self.mode == 'pprice' or self.mode == 'pcost': if self.line and self.price: return round(self.price * Decimal(self.line.unit_price) / 100,4) if self.sale_line and self.price: @@ -297,46 +297,48 @@ class Fee(ModelSQL,ModelView): @classmethod def create(cls, vlist): vlist = [x.copy() for x in vlist] - records = super(Fee, cls).create(vlist) + fees = super(Fee, cls).create(vlist) qt_sh = Decimal(0) qt_line = Decimal(0) unit = None - for record in records: + for fee in fees: FeeLots = Pool().get('fee.lots') Lots = Pool().get('lot.lot') LotQt = Pool().get('lot.qt') - if record.line: - for l in record.line.lots: + if fee.line: + for l in fee.line.lots: #if l.lot_type == 'physic': fl = FeeLots() - fl.fee = record.id + fl.fee = fee.id fl.lot = l.id fl.line = l.line.id FeeLots.save([fl]) qt_line += l.get_current_quantity_converted() unit = l.line.unit - if record.sale_line: - for l in record.sale_line.lots: + if fee.sale_line: + for l in fee.sale_line.lots: #if l.lot_type == 'physic': fl = FeeLots() - fl.fee = record.id + fl.fee = fee.id fl.lot = l.id fl.sale_line = l.sale_line.id FeeLots.save([fl]) - if record.shipment_in: - if record.shipment_in.state == 'draft'or record.shipment_in.state == 'started': - lots = Lots.search(['lot_shipment_in','=',record.shipment_in.id]) + qt_line += l.get_current_quantity_converted() + unit = l.line.unit + if fee.shipment_in: + if fee.shipment_in.state == 'draft'or fee.shipment_in.state == 'started': + lots = Lots.search(['lot_shipment_in','=',fee.shipment_in.id]) if lots: for l in lots: #if l.lot_type == 'physic': fl = FeeLots() - fl.fee = record.id + fl.fee = fee.id fl.lot = l.id FeeLots.save([fl]) qt_sh += l.get_current_quantity_converted() unit = l.line.unit else: - lqts = LotQt.search(['lot_shipment_in','=',record.shipment_in.id]) + lqts = LotQt.search(['lot_shipment_in','=',fee.shipment_in.id]) if lqts: for l in lqts: qt_sh += l.lot_p.get_current_quantity_converted() @@ -344,45 +346,45 @@ class Fee(ModelSQL,ModelView): else: raise UserError("You cannot add fee on received shipment!") - type = record.type + type = fee.type if type == 'ordered': Purchase = Pool().get('purchase.purchase') PurchaseLine = Pool().get('purchase.line') pl = PurchaseLine() - pl.product = record.product - if record.line: + pl.product = fee.product + if fee.line or fee.sale_line: pl.quantity = round(qt_line,5) - if record.shipment_in: + if fee.shipment_in: pl.quantity = round(qt_sh,5) logger.info("CREATE_PURHCASE_FOR_FEE_QT:%s",pl.quantity) pl.unit = unit - pl.fee_ = record.id - if record.price: - pl.unit_price = round(Decimal(record.price),4) + pl.fee_ = fee.id + if fee.price: + pl.unit_price = round(Decimal(fee.get_price_per_qt()),4) p = Purchase() p.lines = [pl] - p.party = record.supplier + p.party = fee.supplier if p.party.addresses: p.invoice_address = p.party.addresses[0] - p.currency = record.currency + p.currency = fee.currency p.line_type = 'service' Purchase.save([p]) #if reception of moves done we need to generate accrual for fee - StockMove = Pool().get('stock.move') - feelots = FeeLots.search(['fee','=',record.id]) - for fl in feelots: - move = fl.lot.get_received_move() - if move: - Warning = Pool().get('res.user.warning') - warning_name = Warning.format("Lot ever received", []) - if Warning.check(warning_name): - raise UserWarning(warning_name, - "By clicking yes, an accrual for this fee will be created") - AccountMove = Pool().get('account.move') - account_move = move._get_account_stock_move_fee(record) - AccountMove.save([account_move]) + if not fee.sale_line: + feelots = FeeLots.search(['fee','=',fee.id]) + for fl in feelots: + move = fl.lot.get_received_move() + if move: + Warning = Pool().get('res.user.warning') + warning_name = Warning.format("Lot ever received", []) + if Warning.check(warning_name): + raise UserWarning(warning_name, + "By clicking yes, an accrual for this fee will be created") + AccountMove = Pool().get('account.move') + account_move = move._get_account_stock_move_fee(fee) + AccountMove.save([account_move]) - return records + return fees class FeeLots(ModelSQL,ModelView): -- 2.49.1 From e8453c76a7b7c03c9a99bf884c6a419c43b8c1c6 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 17:00:35 +0100 Subject: [PATCH 008/618] 17.01.26 --- modules/purchase_trade/fee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index ebceaa1..3115aa7 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -324,7 +324,7 @@ class Fee(ModelSQL,ModelView): fl.sale_line = l.sale_line.id FeeLots.save([fl]) qt_line += l.get_current_quantity_converted() - unit = l.line.unit + unit = l.sale_line.unit if fee.shipment_in: if fee.shipment_in.state == 'draft'or fee.shipment_in.state == 'started': lots = Lots.search(['lot_shipment_in','=',fee.shipment_in.id]) -- 2.49.1 From 0047e6e879ec537855f36c1dcdf176a6a4626f08 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 17:36:39 +0100 Subject: [PATCH 009/618] 17.01.26 --- modules/purchase_trade/fee.py | 37 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index 3115aa7..621f83f 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -307,30 +307,29 @@ class Fee(ModelSQL,ModelView): LotQt = Pool().get('lot.qt') if fee.line: for l in fee.line.lots: - #if l.lot_type == 'physic': - fl = FeeLots() - fl.fee = fee.id - fl.lot = l.id - fl.line = l.line.id - FeeLots.save([fl]) - qt_line += l.get_current_quantity_converted() - unit = l.line.unit + if (l.lot_type == 'virtual' and len(fee.line.lots)==1) or (l.lot_type == 'physic' and len(fee.line.lots)>1): + fl = FeeLots() + fl.fee = fee.id + fl.lot = l.id + fl.line = l.line.id + FeeLots.save([fl]) + qt_line += l.get_current_quantity_converted() + unit = l.line.unit if fee.sale_line: for l in fee.sale_line.lots: - #if l.lot_type == 'physic': - fl = FeeLots() - fl.fee = fee.id - fl.lot = l.id - fl.sale_line = l.sale_line.id - FeeLots.save([fl]) - qt_line += l.get_current_quantity_converted() - unit = l.sale_line.unit + if (l.lot_type == 'virtual' and len(fee.sale_line.lots)==1) or (l.lot_type == 'physic' and len(fee.sale_line.lots)>1): + fl = FeeLots() + fl.fee = fee.id + fl.lot = l.id + fl.sale_line = l.sale_line.id + FeeLots.save([fl]) + qt_line += l.get_current_quantity_converted() + unit = l.sale_line.unit if fee.shipment_in: if fee.shipment_in.state == 'draft'or fee.shipment_in.state == 'started': lots = Lots.search(['lot_shipment_in','=',fee.shipment_in.id]) if lots: for l in lots: - #if l.lot_type == 'physic': fl = FeeLots() fl.fee = fee.id fl.lot = l.id @@ -360,7 +359,9 @@ class Fee(ModelSQL,ModelView): pl.unit = unit pl.fee_ = fee.id if fee.price: - pl.unit_price = round(Decimal(fee.get_price_per_qt()),4) + fee_price = fee.get_price_per_qt() + logger.info("GET_FEE_PRICE_PER_QT:%s",fee_price) + pl.unit_price = round(Decimal(fee_price),4) p = Purchase() p.lines = [pl] p.party = fee.supplier -- 2.49.1 From 2f1adffba3a0929e19e918e06d9697e2bdb08146 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 17:44:01 +0100 Subject: [PATCH 010/618] 17.01.26 --- modules/purchase_trade/fee.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/purchase_trade/fee.py b/modules/purchase_trade/fee.py index 621f83f..7e81746 100755 --- a/modules/purchase_trade/fee.py +++ b/modules/purchase_trade/fee.py @@ -277,8 +277,8 @@ class Fee(ModelSQL,ModelView): logger.info("ADJUST_PURCHASE_VALUES:%s",self) if self.type == 'ordered' and self.state == 'not invoiced' and self.purchase: logger.info("ADJUST_PURCHASE_VALUES_QT:%s",self.purchase.lines[0].quantity) - if self.price != self.purchase.lines[0].unit_price: - self.purchase.lines[0].unit_price = self.price + if self.get_price_per_qt() != self.purchase.lines[0].unit_price: + self.purchase.lines[0].unit_price = self.get_price_per_qt() if self.quantity != self.purchase.lines[0].quantity: self.purchase.lines[0].quantity = self.quantity if self.product != self.purchase.lines[0].product: -- 2.49.1 From b4f794c2759479fc248d3ed9ea91910801efaac8 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 17:55:07 +0100 Subject: [PATCH 011/618] 17.01.26 --- modules/purchase/purchase.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index ec2fadb..4e12f26 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1885,7 +1885,10 @@ class Line(sequence_ordered(), ModelSQL, ModelView): self.product.supplier_taxes_deductible_rate_used) invoice_line.invoice_type = 'in' if self.product: - invoice_line.account = self.product.account_stock_in_used + if self.product.type == 'service' and not self.product.landed_cost: + invoice_line.account = self.product.account_expense_used + else: + invoice_line.account = self.product.account_stock_in_used if not invoice_line.account: raise AccountError( gettext('purchase' -- 2.49.1 From 7571a1cb807c31e86219830b327b768c0112de22 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sat, 17 Jan 2026 18:15:29 +0100 Subject: [PATCH 012/618] 17.01.26 --- modules/account_invoice/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/account_invoice/invoice.py b/modules/account_invoice/invoice.py index bc51487..cf68c2f 100755 --- a/modules/account_invoice/invoice.py +++ b/modules/account_invoice/invoice.py @@ -2031,7 +2031,7 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin, InvoiceReportMixin): var_qt = sum([i.quantity for i in gl]) logger.info("LOT_TO_PROCESS:%s",lot) logger.info("FEE_TO_PROCESS:%s",gl[0].fee) - if lot: + if (lot and not gl[0].fee) or (gl[0].fee and gl[0].product.landed_cost): adjust_move_lines = [] mov = None if self.type == 'in': -- 2.49.1 From 2ebbe334bf079dffdcdb415c73030147f83adb32 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 18 Jan 2026 10:06:48 +0100 Subject: [PATCH 013/618] 18.01.26 --- modules/purchase/purchase.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index 4e12f26..7600fea 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1005,6 +1005,11 @@ class Purchase( for purchase in purchases: logger.info("PROCESS_INVOICE:%s",action) invoice = purchase.create_invoice(lots,action) + #check if forex + forex_rate = invoice.get_forex() + if forex_rate: + invoice.selection_rate = 'forex' + if action == 'prov': invoice.reference = 'Provisional' elif action == 'service': -- 2.49.1 From 97b8632b74fab5df88ea4bfdd90bce3e5b0dc927 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 18 Jan 2026 10:18:57 +0100 Subject: [PATCH 014/618] 18.01.26 --- modules/purchase/purchase.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index 7600fea..0b2edae 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1005,11 +1005,6 @@ class Purchase( for purchase in purchases: logger.info("PROCESS_INVOICE:%s",action) invoice = purchase.create_invoice(lots,action) - #check if forex - forex_rate = invoice.get_forex() - if forex_rate: - invoice.selection_rate = 'forex' - if action == 'prov': invoice.reference = 'Provisional' elif action == 'service': @@ -1027,7 +1022,13 @@ class Purchase( Invoice = pool.get('account.invoice') Invoice.save(invoices.values()) - + for inv in invoices: + #check if forex + forex_rate = inv.get_forex() + if forex_rate: + inv.selection_rate = 'forex' + Invoice.save([inv]) + for purchase, invoice in invoices.items(): purchase.copy_resources_to(invoice) if len(invoices)==1: -- 2.49.1 From a31e51152b8d873b53b72ad660446c77c0831622 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 18 Jan 2026 10:27:55 +0100 Subject: [PATCH 015/618] 18.01.26 --- modules/purchase/purchase.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index 0b2edae..bd7c51b 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1021,15 +1021,14 @@ class Purchase( pool = Pool() Invoice = pool.get('account.invoice') - Invoice.save(invoices.values()) - for inv in invoices: - #check if forex - forex_rate = inv.get_forex() - if forex_rate: - inv.selection_rate = 'forex' - Invoice.save([inv]) + Invoice.save(invoices.values()) for purchase, invoice in invoices.items(): + #check if forex + forex_rate = invoice.get_forex() + if forex_rate: + invoice.selection_rate = 'forex' + Invoice.save([invoice]) purchase.copy_resources_to(invoice) if len(invoices)==1: if prepayment: -- 2.49.1 From db7288c70920d79b12a6a6d9821db8d03fbb1633 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 18 Jan 2026 10:51:40 +0100 Subject: [PATCH 016/618] 18.01.26 --- modules/purchase/purchase.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index bd7c51b..68d560e 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1028,6 +1028,7 @@ class Purchase( forex_rate = invoice.get_forex() if forex_rate: invoice.selection_rate = 'forex' + invoice.on_change_with_rate() Invoice.save([invoice]) purchase.copy_resources_to(invoice) if len(invoices)==1: -- 2.49.1 From 11f33236cfc934649f24aa57da6f6c136852b31c Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 18 Jan 2026 11:05:00 +0100 Subject: [PATCH 017/618] 18.01.26 --- modules/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py index 68d560e..00b8180 100755 --- a/modules/purchase/purchase.py +++ b/modules/purchase/purchase.py @@ -1028,7 +1028,7 @@ class Purchase( forex_rate = invoice.get_forex() if forex_rate: invoice.selection_rate = 'forex' - invoice.on_change_with_rate() + invoice.rate = invoice.on_change_with_rate() Invoice.save([invoice]) purchase.copy_resources_to(invoice) if len(invoices)==1: -- 2.49.1 From 0d3bfda08c77f52e59d60c88c11c9b19b337205c Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 18 Jan 2026 12:07:27 +0100 Subject: [PATCH 018/618] 18.01.26 --- modules/account_invoice/view/invoice_form.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/account_invoice/view/invoice_form.xml b/modules/account_invoice/view/invoice_form.xml index efa4392..9e900c2 100755 --- a/modules/account_invoice/view/invoice_form.xml +++ b/modules/account_invoice/view/invoice_form.xml @@ -92,8 +92,8 @@ this repository contains the full copyright notices and license terms. --> -