Merge lp:~wiz-keed/openobject-addons/7.0-delivery-carrier-multi-company-awareness into lp:openobject-addons/7.0

Proposed by Paul Catinean on 2014-04-04
Status: Needs review
Proposed branch: lp:~wiz-keed/openobject-addons/7.0-delivery-carrier-multi-company-awareness
Merge into: lp:openobject-addons/7.0
Diff against target: 61 lines (+17/-0)
4 files modified
delivery/__openerp__.py (+1/-0)
delivery/delivery.py (+2/-0)
delivery/delivery_view.xml (+1/-0)
delivery/security/delivery_security.xml (+13/-0)
To merge this branch: bzr merge lp:~wiz-keed/openobject-addons/7.0-delivery-carrier-multi-company-awareness
Reviewer Review Type Date Requested Status
OpenERP Core Team 2014-04-04 Pending
Review via email: mp+214178@code.launchpad.net

Description of the change

[FIX] Added multi-company awareness to delivery module

To post a comment you must log in.

Unmerged revisions

9956. By Paul Catinean on 2014-04-04

[FIX] Added multi-company awareness to delivery module

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'delivery/__openerp__.py'
2--- delivery/__openerp__.py 2012-11-29 22:26:45 +0000
3+++ delivery/__openerp__.py 2014-04-04 08:17:26 +0000
4@@ -35,6 +35,7 @@
5 'depends': ['sale', 'purchase', 'stock'],
6 'data': [
7 'security/ir.model.access.csv',
8+ 'security/delivery_security.xml',
9 'delivery_report.xml',
10 'delivery_view.xml',
11 'partner_view.xml',
12
13=== modified file 'delivery/delivery.py'
14--- delivery/delivery.py 2012-12-17 15:23:03 +0000
15+++ delivery/delivery.py 2014-04-04 08:17:26 +0000
16@@ -64,6 +64,7 @@
17 _columns = {
18 'name': fields.char('Delivery Method', size=64, required=True),
19 'partner_id': fields.many2one('res.partner', 'Transport Company', required=True, help="The partner that is doing the delivery service."),
20+ 'company_id': fields.many2one('res.company', 'Company', required=False),
21 'product_id': fields.many2one('product.product', 'Delivery Product', required=True),
22 'grids_id': fields.one2many('delivery.grid', 'carrier_id', 'Delivery Grids'),
23 'price' : fields.function(get_price, string='Price'),
24@@ -78,6 +79,7 @@
25 _defaults = {
26 'active': 1,
27 'free_if_more_than': False,
28+ 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'delivery.carrier', context=c),
29 }
30
31 def grid_get(self, cr, uid, ids, contact_id, context=None):
32
33=== modified file 'delivery/delivery_view.xml'
34--- delivery/delivery_view.xml 2012-12-21 16:48:08 +0000
35+++ delivery/delivery_view.xml 2014-04-04 08:17:26 +0000
36@@ -32,6 +32,7 @@
37 <field name="product_id"/>
38 </group>
39 <group>
40+ <field name="company_id" groups="base.group_multi_company"/>
41 <field name="active"/>
42 </group>
43 </group>
44
45=== added file 'delivery/security/delivery_security.xml'
46--- delivery/security/delivery_security.xml 1970-01-01 00:00:00 +0000
47+++ delivery/security/delivery_security.xml 2014-04-04 08:17:26 +0000
48@@ -0,0 +1,13 @@
49+<?xml version="1.0" encoding="utf-8"?>
50+<openerp>
51+<data noupdate="0">
52+
53+ <record model="ir.rule" id="delivery_carrier_rule">
54+ <field name="name">delivery_carrier multi-company</field>
55+ <field name="model_id" search="[('model','=','delivery.carrier')]" model="ir.model"/>
56+ <field name="global" eval="True"/>
57+ <field name="domain_force">['|','|',('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
58+ </record>
59+
60+</data>
61+</openerp>