Merge lp:~openerp-dev/openobject-addons/7.0-opw-596916-rgo into lp:openobject-addons/7.0

Proposed by Ravi Gohil (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-596916-rgo
Merge into: lp:openobject-addons/7.0
Diff against target: 49 lines (+10/-0)
3 files modified
stock/security/stock_security.xml (+7/-0)
stock/stock.py (+1/-0)
stock/stock_view.xml (+2/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-596916-rgo
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza (community) code review Approve
Stéphane Bidoul (Acsone) (community) code review Approve
Michael Hucke (community) Approve
Paulius Sladkevičius @ hbee (community) Approve
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com (community) Approve
Naresh(OpenERP) Pending
Review via email: mp+185703@code.launchpad.net

Description of the change

Hi,

For 'stock.production.lot' object, the field 'company_id' isn't shown in it's views and there isn't any code that sets this field and there are not any record rules which provide support for multi-company environment.

This branch fixes these issues, kindly review the branch.

Thanks.

To post a comment you must log in.
Revision history for this message
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com (josemoralesp) wrote :

This branch resolves the problem in stock.production.lot about company field and how works it in environment multicompany

review: Approve
Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

Looks okay, I think it should be merged.

review: Approve
Revision history for this message
Michael Hucke (hucke) wrote :

Can confirm, too. please merge.

review: Approve
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) :
review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This is the needed code.

LGTM.

Regards.

review: Approve (code review)

Unmerged revisions

9417. By Ravi Gohil (OpenERP)

[FIX] stock: no multicompany rule defined for stock.prodution.lot and the company_id field isn't shown in views hence user is not able to set the field. (Maintenance: 596916)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/security/stock_security.xml'
2--- stock/security/stock_security.xml 2013-04-05 11:16:49 +0000
3+++ stock/security/stock_security.xml 2013-09-16 05:33:24 +0000
4@@ -45,6 +45,13 @@
5 <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
6 </record>
7
8+ <record model="ir.rule" id="stock_production_lot">
9+ <field name="name">stock_production_lot multi-company</field>
10+ <field name="model_id" search="[('model','=','stock.production.lot')]" model="ir.model"/>
11+ <field name="global" eval="True"/>
12+ <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
13+ </record>
14+
15 <record model="ir.rule" id="stock_warehouse_comp_rule">
16 <field name="name">Warehouse multi-company</field>
17 <field name="model_id" ref="model_stock_warehouse"/>
18
19=== modified file 'stock/stock.py'
20--- stock/stock.py 2013-09-09 15:32:21 +0000
21+++ stock/stock.py 2013-09-16 05:33:24 +0000
22@@ -1472,6 +1472,7 @@
23 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
24 'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'stock.lot.serial'),
25 'product_id': lambda x, y, z, c: c.get('product_id', False),
26+ 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.production.lot', context=c),
27 }
28 _sql_constraints = [
29 ('name_ref_uniq', 'unique (name, ref)', 'The combination of Serial Number and internal reference must be unique !'),
30
31=== modified file 'stock/stock_view.xml'
32--- stock/stock_view.xml 2013-08-21 08:53:04 +0000
33+++ stock/stock_view.xml 2013-09-16 05:33:24 +0000
34@@ -314,6 +314,7 @@
35 <field name="indice"/>
36 <field name="date"/>
37 <field name="author_id"/>
38+ <field name="company_id" groups="base.group_multi_company" widget="selection"/>
39 </group>
40 <separator string="Description"/>
41 <field name="description"/>
42@@ -356,6 +357,7 @@
43 <group>
44 <field name="date"/>
45 <field name="stock_available"/>
46+ <field name="company_id" groups="base.group_multi_company" widget="selection"/>
47 </group>
48 </group>
49 <notebook>