summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJoren Van Onder <jov@odoo.com>2016-06-02 11:23:42 +0200
committerJoren Van Onder <jov@odoo.com>2016-06-17 13:09:18 +0200
commitd713a3ecc6de18c19de0be6821d6f68103e68f96 (patch)
tree828ab0473e6f078c6f1480b4159f6ca7041e5a13 /addons
parent64ee1761d4db4d8189b277411c9edf550545daa0 (diff)
[IMP] payment: only show fees configuration if fees are implemented
Diffstat (limited to 'addons')
-rw-r--r--addons/payment/models/payment_acquirer.py11
-rw-r--r--addons/payment/views/payment_acquirer.xml13
2 files changed, 19 insertions, 5 deletions
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py
index 1a742674339..a2ea8f69f65 100644
--- a/addons/payment/models/payment_acquirer.py
+++ b/addons/payment/models/payment_acquirer.py
@@ -56,6 +56,16 @@ class PaymentAcquirer(osv.Model):
def _get_providers(self, cr, uid, context=None):
return [('manual', 'Manual Configuration')]
+ def _compute_fees_implemented(self, cr, uid, ids, field_names, arg, context=None):
+ acquirer_model = self.pool['payment.acquirer']
+ res = {}
+
+ for acquirer in acquirer_model.browse(cr, uid, ids, context=context):
+ custom_method_name = '%s_compute_fees' % acquirer.provider
+ res[acquirer.id] = hasattr(acquirer_model, custom_method_name)
+
+ return res
+
# indirection to ease inheritance
_provider_selection = lambda self, *args, **kwargs: self._get_providers(*args, **kwargs)
@@ -87,6 +97,7 @@ class PaymentAcquirer(osv.Model):
'cancel_msg': fields.html('Cancel Message', translate=True, help='Message displayed, if order is cancel during the payment process.'),
'error_msg': fields.html('Error Message', translate=True, help='Message displayed, if error is occur during the payment process.'),
# Fees
+ 'fees_implemented': fields.function(_compute_fees_implemented, type="boolean"),
'fees_active': fields.boolean('Add Extra Fees'),
'fees_dom_fixed': fields.float('Fixed domestic fees'),
'fees_dom_var': fields.float('Variable domestic fees (in percents)'),
diff --git a/addons/payment/views/payment_acquirer.xml b/addons/payment/views/payment_acquirer.xml
index faeeb17b072..3f295ffb31a 100644
--- a/addons/payment/views/payment_acquirer.xml
+++ b/addons/payment/views/payment_acquirer.xml
@@ -24,6 +24,7 @@
<field name="arch" type="xml">
<form string="Payment Acquirer">
<field name="environment" invisible='1'/>
+ <field name="fees_implemented" invisible='1'/>
<sheet>
<field name="module_id" invisible="1"/>
<field name="module_state" invisible="1"/>
@@ -79,11 +80,6 @@
<group name="acquirer_config">
<field name="auto_confirm" widget="radio"/>
<field name="journal_id" attrs="{'required': [('auto_confirm', '=', 'generate_and_pay_invoice')]}"/>
- <field name="fees_active"/>
- <field name="fees_dom_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
- <field name="fees_dom_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
- <field name="fees_int_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
- <field name="fees_int_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
<label for="view_template_id"/>
<div>
<field name="view_template_id" nolabel="1"/>
@@ -106,6 +102,13 @@
</div>
<field name="registration_view_template_id"/>
</group>
+ <group name="fees_config" attrs="{'invisible': [('fees_implemented', '=', False)]}">
+ <field name="fees_active"/>
+ <field name="fees_dom_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
+ <field name="fees_dom_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
+ <field name="fees_int_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
+ <field name="fees_int_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
+ </group>
</page>
</notebook>
</sheet>