← Back to team overview

savoirfairelinux-openerp team mailing list archive

lp:~arthru/e-commerce-addons/payment-method-multicompany-only-change into lp:e-commerce-addons

 

arthru has proposed merging lp:~arthru/e-commerce-addons/payment-method-multicompany-only-change into lp:e-commerce-addons.

Requested reviews:
  extra-addons-commiter (extra-addons-commiter)

For more details, see:
https://code.launchpad.net/~arthru/e-commerce-addons/payment-method-multicompany-only-change/+merge/197893

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 ).
-- 
https://code.launchpad.net/~arthru/e-commerce-addons/payment-method-multicompany-only-change/+merge/197893
Your team extra-addons-commiter is requested to review the proposed merge of lp:~arthru/e-commerce-addons/payment-method-multicompany-only-change into lp:e-commerce-addons.
=== 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 @@
     'data': ['sale_view.xml',
              'payment_method_view.xml',
              'security/ir.model.access.csv',
+             'security/rules.xml',
              ],
     'demo': [],
     'installable': True,

=== 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 @@
             'account.payment.term',
             'Payment Term',
              help="Default payment term of a sale order using this method."),
+        'company_id': fields.many2one(
+            'res.company',
+            'Company',
+        ),
+    }
+
+    def _default_company_id(self, cr, uid, context):
+        company_model = self.pool.get('res.company')
+        return company_model._company_default_get(cr, uid, 'payment.method',
+                                                  context=context)
+
+    _defaults = {
+         'company_id': _default_company_id,
     }

=== 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 @@
                     </h1>
                     <group name="general">
                         <group name="config">
+                            <field name="company_id" string="Company" />
                             <field name="journal_id" string="Journal for payment"/>
                         </group>
                         <group name="payment_help" class="oe_grey" col="1">

=== 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data noupdate="1">
+
+    <record id="payment_method_rule" model="ir.rule">
+        <field name="name">Payment method multi-company</field>
+        <field name="model_id" ref="model_payment_method" />
+        <field name="global" eval="True" />
+        <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>
+    </record>
+
+</data>
+</openerp>


Follow ups