summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2018-08-09 13:36:16 +0200
committerGoffin Simon <sig@odoo.com>2018-08-09 16:01:31 +0200
commitbf282f2b7b02f279bdf703d8fc74c63b28594f71 (patch)
treeb84da8889e2e8242fe35afa4841b51dc6f8c1c58
parenta10ea93dbe5bbfcdc53f7ba46fd2b52ef6862a8f (diff)
[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
-rw-r--r--addons/stock_landed_costs/__manifest__.py1
-rw-r--r--addons/stock_landed_costs/models/stock_landed_cost.py2
-rw-r--r--addons/stock_landed_costs/security/stock_landed_cost_security.xml13
3 files changed, 16 insertions, 0 deletions
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 @@
+<?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> \ No newline at end of file