Merge lp:~arthru/e-commerce-addons/payment-method-multicompany-only-change into lp:~extra-addons-commiter/e-commerce-addons/7.0

Proposed by arthru
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: 287
Merged at revision: 287
Proposed branch: lp:~arthru/e-commerce-addons/payment-method-multicompany-only-change
Merge into: lp:~extra-addons-commiter/e-commerce-addons/7.0
Diff against target: 63 lines (+28/-0)
4 files modified
sale_payment_method/__openerp__.py (+1/-0)
sale_payment_method/payment_method.py (+13/-0)
sale_payment_method/payment_method_view.xml (+1/-0)
sale_payment_method/security/rules.xml (+13/-0)
To merge this branch: bzr merge lp:~arthru/e-commerce-addons/payment-method-multicompany-only-change
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no tests Approve
Guewen Baconnier @ Camptocamp code review Approve
Review via email: mp+197893@code.launchpad.net

Description of the change

This adds multicompany supports for payment methods.

Simply add a relation to a res.company from the payment.method, a field to configure it, and a security rule.

This is the same as the messy MP https://code.launchpad.net/~arthru/e-commerce-addons/payment-method-multicompany/+merge/197862 and the MP on openerp-connector/e-commerce-addons ( https://code.launchpad.net/~akretion-team/openerp-connector/e-commerce-addons-payment-method-multicompany/+merge/190119 ).

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM
Thanks

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

Thanks

review: Approve (code review, no tests)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'sale_payment_method/__openerp__.py'
--- sale_payment_method/__openerp__.py 2013-09-26 08:41:34 +0000
+++ sale_payment_method/__openerp__.py 2013-12-05 14:53:06 +0000
@@ -43,6 +43,7 @@
43 'data': ['sale_view.xml',43 'data': ['sale_view.xml',
44 'payment_method_view.xml',44 'payment_method_view.xml',
45 'security/ir.model.access.csv',45 'security/ir.model.access.csv',
46 'security/rules.xml',
46 ],47 ],
47 'demo': [],48 'demo': [],
48 'installable': True,49 'installable': True,
4950
=== modified file 'sale_payment_method/payment_method.py'
--- sale_payment_method/payment_method.py 2013-09-26 08:41:34 +0000
+++ sale_payment_method/payment_method.py 2013-12-05 14:53:06 +0000
@@ -40,4 +40,17 @@
40 'account.payment.term',40 'account.payment.term',
41 'Payment Term',41 'Payment Term',
42 help="Default payment term of a sale order using this method."),42 help="Default payment term of a sale order using this method."),
43 'company_id': fields.many2one(
44 'res.company',
45 'Company',
46 ),
47 }
48
49 def _default_company_id(self, cr, uid, context):
50 company_model = self.pool.get('res.company')
51 return company_model._company_default_get(cr, uid, 'payment.method',
52 context=context)
53
54 _defaults = {
55 'company_id': _default_company_id,
43 }56 }
4457
=== modified file 'sale_payment_method/payment_method_view.xml'
--- sale_payment_method/payment_method_view.xml 2013-09-26 08:44:33 +0000
+++ sale_payment_method/payment_method_view.xml 2013-12-05 14:53:06 +0000
@@ -18,6 +18,7 @@
18 </h1>18 </h1>
19 <group name="general">19 <group name="general">
20 <group name="config">20 <group name="config">
21 <field name="company_id" string="Company" />
21 <field name="journal_id" string="Journal for payment"/>22 <field name="journal_id" string="Journal for payment"/>
22 </group>23 </group>
23 <group name="payment_help" class="oe_grey" col="1">24 <group name="payment_help" class="oe_grey" col="1">
2425
=== added file 'sale_payment_method/security/rules.xml'
--- sale_payment_method/security/rules.xml 1970-01-01 00:00:00 +0000
+++ sale_payment_method/security/rules.xml 2013-12-05 14:53:06 +0000
@@ -0,0 +1,13 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3<data noupdate="1">
4
5 <record id="payment_method_rule" model="ir.rule">
6 <field name="name">Payment method multi-company</field>
7 <field name="model_id" ref="model_payment_method" />
8 <field name="global" eval="True" />
9 <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>
10 </record>
11
12</data>
13</openerp>

Subscribers

People subscribed via source and target branches