summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2018-06-20 16:01:02 +0200
committerRomain Derie <rde@odoo.com>2018-06-22 18:32:49 +0200
commita7e2bd86661a5143a2ad4df628b4fb54238dcc2b (patch)
tree7f528feb1b551460c086dfdacb6ddb5c81551037
parent3d7e6b4757b0c793e95c83748c69f3354b996f96 (diff)
[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.)
-rw-r--r--addons/account/views/account_portal_templates.xml7
-rw-r--r--addons/account_payment/views/account_portal_templates.xml19
-rw-r--r--addons/payment/models/account_invoice.py2
-rw-r--r--addons/payment/views/payment_portal_templates.xml8
-rw-r--r--addons/web/views/report_templates.xml8
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 @@
<div class="col-md-3 hidden-print">
<div class="bs-sidebar mb16" id="sidebar_content">
<div class="text-center pt16 o_account_portal_sidebar">
- <h2 class="media-heading"><strong><span t-field="invoice.amount_total"/></strong></h2>
+ <h2 class="media-heading">
+ <strong>
+ <span t-if="invoice.residual > 0" t-field="invoice.residual"/>
+ <span t-else="1" t-field="invoice.amount_total"/>
+ </strong>
+ </h2>
<div class="mb4" t-if="invoice.state != 'paid'"><i class="fa fa-clock-o"/><span class="o_portal_sidebar_timeago ml4" t-att-datetime="invoice.date_due"/></div>
</div>
<div class="o_payment_button">
diff --git a/addons/account_payment/views/account_portal_templates.xml b/addons/account_payment/views/account_portal_templates.xml
index a82565af347..b541872e39a 100644
--- a/addons/account_payment/views/account_portal_templates.xml
+++ b/addons/account_payment/views/account_portal_templates.xml
@@ -86,25 +86,6 @@
<t t-call="account_payment.portal_invoice_payment"/>
</div>
</div>
- <t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending','authorized', 'done'))"/>
- <div t-if="tx_ids" class="o_tx_status mb8">
- <strong>Transactions</strong>
- <br/>
- <t t-foreach="tx_ids" t-as="tx">
- <span t-esc="tx.reference"/>
- <span class="text-muted" t-field="tx.create_date"/>
- <t t-if="tx.state == 'done'">
- <span class="label label-success orders_label_text_align"><i class="fa fa-fw fa-check"/> Done</span>
- </t>
- <t t-if="tx.state == 'authorized'">
- <span class="label label-success orders_label_text_align"><i class="fa fa-fw fa-check"/> Authorized</span>
- </t>
- <t t-if="tx.state not in ('done', 'authorized')">
- <span class="label label-info orders_label_text_align"><i class="fa fa-fw fa-clock-o"/> Waiting</span>
- <t t-if="tx.state_message"><br /><span t-esc="tx.state_message"/></t>
- </t>
- </t>
- </div>
</xpath>
</template>
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.
-->
+ <t t-set="thanks_msg" t-value="payment_tx_id.acquirer_id.post_msg"/>
+ <t t-set="thanks_msg" t-value="thanks_msg and thanks_msg != '&lt;p&gt;&lt;br&gt;&lt;/p&gt;' and thanks_msg"/>
<div t-if="payment_tx_id and payment_tx_id.state == 'pending'" class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
<span t-if='payment_tx_id.acquirer_id.pending_msg' t-raw="payment_tx_id.acquirer_id.pending_msg"/>
- <span t-if='payment_tx_id.acquirer_id.post_msg' t-raw="payment_tx_id.acquirer_id.post_msg"/>
+ <span t-if='thanks_msg' t-raw="thanks_msg"/>
</div>
<div t-if="payment_tx_id and payment_tx_id.state == 'authorized'" class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
Your payment has been authorized.
- <span t-if='payment_tx_id.acquirer_id.post_msg' t-raw="payment_tx_id.acquirer_id.post_msg"/>
+ <span t-if='thanks_msg' t-raw="thanks_msg"/>
</div>
<div t-if="payment_tx_id and payment_tx_id.state == 'done'" class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
<span t-if='payment_tx_id.acquirer_id.done_msg' t-raw="payment_tx_id.acquirer_id.done_msg"/>
- <span t-if='payment_tx_id.acquirer_id.post_msg' t-raw="payment_tx_id.acquirer_id.post_msg"/>
+ <span t-if='thanks_msg' t-raw="thanks_msg"/>
</div>
<div t-if="payment_tx_id and payment_tx_id.state == 'cancel'" class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
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 @@
<li t-if="company.vat"><i class="fa fa-building-o"/><t t-esc="company.country_id.vat_label or 'TIN'"/>: <span t-field="company.vat"/></li>
</ul>
<div t-field="company.report_footer"/>
- <div class="text-muted">
+ <div t-if="not type_html" class="text-muted">
Page:
<span class="page"/>
of
@@ -215,7 +215,7 @@
<li t-if="company.vat"><t t-esc="company.country_id.vat_label or 'TIN'"/>: <span t-field="company.vat"/></li>
</ul>
<div t-field="company.report_footer"/>
- <div>
+ <div t-if="not type_html">
Page: <span class="page"/> / <span class="topage"/>
</div>
</div>
@@ -257,7 +257,7 @@
<h4 class="mt0 mb0 text-uppercase" t-field="company.report_header"/>
</div>
<div class="col-xs-1">
- <ul class="list-inline pagenumber pull-right text-center">
+ <ul t-if="not type_html" class="list-inline pagenumber pull-right text-center">
<li><strong><span class="page"/></strong></li>
</ul>
</div>
@@ -304,7 +304,7 @@
<span t-field="company.report_footer"/>
</div>
- <div class="text-muted">
+ <div t-if="not type_html" class="text-muted">
Page: <span class="page"/> / <span class="topage"/>
</div>
</div>