Fix: Prevent incorrect vendor bill line revaluation during credit note creation by restricting the logic to vendor invoices.

This commit is contained in:
Suherdy Yacob 2026-01-24 16:24:49 +07:00
parent 64cac68586
commit b09d75d7c5
4 changed files with 22 additions and 1 deletions

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
# Python
__pycache__/
*.py[cod]
*$py.class
# Odoo
*.po
.ipynb_checkpoints/
# Editors
.vscode/
.idea/
*.swp
*.swo

View File

@ -238,6 +238,10 @@ For issues, questions, or contributions, please contact your system administrato
## Changelog ## Changelog
### Version 17.0.1.1.0
- Fix: Prevent incorrect revaluation entries (STJ) on Vendor Bills when creating Credit Notes (Reversal).
- Fix: Restricted revaluation logic to strictly apply only when manually editing Vendor Bills, excluding system-triggered updates during reversals.
### Version 17.0.1.0.0 ### Version 17.0.1.0.0
- Initial release - Initial release
- Direct editing of price_subtotal on vendor bill lines - Direct editing of price_subtotal on vendor bill lines

View File

@ -117,7 +117,10 @@ class AccountMoveLine(models.Model):
if 'price_unit' in vals or 'quantity' in vals: if 'price_unit' in vals or 'quantity' in vals:
for line in self: for line in self:
# Only for vendor bills and if linked to a PO line # 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 po_line = line.purchase_line_id
# 1. Sync Price # 1. Sync Price