Skip to content

Commit

Permalink
[FIX] l10n_nl_tax_statement: don't break when writing list of ids
Browse files Browse the repository at this point in the history
on x2many
  • Loading branch information
hbrunn committed Jul 24, 2024
1 parent 266500c commit b265184
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion l10n_nl_tax_statement/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def check_field_is_equal(self, changed_protected_field, values):
old_value = self[changed_protected_field]
new_value = values[changed_protected_field]
if field.type in ["many2many", "one2many"]:
# if field is X2M , the only acceptable value is
if all(isinstance(_id, int) for _id in new_value):
return new_value == old_value.ids
# if field is X2M , the only other acceptable value is
# [[6,0,self[changed_protected_field].ids]]
# wich is what the web client posts in case there is a editable X2M in form
# that is unchanged.
Expand Down
5 changes: 5 additions & 0 deletions l10n_nl_tax_statement/tests/test_l10n_nl_vat_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,3 +581,8 @@ def test_20_multicompany(self):

company_ids_full_list = statement_parent._get_company_ids_full_list()
self.assertEqual(len(company_ids_full_list), 3)

def test_21_write_id_list(self):
self._create_test_invoice()
self.invoice_1.line_ids.write({"tax_tag_ids": self.tag_1.ids})
self.assertEqual(self.invoice_1.mapped("line_ids.tax_tag_ids"), self.tag_1)

0 comments on commit b265184

Please sign in to comment.