[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) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-06-08 11:21:24 +00:00
parent 6ac5b14d52
commit 54c828bcba
+2
View File
@@ -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):