From bf282f2b7b02f279bdf703d8fc74c63b28594f71 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 9 Aug 2018 13:36:16 +0200 Subject: [PATCH] [FIX] stock_landed_costs: List view in multi-company In multi-company, it was not possible to distinguish the records of the current company of the user. opw:1870561 --- addons/stock_landed_costs/__manifest__.py | 1 + .../stock_landed_costs/models/stock_landed_cost.py | 2 ++ .../security/stock_landed_cost_security.xml | 13 +++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 addons/stock_landed_costs/security/stock_landed_cost_security.xml diff --git a/addons/stock_landed_costs/__manifest__.py b/addons/stock_landed_costs/__manifest__.py index 436a601b9bc..8a3bf344ed3 100644 --- a/addons/stock_landed_costs/__manifest__.py +++ b/addons/stock_landed_costs/__manifest__.py @@ -18,6 +18,7 @@ This module allows you to easily add extra costs on pickings and decide the spli ], 'data': [ 'security/ir.model.access.csv', + 'security/stock_landed_cost_security.xml', 'data/stock_landed_cost_data.xml', 'views/product_views.xml', 'views/stock_landed_cost_views.xml', diff --git a/addons/stock_landed_costs/models/stock_landed_cost.py b/addons/stock_landed_costs/models/stock_landed_cost.py index 2cd24d707ae..6dfeb180684 100644 --- a/addons/stock_landed_costs/models/stock_landed_cost.py +++ b/addons/stock_landed_costs/models/stock_landed_cost.py @@ -51,6 +51,8 @@ class LandedCost(models.Model): account_journal_id = fields.Many2one( 'account.journal', 'Account Journal', required=True, states={'done': [('readonly', True)]}) + company_id = fields.Many2one('res.company', string="Company", + related='account_journal_id.company_id') @api.one @api.depends('cost_lines.price_unit') diff --git a/addons/stock_landed_costs/security/stock_landed_cost_security.xml b/addons/stock_landed_costs/security/stock_landed_cost_security.xml new file mode 100644 index 00000000000..1182f9c687a --- /dev/null +++ b/addons/stock_landed_costs/security/stock_landed_cost_security.xml @@ -0,0 +1,13 @@ + + + + + + stock_landed_cost multi-company + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + + \ No newline at end of file