[FIX] account: sanitize vals, field explicitely empty other one is not

- Create invoice with default `invoice_line_ids`. In the Values both
fields `invoice_line_ids` and `line_ids`, field `line_ids` is empty,
filed `invoice_line_ids` not empty.
  function _sanitize_vals return vals with del `invoice_line_ids`, but
function `_add_missing_default_values` update value default of filed
`invoice_line_ids` in to values.
  And as a result, the invoice is generated with 2 duplicated lines.

closes odoo/odoo#124764

X-original-commit: 87f14b051ee5e7c8f1f86aaf758a98d7b2d2421e
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
Trịnh Ngọc Hưng
2023-06-13 11:28:00 +02:00
parent fb00c98a72
commit aec840bb56
+1 -1
View File
@@ -2254,7 +2254,7 @@ class AccountMove(models.Model):
return copied_am
def _sanitize_vals(self, vals):
if 'invoice_line_ids' in vals and 'line_ids' in vals:
if vals.get('invoice_line_ids') and vals.get('line_ids'):
# values can sometimes be in only one of the two fields, sometimes in
# both fields, sometimes one field can be explicitely empty while the other
# one is not, sometimes not...