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

Subscribers

People subscribed via source and target branches