[FIX] account: missing dependancy on constraint

It was possible to create inconstancies in accounting entries by forcing to sum apples and pears.

Steps to reproduce
1. create a journal entry using at least one account with a secondary currency set
2. balance and save that move
3. change the secondary currency on the line and force it to a different value than the one on the account
4. save. You'd expect an error pop up but the constraint doesn't trigger and you're allowed to save/post

opw-3340697

closes odoo/odoo#126336

X-original-commit: e6581f39ec5d550db924aa7a86dd12f511f87958
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
qdp-odoo
2023-06-26 21:10:12 +02:00
parent 9d3a2bc7d7
commit 6c46b997a3
+1 -1
View File
@@ -1126,7 +1126,7 @@ class AccountMoveLine(models.Model):
# CONSTRAINT METHODS
# -------------------------------------------------------------------------
@api.constrains('account_id', 'journal_id')
@api.constrains('account_id', 'journal_id', 'currency_id')
def _check_constrains_account_id_journal_id(self):
for line in self.filtered(lambda x: x.display_type not in ('line_section', 'line_note')):
account = line.account_id