[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
This commit is contained in:
Goffin Simon
2018-08-09 16:01:31 +02:00
parent a10ea93dbe
commit bf282f2b7b
3 changed files with 16 additions and 0 deletions
@@ -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',
@@ -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')
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record model="ir.rule" id="stock_landed_cost_rule">
<field name="name">stock_landed_cost multi-company</field>
<field name="model_id" search="[('model','=','stock.landed.cost')]" model="ir.model"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data>
</odoo>