From fe6b351e04b7aa7d311cc07362d82f9843dde862 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 24 Oct 2019 11:38:31 +0000 Subject: [PATCH] [FIX] mrp_account: access to BOM - Install MRP and Accounting - Create a user with only 'Billing' as access right - Create a customer invoice - Add a line, type some text (e.g. 'desk'), then click on 'Search more...' An `AccessError` is raised. It arises because of this: https://github.com/odoo/odoo/blob/e2d7cf7898704c82f25556b0b0edb87c05ec5903/addons/mrp/models/product.py#L112 The user has no access to `mrp.bom`, leading to the error. Since the user has access to stock moves and pickings (thanks to the rules `access_stock_picking_invoicing_payments` and `access_stock_move_invoicing_payments`, it makes sense to give him access to `mrp.bom` and `mrp.bom.line`. Moreover, adding a `sudo` on the mentioned line could cause issues since `_bom_find` performs a search which is company dependent. opw-2089556 closes odoo/odoo#39365 X-original-commit: 59ea1993bc5ddb66675bfc2bff70a626cd14b645 Signed-off-by: Nicolas Martinelli (nim) --- addons/mrp_account/__manifest__.py | 1 + addons/mrp_account/security/ir.model.access.csv | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 addons/mrp_account/security/ir.model.access.csv diff --git a/addons/mrp_account/__manifest__.py b/addons/mrp_account/__manifest__.py index 29dc54e3afb..e634f967e50 100644 --- a/addons/mrp_account/__manifest__.py +++ b/addons/mrp_account/__manifest__.py @@ -22,6 +22,7 @@ If the automated inventory valuation is active, the necessary accounting entries "init_xml" : [], "demo_xml" : [], "data": [ + 'security/ir.model.access.csv', "views/product_views.xml", "views/mrp_production_views.xml", ], diff --git a/addons/mrp_account/security/ir.model.access.csv b/addons/mrp_account/security/ir.model.access.csv new file mode 100644 index 00000000000..5762ae6cd24 --- /dev/null +++ b/addons/mrp_account/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_mrp_bom_invoice_bom,mrp.bom,mrp.model_mrp_bom,account.group_account_invoice,1,0,0,0 +access_mrp_bom_line_invoice_bom,mrp.bom.line,mrp.model_mrp_bom_line,account.group_account_invoice,1,0,0,0