From a7e2bd86661a5143a2ad4df628b4fb54238dcc2b Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Wed, 20 Jun 2018 16:01:02 +0200 Subject: [PATCH] [IMP] account(_payment), payment, web: show residual amount.. .. & hide transaction list + page numbers on HTML report. 1. Before this commit: Portal Invoices were displaying the total amount instead of the residual amount. The pay button would also trigger a payment for the total amount Now: If part of the invoice is already paid, we show the residual amount and payment transaction amount are set to residual amount so the client is asked to pay what he really needs to pay. 2. Processed transaction results in a bootstrap alert message displayed at the top of the page, showing warning, success or alert depending of the result. This alert is supposed to show thank message `post_msg` only if it set. Before this commit: Since `post_msg` is an html field and editable through summernote, it will never be empty. Indeed, empty field with summernote are replaced by a `br` tag inside a `p` tag. The condition would never be false, resulting in an empty `p` with a `br` inside being displayed at the bottom of the alert, making it looks like it is bugged. Now: The condition also consider summernote's empty string as such. 3. Remove the transaction list from the invoice portal template since it is not an important information to the client. Some client would not even understand what it is. 4. Hide page numbers on HTML report since they are not split in pages and page number remains empty, resulting in `Page: /` (Or empty square with the 'clean layout.) --- .../views/account_portal_templates.xml | 7 ++++++- .../views/account_portal_templates.xml | 19 ------------------- addons/payment/models/account_invoice.py | 2 +- .../views/payment_portal_templates.xml | 8 +++++--- addons/web/views/report_templates.xml | 8 ++++---- 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml index d2e30a7f1c8..1513427285d 100644 --- a/addons/account/views/account_portal_templates.xml +++ b/addons/account/views/account_portal_templates.xml @@ -75,7 +75,12 @@
- -
- Transactions -
- - - - - Done - - - Authorized - - - Waiting -
-
-
-
diff --git a/addons/payment/models/account_invoice.py b/addons/payment/models/account_invoice.py index 490ebd58cdf..54d9f9099b0 100644 --- a/addons/payment/models/account_invoice.py +++ b/addons/payment/models/account_invoice.py @@ -75,7 +75,7 @@ class AccountInvoice(models.Model): vals['acquirer_id'] = acquirer.id vals.update({ - 'amount': sum(self.mapped('amount_total')), + 'amount': sum(self.mapped('residual')), 'currency_id': currency.id, 'partner_id': partner.id, 'invoice_ids': [(6, 0, self.ids)], diff --git a/addons/payment/views/payment_portal_templates.xml b/addons/payment/views/payment_portal_templates.xml index cfa0ac19269..1cb4873d524 100644 --- a/addons/payment/views/payment_portal_templates.xml +++ b/addons/payment/views/payment_portal_templates.xml @@ -118,20 +118,22 @@ To be called with the 'payment_tx_id' value. --> + +
- +
Your payment has been authorized. - +
- +
diff --git a/addons/web/views/report_templates.xml b/addons/web/views/report_templates.xml index b2adac467e7..5c08be5df9f 100644 --- a/addons/web/views/report_templates.xml +++ b/addons/web/views/report_templates.xml @@ -176,7 +176,7 @@
  • :
  • -
    +
    Page: of @@ -215,7 +215,7 @@
  • :
  • -
    +
    Page: /
    @@ -257,7 +257,7 @@

    -
      +
    @@ -304,7 +304,7 @@
    -
    +
    Page: /