Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] l10n_nl_tax_statement: don't break when writing list of ids on x2many #419

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading