diff --git a/addons/payment_acquirer/models/payment_acquirer.py b/addons/payment_acquirer/models/payment_acquirer.py
index 4fc92c7d891..101510501db 100644
--- a/addons/payment_acquirer/models/payment_acquirer.py
+++ b/addons/payment_acquirer/models/payment_acquirer.py
@@ -56,6 +56,12 @@ class PaymentAcquirer(osv.Model):
string='Environment'),
'portal_published': fields.boolean('Visible in Portal',
help="Make this payment acquirer available (Customer invoices, etc.)"),
+ # Fees
+ 'fees_active': fields.boolean('Compute fees'),
+ 'fees_dom_fixed': fields.float('Fixed domestic fees'),
+ 'fees_dom_var': fields.float('Variable domestic fees (in percents)'),
+ 'fees_int_fixed': fields.float('Fixed international fees'),
+ 'fees_int_var': fields.float('Variable international fees (in percents)'),
}
_defaults = {
diff --git a/addons/payment_acquirer/views/payment_acquirer.xml b/addons/payment_acquirer/views/payment_acquirer.xml
index 09c209f7dee..7377f4aedb3 100644
--- a/addons/payment_acquirer/views/payment_acquirer.xml
+++ b/addons/payment_acquirer/views/payment_acquirer.xml
@@ -17,11 +17,20 @@
-
-
+
+
+
+
+
+
+
diff --git a/addons/payment_acquirer_paypal/models/paypal.py b/addons/payment_acquirer_paypal/models/paypal.py
index 065dde95588..b2e15f4d894 100644
--- a/addons/payment_acquirer_paypal/models/paypal.py
+++ b/addons/payment_acquirer_paypal/models/paypal.py
@@ -27,12 +27,6 @@ class AcquirerPaypal(osv.Model):
'paypal_username': fields.char('Username', required_if_provider='paypal'),
'paypal_tx_url': fields.char('Transaction URL', required_if_provider='paypal'),
'paypal_use_ipn': fields.boolean('Use IPN'),
- # Fees
- 'paypal_fee_active': fields.boolean('Compute fees'),
- 'paypal_fee_dom_fixed': fields.float('Fixed domestic fees'),
- 'paypal_fee_dom_var': fields.float('Variable domestic fees (in percents)'),
- 'paypal_fee_int_fixed': fields.float('Fixed international fees'),
- 'paypal_fee_int_var': fields.float('Variable international fees (in percents)'),
# Server 2 server
'paypal_api_enabled': fields.boolean('Use Rest API'),
'paypal_api_username': fields.char('Rest API Username'),
@@ -44,11 +38,11 @@ class AcquirerPaypal(osv.Model):
_defaults = {
'paypal_tx_url': 'https://www.sandbox.paypal.com/cgi-bin/webscr',
'paypal_use_ipn': True,
- 'paypal_fee_active': False,
- 'paypal_fee_dom_fixed': 0.35,
- 'paypal_fee_dom_var': 3.4,
- 'paypal_fee_int_fixed': 0.35,
- 'paypal_fee_int_var': 3.9,
+ 'fees_active': False,
+ 'fees_dom_fixed': 0.35,
+ 'fees_dom_var': 3.4,
+ 'fees_int_fixed': 0.35,
+ 'fees_int_var': 3.9,
'paypal_api_enabled': False,
}
@@ -64,9 +58,9 @@ class AcquirerPaypal(osv.Model):
acquirer = self.browse(cr, uid, id, context=context)
country = self.pool['res.country'].browse(cr, uid, country_id, context=context)
if country and acquirer.company_id.country_id.id == country.id:
- fees = amount * (1 + acquirer.paypal_fee_dom_var / 100.0) + acquirer.paypal_fee_dom_fixed - amount
+ fees = amount * (1 + acquirer.fees_dom_var / 100.0) + acquirer.fees_dom_fixed - amount
else:
- fees = amount * (1 + acquirer.paypal_fee_int_var / 100.0) + acquirer.paypal_fee_int_fixed - amount
+ fees = amount * (1 + acquirer.fees_int_var / 100.0) + acquirer.fees_int_fixed - amount
return fees
def paypal_form_generate_values(self, cr, uid, id, reference, amount, currency, partner_id=False, partner_values=None, tx_custom_values=None, context=None):
@@ -96,7 +90,7 @@ class AcquirerPaypal(osv.Model):
'notify_url': '%s' % urlparse.urljoin(base_url, PaypalController._notify_url),
'cancel_return': '%s' % urlparse.urljoin(base_url, PaypalController._cancel_url),
}
- if acquirer.paypal_fee_active:
+ if acquirer.fees_active:
tx_values['handling'] = '%.2f' % tx_custom_values.pop('fees', 0.0)
if tx_custom_values and tx_custom_values.get('return_url'):
tx_values['custom'] = json.dumps({'return_url': '%s' % tx_custom_values.pop('return_url')})
diff --git a/addons/payment_acquirer_paypal/tests/test_paypal.py b/addons/payment_acquirer_paypal/tests/test_paypal.py
index 9b2c65272e6..c29e605e1c8 100644
--- a/addons/payment_acquirer_paypal/tests/test_paypal.py
+++ b/addons/payment_acquirer_paypal/tests/test_paypal.py
@@ -145,7 +145,7 @@ class PaypalForm(PaypalCommon):
def test_11_paypal_form_with_fees(self):
cr, uid, context = self.cr, self.uid, {}
self.payment_acquirer.write(cr, uid, self.paypal_id, {
- 'paypal_fee_active': True,
+ 'fees_active': True,
}, context)
# be sure not to do stupid things
@@ -168,7 +168,7 @@ class PaypalForm(PaypalCommon):
if form_input.get('name') in ['handling']:
handling_found = True
self.assertEqual(form_input.get('value'), '0.84', 'paypal: wrong computed fees')
- self.assertTrue(handling_found, 'paypal: paypal_fee_active did not add handling input in rendered form')
+ self.assertTrue(handling_found, 'paypal: fees_active did not add handling input in rendered form')
@mute_logger('openerp.addons.payment_acquirer_paypal.models.paypal', 'ValidationError')
def test_20_paypal_form_management(self):
diff --git a/addons/payment_acquirer_paypal/views/payment_acquirer.xml b/addons/payment_acquirer_paypal/views/payment_acquirer.xml
index 8a6c36ac7b2..6734b2fdcc5 100644
--- a/addons/payment_acquirer_paypal/views/payment_acquirer.xml
+++ b/addons/payment_acquirer_paypal/views/payment_acquirer.xml
@@ -19,17 +19,6 @@
-
-
-
-
-
-
-