Skip to content
Snippets Groups Projects
Commit a7e2bd86 authored by Romain Derie's avatar Romain Derie
Browse files

[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.)
parent 3d7e6b47
Branches
Tags
No related merge requests found
......@@ -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">
......
......@@ -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>
......
......@@ -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)],
......
......@@ -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>
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment