← Back to team overview

savoirfairelinux-openerp team mailing list archive

lp:~savoirfairelinux-openerp/openerp-mgmtsystem/7.0-multi-company into lp:openerp-mgmtsystem

 

Maxime Chambreuil (http://www.savoirfairelinux.com) has proposed merging lp:~savoirfairelinux-openerp/openerp-mgmtsystem/7.0-multi-company into lp:openerp-mgmtsystem.

Requested reviews:
  OpenERP Management System Core Editors (openerp-mgmtsystem-core-editors)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-mgmtsystem/7.0-multi-company/+merge/182667

[ADD] Multi-company
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-mgmtsystem/7.0-multi-company/+merge/182667
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/openerp-mgmtsystem/7.0-multi-company.
=== modified file 'mgmtsystem/mgmtsystem.xml'
--- mgmtsystem/mgmtsystem.xml	2013-08-06 16:22:21 +0000
+++ mgmtsystem/mgmtsystem.xml	2013-08-28 15:04:12 +0000
@@ -35,6 +35,7 @@
                 <tree string="Systems">
                     <field name="name"/>
 		    <field name="manual"/>
+		    <field name="company_id" groups="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -46,6 +47,7 @@
                 <form string="Systems">
                     <field name="name"/>
 		    <field name="manual"/>
+		    <field name="company_id" groups="base.group_multi_company"/>
                 </form>
             </field>
         </record>

=== modified file 'mgmtsystem/security/mgmtsystem_security.xml'
--- mgmtsystem/security/mgmtsystem_security.xml	2013-04-13 16:51:13 +0000
+++ mgmtsystem/security/mgmtsystem_security.xml	2013-08-28 15:04:12 +0000
@@ -43,5 +43,14 @@
         <field name="users" eval="[(6,0,[ref('base.user_root')])]"/>
     </record>
 
+    <!-- Rule -->
+
+    <record model="ir.rule" id="mgmtsystem_rule">
+        <field name="name">mgmtsystem multi-company</field>
+        <field name="model_id" ref="model_mgmtsystem_system"/>
+        <field name="global" eval="True"/>
+        <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+    </record>
+
 </data>
 </openerp>

=== modified file 'mgmtsystem_action/__openerp__.py'
--- mgmtsystem_action/__openerp__.py	2013-04-01 19:46:23 +0000
+++ mgmtsystem_action/__openerp__.py	2013-08-28 15:04:12 +0000
@@ -34,9 +34,10 @@
 """,
     "depends": ['mgmtsystem', 'crm_claim'],
     "data": [
+        'security/ir.model.access.csv',
+        'security/mgmtsystem_action_security.xml',
         'action_sequence.xml',
         'workflow_mgmtsystem_action.xml',
-        'security/ir.model.access.csv',
         'mgmtsystem_action.xml',
         'board_mgmtsystem_action.xml',
     ],

=== modified file 'mgmtsystem_action/mgmtsystem_action.py'
--- mgmtsystem_action/mgmtsystem_action.py	2012-12-17 17:18:12 +0000
+++ mgmtsystem_action/mgmtsystem_action.py	2013-08-28 15:04:12 +0000
@@ -38,9 +38,11 @@
                                        'Messages',
                                        domain=[('model','=',_name)]),
         'system_id': fields.many2one('mgmtsystem.system', 'System'),
-    }
+        'company_id': fields.many2one('res.company', 'Company')
+        }
 
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'reference': 'NEW',
     }
 

=== modified file 'mgmtsystem_action/mgmtsystem_action.xml'
--- mgmtsystem_action/mgmtsystem_action.xml	2013-03-04 11:31:40 +0000
+++ mgmtsystem_action/mgmtsystem_action.xml	2013-08-28 15:04:12 +0000
@@ -13,6 +13,7 @@
                     <field name="user_id"/>
                     <field name="date_deadline"/>
                     <field name="state"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -31,6 +32,7 @@
                         <field name="date" select='1'/>
                         <field name="user_id"/>
                         <field name="system_id"/>
+                    	<field name="company_id" groups="base.group_multi_company"/>
                     </group>
                     <newline/>
                     <group expand="0" string="Group By...">
@@ -63,6 +65,7 @@
                         <field name="date" string="Date"/>
                         <field name="date_deadline" string="Deadline"/>
                         <field name="system_id"/>
+                    	<field name="company_id" groups="base.group_multi_company"/>
                     </group>
                     <notebook colspan="4">
                             <page string="Description">
@@ -110,4 +113,3 @@
 
     </data>
 </openerp>
-

=== added file 'mgmtsystem_action/security/mgmtsystem_action_security.xml'
--- mgmtsystem_action/security/mgmtsystem_action_security.xml	1970-01-01 00:00:00 +0000
+++ mgmtsystem_action/security/mgmtsystem_action_security.xml	2013-08-28 15:04:12 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Rule -->
+
+        <record model="ir.rule" id="mgmtsystem_action_rule">
+            <field name="name">mgmtsystem_action multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_action"/>
+            <field name="global" eval="True"/>
+            <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+        </record>
+
+    </data>
+</openerp>

=== modified file 'mgmtsystem_audit/__openerp__.py'
--- mgmtsystem_audit/__openerp__.py	2013-08-06 16:22:21 +0000
+++ mgmtsystem_audit/__openerp__.py	2013-08-28 15:04:12 +0000
@@ -30,8 +30,9 @@
     """,
     "depends": ['mgmtsystem_nonconformity'],
     "data" : [
+        'security/ir.model.access.csv',
+        'security/mgmtsystem_audit_security.xml',
         'audit_sequence.xml',
-        'security/ir.model.access.csv',
         'mgmtsystem_audit.xml',
         'report/audit_report.xml',
         'report/verification_list.xml',

=== modified file 'mgmtsystem_audit/mgmtsystem_audit.py'
--- mgmtsystem_audit/mgmtsystem_audit.py	2013-04-01 19:14:17 +0000
+++ mgmtsystem_audit/mgmtsystem_audit.py	2013-08-28 15:04:12 +0000
@@ -38,9 +38,11 @@
         'nonconformity_ids': fields.many2many('mgmtsystem.nonconformity', string='Nonconformities'),
         'state': fields.selection([('open','Open'),('done','Closed')], 'State'),
         'system_id': fields.many2one('mgmtsystem.system', 'System'),
-    }
+        'company_id': fields.many2one('res.company', 'Company')
+        }
 
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'reference': 'NEW',
         'state': 'open'
     }
@@ -65,9 +67,12 @@
         'is_conformed': fields.boolean('Is conformed'),
         'comments': fields.text('Comments'),
         'seq': fields.integer('Sequence'),
-    }
+        'company_id': fields.many2one('res.company', 'Company')
+        }
+
     _order = "seq"
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'is_conformed': False
     }
 

=== modified file 'mgmtsystem_audit/mgmtsystem_audit.xml'
--- mgmtsystem_audit/mgmtsystem_audit.xml	2013-04-01 19:15:35 +0000
+++ mgmtsystem_audit/mgmtsystem_audit.xml	2013-08-28 15:04:12 +0000
@@ -14,6 +14,7 @@
                     <field name="is_conformed"/>
                     <field name="procedure_id"/>
                     <field name="comments"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -30,6 +31,7 @@
                         <field name="procedure_id" domain="[('parent_id','in',['Procedure', 'Environmental Aspect', 'Quality Manual', 'Environment Manual'])]"/>
                         <field name="is_conformed"/>
                         <field name="comments"/>
+                    	<field name="company_id" groups="base.group_multi_company"/>
                     </group>
                 </search>
             </field>
@@ -49,6 +51,7 @@
                         <field name="seq"/>
                         <newline/>
                         <field name="comments"/>
+                    	<field name="company_id" groups="base.group_multi_company"/>
                     </group>
                 </form>
             </field>
@@ -73,6 +76,7 @@
                     <field name="date" attrs="{'readonly':[('state','=','done')]}"/>
                     <field name="reference"/>
                     <field name="system_id"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
                     <!-- Invisible fields below are to allow their use in domains of this view -->
                     <field name="state" invisible="1"/>
                 </tree>
@@ -93,6 +97,7 @@
                         <field name="date"/>
                         <field name="reference"/>
 			<field name="system_id"/>
+                    	<field name="company_id" groups="base.group_multi_company"/>
                     </group>
                 </search>
             </field>
@@ -112,6 +117,7 @@
                         <field name="reference"/>
                         <field name="date" attrs="{'readonly':[('state','=','done')]}"/>
                         <field name="system_id"/>
+                    	<field name="company_id" groups="base.group_multi_company"/>
                     </group>
                     <notebook colspan="4">
                         <page string="Auditors">
@@ -184,9 +190,7 @@
                  </notebook>
 
             </field>
-        </record>     
-        
-          
+        </record>
+
     </data>
 </openerp>
-

=== added file 'mgmtsystem_audit/security/mgmtsystem_audit_security.xml'
--- mgmtsystem_audit/security/mgmtsystem_audit_security.xml	1970-01-01 00:00:00 +0000
+++ mgmtsystem_audit/security/mgmtsystem_audit_security.xml	2013-08-28 15:04:12 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Rule -->
+
+        <record model="ir.rule" id="mgmtsystem_audit_rule">
+            <field name="name">mgmtsystem_audit multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_audit"/>
+            <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="mgmtsystem_verification_line_rule">
+            <field name="name">mgmtsystem_verification_line multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_verification_line"/>
+            <field name="global" eval="True"/>
+            <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+        </record>
+
+    </data>
+</openerp>

=== modified file 'mgmtsystem_claim/__openerp__.py'
--- mgmtsystem_claim/__openerp__.py	2013-04-19 15:55:18 +0000
+++ mgmtsystem_claim/__openerp__.py	2013-08-28 15:04:12 +0000
@@ -28,11 +28,12 @@
     "description": """This module enables you to manage the claims of your management system.""",
     "depends": ['mgmtsystem', 'crm_claim', 'mail'],
     "data": [
+        'security/ir.model.access.csv',
+        'security/mgmtsystem_claim_security.xml',
         'mgmtsystem_claim.xml',
         'claim_sequence.xml',
         'workflow_mgmtsystem_claim.xml',
         'board_mgmtsystem_claim.xml',
-        'security/ir.model.access.csv',
     ],
 }
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'mgmtsystem_claim/mgmtsystem_claim.py'
--- mgmtsystem_claim/mgmtsystem_claim.py	2012-12-17 17:18:12 +0000
+++ mgmtsystem_claim/mgmtsystem_claim.py	2013-08-28 15:04:12 +0000
@@ -29,9 +29,11 @@
     _columns = {
         'reference': fields.char('Reference', size=64, required=True, readonly=True),
         'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
-    }
+        'company_id': fields.many2one('res.company', 'Company')
+        }
 
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'reference': 'NEW',
     }
 

=== modified file 'mgmtsystem_claim/mgmtsystem_claim.xml'
--- mgmtsystem_claim/mgmtsystem_claim.xml	2013-03-04 11:31:40 +0000
+++ mgmtsystem_claim/mgmtsystem_claim.xml	2013-08-28 15:04:12 +0000
@@ -19,6 +19,7 @@
 				<field name="stage_id" invisible="1"/>
 				<field name="date_deadline" invisible="1"/>
 				<field name="date_closed" invisible="1"/>
+				<field name="company_id" group="base.group_multi_company"/>
 				<field name="state"/>
 				<button name="case_open" string="Open"
 					states="draft,pending" type="object"
@@ -47,6 +48,7 @@
                         <field name="name"/>
                         <field name="date"/>
                         <field name="reference"/>
+			<field name="company_id" group="base.group_multi_company"/>
                     </group>
                     <group colspan="4" col="4"  groups="base.group_user">
                         <field name="user_id"/>
@@ -208,4 +210,3 @@
 
     </data>
 </openerp>
-

=== added file 'mgmtsystem_claim/security/mgmtsystem_claim_security.xml'
--- mgmtsystem_claim/security/mgmtsystem_claim_security.xml	1970-01-01 00:00:00 +0000
+++ mgmtsystem_claim/security/mgmtsystem_claim_security.xml	2013-08-28 15:04:12 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Rule -->
+
+        <record model="ir.rule" id="mgmtsystem_claim_rule">
+            <field name="name">mgmtsystem_claim multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_claim"/>
+            <field name="global" eval="True"/>
+            <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+        </record>
+
+    </data>
+</openerp>

=== modified file 'mgmtsystem_hazard/__openerp__.py'
--- mgmtsystem_hazard/__openerp__.py	2013-05-31 21:20:27 +0000
+++ mgmtsystem_hazard/__openerp__.py	2013-08-28 15:04:12 +0000
@@ -31,6 +31,7 @@
     "depends": ['mgmtsystem', 'hr'],
     "data": [
         'security/ir.model.access.csv',
+        'security/mgmtsystem_hazard_security.xml',
         'mgmtsystem_hazard.xml',
         'mgmtsystem_hazard_data.xml',
     ],

=== modified file 'mgmtsystem_hazard/mgmtsystem_hazard.py'
--- mgmtsystem_hazard/mgmtsystem_hazard.py	2013-07-25 21:43:20 +0000
+++ mgmtsystem_hazard/mgmtsystem_hazard.py	2013-08-28 15:04:12 +0000
@@ -211,6 +211,11 @@
 	'control_measure_ids': fields.one2many('mgmtsystem.hazard.control_measure','hazard_id','Control Measures'),
 	'test_ids': fields.one2many('mgmtsystem.hazard.test','hazard_id','Implementation Tests'),
 	'residual_risk_ids': fields.one2many('mgmtsystem.hazard.residual_risk','hazard_id','Residual Risk Evaluations'),
+        'company_id': fields.many2one('res.company', 'Company')
+        }
+
+    _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
     }
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'mgmtsystem_hazard/mgmtsystem_hazard.xml'
--- mgmtsystem_hazard/mgmtsystem_hazard.xml	2013-05-31 21:26:53 +0000
+++ mgmtsystem_hazard/mgmtsystem_hazard.xml	2013-08-28 15:04:12 +0000
@@ -20,6 +20,7 @@
                     <field name="origin_id"/>
                     <field name="risk"/>
                     <field name="acceptability"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -38,6 +39,7 @@
                         <field name="origin_id"/>
                         <field name="risk"/>
                         <field name="acceptability"/>
+	            	<field name="company_id" group="base.group_multi_company"/>
                     </group>
                     <newline/>
                     <group expand="0" string="Group By...">
@@ -58,6 +60,7 @@
                     <group colspan="4" col="4">
                         <field name="name"/>
                         <field name="type_id"/>
+	            	<field name="company_id" group="base.group_multi_company"/>
                         <newline/>
                         <field name="hazard_id"/>
                         <field name="risk_type_id"/>

=== added file 'mgmtsystem_hazard/security/mgmtsystem_hazard_security.xml'
--- mgmtsystem_hazard/security/mgmtsystem_hazard_security.xml	1970-01-01 00:00:00 +0000
+++ mgmtsystem_hazard/security/mgmtsystem_hazard_security.xml	2013-08-28 15:04:12 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Rule -->
+
+        <record model="ir.rule" id="mgmtsystem_hazard_rule">
+            <field name="name">mgmtsystem_hazard multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_hazard"/>
+            <field name="global" eval="True"/>
+            <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+        </record>
+
+    </data>
+</openerp>

=== modified file 'mgmtsystem_kpi/__openerp__.py'
--- mgmtsystem_kpi/__openerp__.py	2013-04-03 19:16:35 +0000
+++ mgmtsystem_kpi/__openerp__.py	2013-08-28 15:04:12 +0000
@@ -53,8 +53,9 @@
         'web_color',
     ],
     "data" : [
+        'security/ir.model.access.csv',
+        'security/mgmtsystem_kpi_security.xml',
         'mgmtsystem_kpi_view.xml',
-        'security/ir.model.access.csv',
     ],
     "images" : [
         "images/kpi_definition.png",

=== modified file 'mgmtsystem_kpi/mgmtsystem_kpi.py'
--- mgmtsystem_kpi/mgmtsystem_kpi.py	2012-12-17 17:18:12 +0000
+++ mgmtsystem_kpi/mgmtsystem_kpi.py	2013-08-28 15:04:12 +0000
@@ -149,9 +149,11 @@
         'max_dbsource_id': fields.many2one('base.external.dbsource','External DB Source'),
         'color': fields.char('Color', help='RGB code with #', size=7, required=True),
         'threshold_ids': fields.many2many('mgmtsystem.kpi.threshold','mgmtsystem_kpi_threshold_range_rel', 'range_id', 'threshold_id', 'Thresholds'),
-    }
+        'company_id': fields.many2one('res.company', 'Company')
+        }
 
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'valid': True,
     }
 
@@ -196,9 +198,11 @@
         'valid': fields.function(_is_valid_threshold, string='Valid', type='boolean', required=True),
         'invalid_message': fields.function(_generate_invalid_message, string='Message', type='char', size=100),
         'kpi_ids': fields.one2many('mgmtsystem.kpi', 'threshold_id', 'KPIs'),
+        'company_id': fields.many2one('res.company', 'Company')
     }
 
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'valid': True,
     }
 
@@ -247,9 +251,11 @@
         'date': fields.datetime('Execution Date', required=True, readonly=True),
         'value': fields.float('Value', required=True, readonly=True),
         'color': fields.text('Color', required=True, readonly=True),
+        'company_id': fields.many2one('res.company', 'Company')
     }
 
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'name': lambda *a: time.strftime('%d %B %Y'),
         'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
         'color': '#FFFFFF',
@@ -365,9 +371,11 @@
         'kpi_code': fields.text('KPI Code', help='SQL code must return the result as \'value\' (i.e. \'SELECT 5 AS value\').'),
         'history_ids': fields.one2many('mgmtsystem.kpi.history', 'kpi_id', 'History'),
         'active': fields.boolean('Active', help="Only active KPIs will be updated by the scheduler based on the periodicity configuration."),
+        'company_id': fields.many2one('res.company', 'Company')
     }
 
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'active': True,
         'periodicity': 1,
         'periodicity_uom': 'day',

=== modified file 'mgmtsystem_kpi/mgmtsystem_kpi_view.xml'
--- mgmtsystem_kpi/mgmtsystem_kpi_view.xml	2013-04-03 19:16:35 +0000
+++ mgmtsystem_kpi/mgmtsystem_kpi_view.xml	2013-08-28 15:04:12 +0000
@@ -13,6 +13,7 @@
                     <field name="value" widget="progressbar"/>
                     <field name="category_id"/>
                     <field name="kpi_type"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -27,6 +28,7 @@
                         <separator orientation="vertical"/>
                         <field name="name"/>
                         <field name="category_id"/>
+	            	<field name="company_id" group="base.group_multi_company"/>
                     </group>
                     <newline />
                     <group expand="0" string="Group By...">
@@ -50,6 +52,7 @@
                         <field name="value" colspan="2"/>
                         <button name="compute_kpi_value" string="Compute KPI Now" colspan="2" type="object"/>
                         <field name="active" colspan="2"/>
+	            	<field name="company_id" group="base.group_multi_company"/>
                     </group>
                     <notebook colspan="6">
                         <page string="History">
@@ -103,6 +106,7 @@
                     <field name="date"/>
                     <field name="value"/>
                     <field name="color" widget="color"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -163,6 +167,7 @@
                 <tree string="Thresholds">
                     <field name="name"/>
                     <field name="invalid_message"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -183,6 +188,8 @@
                     <field name="kpi_ids" nolabel="1" colspan="2"/>
                     <newline/>
                     <field name="invalid_message" nolabel="1" attrs="{'invisible' : [('invalid_message', '=', '')]}" colspan="2"/>
+                    <newline/>
+	            <field name="company_id" group="base.group_multi_company"/>
                 </form>
             </field>
         </record>
@@ -214,6 +221,7 @@
                     <field name="max_value"/>
                     <field name="color" widget="color"/>
                     <field name="invalid_message"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -225,6 +233,7 @@
                 <form string="Range">
                     <field name="name"/>
                     <field name="color"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                     <newline/>
                     <separator string="Minimum" colspan="4"/>
                     <newline/>

=== added file 'mgmtsystem_kpi/security/mgmtsystem_kpi_security.xml'
--- mgmtsystem_kpi/security/mgmtsystem_kpi_security.xml	1970-01-01 00:00:00 +0000
+++ mgmtsystem_kpi/security/mgmtsystem_kpi_security.xml	2013-08-28 15:04:12 +0000
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Rule -->
+
+        <record model="ir.rule" id="mgmtsystem_kpi_rule">
+            <field name="name">mgmtsystem_kpi multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_kpi"/>
+            <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="mgmtsystem_kpi_threshold_range_rule">
+            <field name="name">mgmtsystem_kpi_threshold_range multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_kpi_threshold_range"/>
+            <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="mgmtsystem_kpi_threshold_rule">
+            <field name="name">mgmtsystem_kpi_threshold multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_kpi_threshold"/>
+            <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="mgmtsystem_kpi_history_rule">
+            <field name="name">mgmtsystem_kpi_history multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_kpi_history"/>
+            <field name="global" eval="True"/>
+            <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+        </record>
+
+    </data>
+</openerp>

=== modified file 'mgmtsystem_nonconformity/__openerp__.py'
--- mgmtsystem_nonconformity/__openerp__.py	2013-07-05 11:59:06 +0000
+++ mgmtsystem_nonconformity/__openerp__.py	2013-08-28 15:04:12 +0000
@@ -37,6 +37,7 @@
     ],
     "data" : [
         'security/ir.model.access.csv',
+        'security/mgmtsystem_nonconformity_security.xml',
         'mgmtsystem_nonconformity.xml',
         'mgmtsystem_nonconformity_workflow.xml',
         'nonconformity_sequence.xml',

=== modified file 'mgmtsystem_nonconformity/mgmtsystem_nonconformity.py'
--- mgmtsystem_nonconformity/mgmtsystem_nonconformity.py	2013-04-16 23:03:12 +0000
+++ mgmtsystem_nonconformity/mgmtsystem_nonconformity.py	2013-08-28 15:04:12 +0000
@@ -181,8 +181,12 @@
         'evaluation_user_id': fields.many2one('res.users','Evaluation by', readonly=True),
         'evaluation_comments': fields.text('Evaluation Comments',
             help="Conclusions from the last effectiveness evaluation."),
+        # Multi-company
+        'company_id': fields.many2one('res.company', 'Company'),
     }
+
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'date': lambda *a: time.strftime(DATE_FORMAT),
         'state': 'draft',
         'author_user_id': lambda cr, uid, id, c={}: id,

=== modified file 'mgmtsystem_nonconformity/mgmtsystem_nonconformity.xml'
--- mgmtsystem_nonconformity/mgmtsystem_nonconformity.xml	2013-07-05 12:18:45 +0000
+++ mgmtsystem_nonconformity/mgmtsystem_nonconformity.xml	2013-08-28 15:04:12 +0000
@@ -20,6 +20,7 @@
                     <field name="responsible_user_id"/>
                     <field name="manager_user_id"/>
                     <field name="system_id"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                     <field name="state"/>
                 </tree>
             </field>
@@ -42,6 +43,7 @@
                         <field name="author_user_id" string="User" 
                                filter_domain="['|','|',('author_user_id','=',uid),('responsible_user_id','=',uid),('manager_user_id','=',uid)]" />
                         <field name="system_id"/>
+	            	<field name="company_id" group="base.group_multi_company"/>
                     </group>
                     <newline />
                     <group expand="0" string="Group By...">
@@ -81,18 +83,19 @@
                 <sheet string="Non-Conformity">
                     <group>
                         <group>
-                        <field name="ref" attrs="{'readonly':[('state','not in',['draft'])]}"/>
-                        <field name="date" attrs="{'readonly':[('state','not in',['draft'])]}"/>
-                        <field name="partner_id" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
-                        <field name="reference" attrs="{'readonly':[('state','not in',['draft'])]}"/>
-                            <field name="origin_ids" widget="many2many_tags" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
-                    </group>
+                        	<field name="ref" attrs="{'readonly':[('state','not in',['draft'])]}"/>
+                        	<field name="date" attrs="{'readonly':[('state','not in',['draft'])]}"/>
+                        	<field name="partner_id" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
+                        	<field name="reference" attrs="{'readonly':[('state','not in',['draft'])]}"/>
+                        	<field name="origin_ids" widget="many2many_tags" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
+                    	</group>
                         <group>
-                        <field name="responsible_user_id" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
-                        <field name="manager_user_id" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
-                        <field name="author_user_id" attrs="{'readonly':[('state','not in',['draft'])]}"/>
-                        <field name="system_id" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
-                    </group>
+                        	<field name="responsible_user_id" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
+                        	<field name="manager_user_id" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
+                        	<field name="author_user_id" attrs="{'readonly':[('state','not in',['draft'])]}"/>
+                        	<field name="system_id" attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
+	            		<field name="company_id" group="base.group_multi_company"/>
+                    	</group>
                     </group>
                     
                     <notebook>

=== added file 'mgmtsystem_nonconformity/security/mgmtsystem_nonconformity_security.xml'
--- mgmtsystem_nonconformity/security/mgmtsystem_nonconformity_security.xml	1970-01-01 00:00:00 +0000
+++ mgmtsystem_nonconformity/security/mgmtsystem_nonconformity_security.xml	2013-08-28 15:04:12 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Rule -->
+
+        <record model="ir.rule" id="mgmtsystem_nonconformity_rule">
+            <field name="name">mgmtsystem_nonconformity multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_nonconformity"/>
+            <field name="global" eval="True"/>
+            <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+        </record>
+
+    </data>
+</openerp>

=== modified file 'mgmtsystem_review/__openerp__.py'
--- mgmtsystem_review/__openerp__.py	2013-08-06 16:22:21 +0000
+++ mgmtsystem_review/__openerp__.py	2013-08-28 15:04:12 +0000
@@ -33,8 +33,9 @@
         'mgmtsystem_survey',
     ],
     "data" : [
+        'security/ir.model.access.csv',
+        'security/mgmtsystem_review_security.xml',
         'review_sequence.xml',
-        'security/ir.model.access.csv',
         'mgmtsystem_review.xml',
         'report/review_report.xml',
     ],

=== modified file 'mgmtsystem_review/mgmtsystem_review.py'
--- mgmtsystem_review/mgmtsystem_review.py	2012-12-17 17:18:12 +0000
+++ mgmtsystem_review/mgmtsystem_review.py	2013-08-28 15:04:12 +0000
@@ -35,10 +35,12 @@
         'changes': fields.text('Changes'),
         'line_ids': fields.one2many('mgmtsystem.review.line','review_id','Lines'),
         'conclusion': fields.text('Conclusion'),
-        'state': fields.selection([('open','Open'),('done','Closed')], 'State')
+        'state': fields.selection([('open','Open'),('done','Closed')], 'State'),
+        'company_id': fields.many2one('res.company', 'Company'),
     }
 
     _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
         'reference': 'NEW', 
         'state': 'open'
     }
@@ -64,6 +66,11 @@
         'nonconformity_id': fields.many2one('mgmtsystem.nonconformity', 'Nonconformity', select=True),
         'decision': fields.text('Decision'),
         'review_id': fields.many2one('mgmtsystem.review', 'Review', ondelete='cascade', select=True),
+        'company_id': fields.many2one('res.company', 'Company'),
+    }
+
+    _defaults = {
+        'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
     }
 
 mgmtsystem_review_line()

=== modified file 'mgmtsystem_review/mgmtsystem_review.xml'
--- mgmtsystem_review/mgmtsystem_review.xml	2013-05-10 17:13:07 +0000
+++ mgmtsystem_review/mgmtsystem_review.xml	2013-08-28 15:04:12 +0000
@@ -14,6 +14,7 @@
                     <field name="action_id" attrs="{'invisible' : [('type', '!=', 'action')]}"/>
                     <field name="nonconformity_id" attrs="{'invisible' : [('type', '!=', 'nonconformity')]}"/>
                     <field name="decision"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
@@ -29,6 +30,7 @@
                     <field name="action_id"/>
                     <field name="nonconformity_id"/>
                     <field name="decision"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                 </search>
             </field>
         </record>        
@@ -47,6 +49,7 @@
                         <field name="nonconformity_id" attrs="{'invisible' : [('type', '!=', 'nonconformity')]}"/>
                         <newline/>
                         <field name="decision"/>
+	            	<field name="company_id" group="base.group_multi_company"/>
                     </group>
                 </form>
             </field>
@@ -70,6 +73,7 @@
                     <field name="name" attrs="{'readonly':[('state','=','done')]}"/>
                     <field name="date" attrs="{'readonly':[('state','=','done')]}"/>
                     <field name="reference"/>
+	            <field name="company_id" group="base.group_multi_company"/>
                     <!-- Invisible fields below are to allow their use in domains of this view -->
                     <field name="state" invisible="1"/>
                 </tree>
@@ -89,6 +93,7 @@
                         <field name="name"/>
                         <field name="date"/>
                         <field name="reference"/>
+	            	<field name="company_id" group="base.group_multi_company"/>
                     </group>
                 </search>
             </field>
@@ -107,6 +112,7 @@
                         <field name="name" attrs="{'readonly':[('state','=','done')]}"/>
                         <field name="reference"/>
                         <field name="date" attrs="{'readonly':[('state','=','done')]}"/>
+	            	<field name="company_id" group="base.group_multi_company"/>
                     </group>
                     <notebook colspan="4">
                         <page string="Participants">

=== added file 'mgmtsystem_review/security/mgmtsystem_review_security.xml'
--- mgmtsystem_review/security/mgmtsystem_review_security.xml	1970-01-01 00:00:00 +0000
+++ mgmtsystem_review/security/mgmtsystem_review_security.xml	2013-08-28 15:04:12 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Rule -->
+
+        <record model="ir.rule" id="mgmtsystem_review_rule">
+            <field name="name">mgmtsystem_review multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_review"/>
+            <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="mgmtsystem_review_line_rule">
+            <field name="name">mgmtsystem_review_line multi-company</field>
+            <field name="model_id" ref="model_mgmtsystem_review_line"/>
+            <field name="global" eval="True"/>
+            <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+        </record>
+
+    </data>
+</openerp>


Follow ups