From 54c828bcbaf293fe0c0e7b6a3c3649dcaa518428 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 4 Jun 2020 14:01:53 +0000 Subject: [PATCH] [FIX] sale: Duplicated Sale Order Sequences through Imports Steps to reproduce the bug: - Let's consider a company C in the Arab Emirates(AE) with l10n_ae - Let's consider a customer C1 from AE (as country) and Abu Dhabi (as state) - Let's consider a customer C2 from AE (as country) and Dubai (as state) - Let's consider that the current user has no right in accounting - Let's consider the SO sequence with no_gap and with next_number=1 - Create a product P with 5% dubai tax - Create SO1 for C1 with P (next_number=2) - Create SO2 for C2 with P (next_number=3) - Export SO1 and SO2 xlsx file F - Import F Bug: An error message appeared in the logs: odoo.addons.base.models.ir_model: Access Denied by ACLs for operation: write, uid: 6, model: account.tax because odoo tried to write on the field invoice_repartition_line_ids computed from function compute_all on model account.tax The next_number was 4 instead of 5 because the update made in function _update_nogap was rollbacked due the Access Denied opw:2266048 closes odoo/odoo#52588 X-original-commit: e009c3a0df12801e06a4e2301f888ca77bb24946 Signed-off-by: Simon Goffin (sig) --- addons/sale/models/sale.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 71df75c4d8a..6b6c5d0603e 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1117,6 +1117,8 @@ class SaleOrderLine(models.Model): 'price_total': taxes['total_included'], 'price_subtotal': taxes['total_excluded'], }) + if self.env.context.get('import_file', False) and not self.env.user.user_has_groups('account.group_account_manager'): + line.tax_id.invalidate_cache(['invoice_repartition_line_ids'], [line.tax_id.id]) @api.depends('product_id', 'order_id.state', 'qty_invoiced', 'qty_delivered') def _compute_product_updatable(self):