← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~lmi/ocb-addons/7.0-opw-596916-rgo into lp:ocb-addons

 

Laurent Mignon (Acsone) has proposed merging lp:~lmi/ocb-addons/7.0-opw-596916-rgo into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports (ocb)
Related bugs:
  Bug #1214866 in OpenERP Community Backports (Addons): "[7.0][addons] no multicompany support for lots"
  https://bugs.launchpad.net/ocb-addons/+bug/1214866

For more details, see:
https://code.launchpad.net/~lmi/ocb-addons/7.0-opw-596916-rgo/+merge/218476

Automatically derived from https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-opw-596916-rgo for https://code.launchpad.net/~openerp/openobject-addons/7.0. Below is a copy of the original description.

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.
-- 
https://code.launchpad.net/~lmi/ocb-addons/7.0-opw-596916-rgo/+merge/218476
Your team OpenERP Community Backports is requested to review the proposed merge of lp:~lmi/ocb-addons/7.0-opw-596916-rgo into lp:ocb-addons.
=== modified file 'stock/security/stock_security.xml'
--- stock/security/stock_security.xml	2014-04-04 18:52:40 +0000
+++ stock/security/stock_security.xml	2014-05-06 17:27:45 +0000
@@ -45,6 +45,13 @@
         <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
     </record>
 
+    <record model="ir.rule" id="stock_production_lot">
+        <field name="name">stock_production_lot multi-company</field>
+        <field name="model_id" search="[('model','=','stock.production.lot')]" 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>
+
     <record model="ir.rule" id="stock_warehouse_comp_rule">
         <field name="name">Warehouse multi-company</field>
         <field name="model_id" ref="model_stock_warehouse"/>

=== modified file 'stock/stock.py'
--- stock/stock.py	2014-04-30 10:28:47 +0000
+++ stock/stock.py	2014-05-06 17:27:45 +0000
@@ -1510,6 +1510,7 @@
         'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
         'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'stock.lot.serial'),
         'product_id': lambda x, y, z, c: c.get('product_id', False),
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.production.lot', context=c),
     }
     _sql_constraints = [
         ('name_ref_uniq', 'unique (name, ref)', 'The combination of Serial Number and internal reference must be unique !'),

=== modified file 'stock/stock_view.xml'
--- stock/stock_view.xml	2014-04-29 08:31:08 +0000
+++ stock/stock_view.xml	2014-05-06 17:27:45 +0000
@@ -314,6 +314,7 @@
                         <field name="indice"/>
                         <field name="date"/>
                         <field name="author_id"/>
+                        <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                     </group>
                     <separator string="Description"/>
                     <field name="description"/>
@@ -360,6 +361,7 @@
                         <group>
                             <field name="date"/>
                             <field name="stock_available"/>
+                            <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                         </group>
                     </group>
                     <notebook>


Follow ups