diff --git a/addons/account/controllers/portal.py b/addons/account/controllers/portal.py index f4356d7b1b6..99d44428f29 100644 --- a/addons/account/controllers/portal.py +++ b/addons/account/controllers/portal.py @@ -85,6 +85,11 @@ class PortalAccount(CustomerPortal): return self._show_report(model=invoice_sudo, report_type=report_type, report_ref='account.account_invoices', download=download) values = self._invoice_get_page_view_values(invoice_sudo, access_token, **kw) + acquirers = values.get('acquirers') + if acquirers: + country_id = values.get('partner_id') and values.get('partner_id')[0].country_id.id + values['acq_extra_fees'] = acquirers.get_acquirer_extra_fees(invoice_sudo.residual, invoice_sudo.currency_id, country_id) + return request.render("account.portal_invoice_page", values) # ------------------------------------------------------------ diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 0f2ce5d222a..8fa4d67c36a 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -296,6 +296,19 @@ class PaymentAcquirer(models.Model): self.journal_id.show_on_dashboard = self.website_published return True + @api.multi + def get_acquirer_extra_fees(self, amount, currency_id, country_id): + extra_fees = { + 'currency_id': currency_id + } + acquirers = self.filtered(lambda x: x.fees_active) + for acq in acquirers: + custom_method_name = '%s_compute_fees' % acq.provider + if hasattr(acq, custom_method_name): + fees = getattr(acq, custom_method_name)(amount, currency_id, country_id) + extra_fees[acq] = fees + return extra_fees + @api.multi def get_form_action_url(self): """ Returns the form action URL, for form-based acquirer implementations. """ diff --git a/addons/payment/views/payment_templates.xml b/addons/payment/views/payment_templates.xml index 550939e21b7..99e450dc179 100644 --- a/addons/payment/views/payment_templates.xml +++ b/addons/payment/views/payment_templates.xml @@ -63,6 +63,12 @@ t-att-checked="acquirers_count==1 and pms_count==0 or acquirers[0] == acq"/> + + + Fee + + + (Some fees may apply) +