From 2823a948b0c53a27bb6df37bde06e073468e9983 Mon Sep 17 00:00:00 2001 From: william Date: Tue, 7 Apr 2020 09:10:51 +0000 Subject: [PATCH] [FIX] account_analytic_default: multiple line erase opw-2230833 * What are the steps to reproduce your issue? 1. Goto https://runbot.odoo.com/runbot and connect to latest enterprise version 2. Create a vendor bill with with 2 invoice lines, both having an analytic account. 3. Click save. 4. Click Edit 5. Change analytic account on 1 line. 6. Click save. * What is the current behavior that you observe? The other invoice line has it's analytic line resetted to default (null, exept if analytic_account_default is used), even though that line was not edited, by the user. * What would be your expected behavior in this case? No extra changes on lines that were not edited when saving the invoice. I checked that if you comment out '_onchange_invoice_line_ids' method from account.move this issue disappears, so maybe start looking for the bug from there. closes odoo/odoo#49174 X-original-commit: a3e9598a1d964675a545680c34ee87a6136ef71c Signed-off-by: Simon Goffin (sig) --- .../models/account_analytic_default.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_analytic_default/models/account_analytic_default.py b/addons/account_analytic_default/models/account_analytic_default.py index 80028a74943..e0d34d33ada 100644 --- a/addons/account_analytic_default/models/account_analytic_default.py +++ b/addons/account_analytic_default/models/account_analytic_default.py @@ -83,5 +83,5 @@ class AccountMoveLine(models.Model): date=record.date_maturity, company_id=record.move_id.company_id.id ) - record.analytic_account_id = record.analytic_account_id or rec.analytic_id - record.analytic_tag_ids = record.analytic_tag_ids or rec.analytic_tag_ids + record.analytic_account_id = (record._origin or record).analytic_account_id or rec.analytic_id + record.analytic_tag_ids = (record._origin or record).analytic_tag_ids or rec.analytic_tag_ids