From 865695577c932999ad1482e74c86b45e68ad85e6 Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Sat, 24 Jan 2026 16:30:20 +0700 Subject: [PATCH] fix: Prevent incorrect vendor bill line revaluation during credit note creation by restricting logic to vendor bills (`in_invoice`) and update Odoo compatibility to 19.0. --- README.md | 6 +++++- models/account_move_line.py | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b58adab..292dce9 100755 --- a/README.md +++ b/README.md @@ -223,7 +223,7 @@ python customaddons/vendor_bill_editable_totals/tests/run_integration_tests.py ## Compatibility -- **Odoo Version:** 17.0 +- **Odoo Version:** 19.0 - **Python Version:** 3.10+ - **Database:** PostgreSQL 12+ - **License:** LGPL-3 @@ -238,6 +238,10 @@ For issues, questions, or contributions, please contact your system administrato ## Changelog +### Version 19.0.1.0.3 +- Fix incorrect vendor bill line revaluation during credit note creation +- Restrict logic to vendor bills (`in_invoice`) only + ### Version 17.0.1.0.0 - Initial release - Direct editing of price_subtotal on vendor bill lines diff --git a/models/account_move_line.py b/models/account_move_line.py index f3789b1..745a0e1 100755 --- a/models/account_move_line.py +++ b/models/account_move_line.py @@ -117,7 +117,10 @@ class AccountMoveLine(models.Model): if 'price_unit' in vals or 'quantity' in vals: for line in self: # Only for vendor bills and if linked to a PO line - if line.move_id.move_type in ('in_invoice', 'in_refund') and line.purchase_line_id: + # Fix: Do not sync if triggered by Credit Note creation (Reversal Wizard) + if line.move_id.move_type == 'in_invoice' and \ + line.purchase_line_id and \ + self.env.context.get('active_model') != 'account.move.reversal': po_line = line.purchase_line_id # 1. Sync Price