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