diff options
| author | fda-odoo <fda@odoo.com> | 2017-12-18 13:47:39 +0100 |
|---|---|---|
| committer | fda-odoo <fda@odoo.com> | 2018-01-24 15:30:59 +0100 |
| commit | f62b31caf3011e50e357db7fa6c93612fa412de5 (patch) | |
| tree | 6e90f528d06f6f22de758400e2b94934a7a568c5 | |
| parent | 2ba6301d341400003298370b643f724eec822f06 (diff) | |
[FIX/IMP] account,account_payment,sale,sale_payment: add a payment notification message for user who are coming back in Odoo after a payment (like in online quotations & e-commerce)
WARNING: To avoid breaking any configuration in stable (11.0), the template payment_confirmation_status has been replicated in each module.
They must be removed before a forward-port in master
| -rw-r--r-- | addons/account/views/account_portal_templates.xml | 10 | ||||
| -rw-r--r-- | addons/account_payment/views/account_portal_templates.xml | 40 | ||||
| -rw-r--r-- | addons/payment/views/payment_portal_templates.xml | 26 | ||||
| -rw-r--r-- | addons/sale/views/sale_portal_templates.xml | 10 | ||||
| -rw-r--r-- | addons/sale_payment/views/sale_portal_templates.xml | 39 | ||||
| -rw-r--r-- | addons/website_quote/controllers/main.py | 1 | ||||
| -rw-r--r-- | addons/website_quote/views/website_quote_templates.xml | 47 |
7 files changed, 146 insertions, 27 deletions
diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml index 2ff82b4bc3a..5d62cc9481a 100644 --- a/addons/account/views/account_portal_templates.xml +++ b/addons/account/views/account_portal_templates.xml @@ -95,7 +95,7 @@ </div> <div class="panel-body"> <t t-if="error or warning" t-call="account.portal_invoice_error"/> - <t t-if="success and (not error and not warning)" t-call="account.portal_invoice_success"/> + <t id="payment_success" t-if="success and (not error and not warning)" t-call="account.portal_invoice_success"/> <t t-call="account.portal_invoice_report"/> </div> </div> @@ -253,8 +253,8 @@ </template> <template id="portal_invoice_error" name="Invoice error/warning display"> - <div class="row"> - <div t-att-class="'col-md-6 col-md-offset-3 text-center alert alert-dismissable %s' % ('alert-danger' if error else 'alert-warning')"> + <div class="row mr16"> + <div t-attf-class="'col-md-12 mr16 ml16 alert alert-dismissable' #{'alert-danger' if error else 'alert-warning'}"> <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a> <t t-if="error == 'generic'" name="generic"> There was an error processing this page. @@ -264,8 +264,8 @@ </template> <template id="portal_invoice_success" name="Invoice success display"> - <div class="row"> - <div class="col-md-6 col-md-offset-3 text-center alert alert-dismissable alert-success"> + <div class="row mr16"> + <div class="col-md-12 mr16 ml16 alert alert-dismissable alert-success"> <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a> </div> </div> diff --git a/addons/account_payment/views/account_portal_templates.xml b/addons/account_payment/views/account_portal_templates.xml index 46e745e146b..7a3d9efc31b 100644 --- a/addons/account_payment/views/account_portal_templates.xml +++ b/addons/account_payment/views/account_portal_templates.xml @@ -12,6 +12,36 @@ </xpath> </template> + + <!-- duplicata of the template payment.payment_confirmation_status. + The duplication avoid to break an existing installation in stable version--> + <template id="payment_confirmation_status"> + <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">&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"/> + </div> + <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">&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"/> + </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">&times;</button> + <span t-if='payment_tx_id.acquirer_id.cancel_msg' t-raw="payment_tx_id.acquirer_id.cancel_msg"/> + </div> + <div t-if="payment_tx_id and payment_tx_id.state == 'error'" class="alert alert-danger alert-dismissable"> + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> + <span t-if='payment_tx_id.acquirer_id.error_msg' t-raw="payment_tx_id.acquirer_id.error_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">&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"/> + </div> + </template> + + <template id="portal_invoice_page_inherit_payment" name="Payment on My Invoices" inherit_id="account.portal_invoice_page"> <xpath expr="//div[@id='o_portal_account_actions']/a" position="before"> <t t-set="tx_ids" t-value="invoice.payment_tx_ids.filtered(lambda tx: tx.state in ('pending', 'authorized', 'done'))"/> @@ -28,6 +58,13 @@ <i class="fa fa-check-circle"/> Paid </a> </xpath> + <xpath expr="//t[@id='payment_success']" position="after"> + <div t-if="invoice.payment_tx_ids and invoice.amount_total and not success and not error" class="o_account_payment_tx_status" t-att-data-invoice-id="invoice.id"> + <t t-call="account_payment.payment_confirmation_status"> + <t t-set="payment_tx_id" t-value="invoice.payment_tx_id"/> + </t> + </div> + </xpath> <xpath expr="//div[hasclass('panel-body')]" position="after"> <div class="panel-body" t-if="not tx_ids and invoice.state == 'open' and invoice.amount_total" id="portal_pay"> <div t-if="pms or s2s_acquirers or form_acquirers" id="payment_method" class="col-md-offset-3 col-md-6"> @@ -119,7 +156,8 @@ inherit_id="account.portal_invoice_success"> <xpath expr="//a[hasclass('close')]" position="after"> <t t-if="success == 'pay_invoice'"> - Invoice successfully paid. + <span t-if='invoice.payment_acquirer_id.done_msg' t-raw="invoice.payment_acquirer_id.done_msg"/> + <span t-if='invoice.payment_acquirer_id.post_msg' t-raw="invoice.payment_acquirer_id.post_msg"/> </t> </xpath> </template> diff --git a/addons/payment/views/payment_portal_templates.xml b/addons/payment/views/payment_portal_templates.xml index f599329e5e1..16776b880d1 100644 --- a/addons/payment/views/payment_portal_templates.xml +++ b/addons/payment/views/payment_portal_templates.xml @@ -122,5 +122,31 @@ </t> </template> + <template id="payment_confirmation_status"> + <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">&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"/> + </div> + <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">&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"/> + </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">&times;</button> + <span t-if='payment_tx_id.acquirer_id.cancel_msg' t-raw="payment_tx_id.acquirer_id.cancel_msg"/> + </div> + <div t-if="payment_tx_id and payment_tx_id.state == 'error'" class="alert alert-danger alert-dismissable"> + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> + <span t-if='payment_tx_id.acquirer_id.error_msg' t-raw="payment_tx_id.acquirer_id.error_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">&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"/> + </div> + </template> + </data> </odoo> diff --git a/addons/sale/views/sale_portal_templates.xml b/addons/sale/views/sale_portal_templates.xml index d38b93cb821..1d724064c7b 100644 --- a/addons/sale/views/sale_portal_templates.xml +++ b/addons/sale/views/sale_portal_templates.xml @@ -172,7 +172,7 @@ </div> <div class="panel-body"> <t t-if="error or warning" t-call="sale.portal_order_error"/> - <t t-if="success and (not error and not warning)" t-call="sale.portal_order_success"/> + <t id="payment_success" t-if="success and (not error and not warning)" t-call="sale.portal_order_success"/> <div class="mb8"> <strong>Date:</strong> <span t-field="order.create_date" t-options='{"widget": "date"}'/> </div> @@ -335,8 +335,8 @@ </template> <template id="portal_order_error" name="Order error/warning display"> - <div class="row"> - <div t-att-class="'col-md-6 col-md-offset-3 text-center alert alert-dismissable %s' % ('alert-danger' if error else 'alert-warning')"> + <div class="row mr16"> + <div t-attf-class="'col-md-12 mr16 ml16 alert alert-dismissable' #{'alert-danger' if error else 'alert-warning'}"> <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a> <t t-if="error == 'generic'" name="generic"> There was an error processing this page. @@ -346,8 +346,8 @@ </template> <template id="portal_order_success" name="Order success display"> - <div class="row"> - <div class="col-md-6 col-md-offset-3 text-center alert alert-dismissable alert-success"> + <div class="row mr16"> + <div class="col-md-12 mr16 ml16 alert alert-dismissable alert-success"> <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a> </div> </div> diff --git a/addons/sale_payment/views/sale_portal_templates.xml b/addons/sale_payment/views/sale_portal_templates.xml index 5ca7511fbec..c254186cbee 100644 --- a/addons/sale_payment/views/sale_portal_templates.xml +++ b/addons/sale_payment/views/sale_portal_templates.xml @@ -1,4 +1,34 @@ <odoo> + + <!-- duplicata of the template payment.payment_confirmation_status. + The duplication avoid to break an existing installation in stable version--> + <template id="payment_confirmation_status"> + <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">&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"/> + </div> + <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">&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"/> + </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">&times;</button> + <span t-if='payment_tx_id.acquirer_id.cancel_msg' t-raw="payment_tx_id.acquirer_id.cancel_msg"/> + </div> + <div t-if="payment_tx_id and payment_tx_id.state == 'error'" class="alert alert-danger alert-dismissable"> + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> + <span t-if='payment_tx_id.acquirer_id.error_msg' t-raw="payment_tx_id.acquirer_id.error_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">&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"/> + </div> + </template> + + <template id="portal_my_orders_payment" name="Payment on my orders" inherit_id="sale.portal_order_page"> <xpath expr="//t[@name='portal_confirmation_sign']" position="after"> <t t-if="not invoices and order.state in ('sent', 'sale') and portal_confirmation == 'pay' and order.payment_tx_id.state != 'done'" name="portal_confirmation_pay"> @@ -12,6 +42,12 @@ </a> </t> </xpath> + <xpath expr="//t[@id='payment_success']" position="after"> + <div t-if="order.payment_tx_ids and not invoices and order.state in ('sent', 'sale') and portal_confirmation == 'pay' and not success and not error" class="o_sale_payment_tx_status" t-att-data-order-id="order.id"> + <t t-set="payment_tx_id" t-value="order.payment_tx_id"/> + <t t-call="sale_payment.payment_confirmation_status"/> + </div> + </xpath> <xpath expr="//div[@id='portal_sign']" position="after"> <div class="row" t-if="not invoices and order.state in ('sent') and portal_confirmation == 'pay'" id="portal_pay"> <div class="col-md-offset-3 col-md-6"> @@ -101,7 +137,8 @@ inherit_id="sale.portal_order_success"> <xpath expr="//a[hasclass('close')]" position="after"> <t t-if="success == 'pay_sale'"> - Order successfully paid. + <span t-if='order.payment_acquirer_id.done_msg' t-raw="order.payment_acquirer_id.done_msg"/> + <span t-if='order.payment_acquirer_id.post_msg' t-raw="order.payment_acquirer_id.post_msg"/> </t> </xpath> </template> diff --git a/addons/website_quote/controllers/main.py b/addons/website_quote/controllers/main.py index e29d6be9cbf..5656a610272 100644 --- a/addons/website_quote/controllers/main.py +++ b/addons/website_quote/controllers/main.py @@ -79,6 +79,7 @@ class sale_quote(http.Controller): 'tx_id': Transaction.id if Transaction else False, 'tx_state': Transaction.state if Transaction else False, 'tx_post_msg': Transaction.acquirer_id.post_msg if Transaction else False, + 'payment_tx': Transaction, 'need_payment': order_sudo.invoice_status == 'to invoice' and Transaction.state in ['draft', 'cancel', 'error'], 'token': token, 'return_url': '/shop/payment/validate', diff --git a/addons/website_quote/views/website_quote_templates.xml b/addons/website_quote/views/website_quote_templates.xml index c56945c94d5..5e1ab588ae8 100644 --- a/addons/website_quote/views/website_quote_templates.xml +++ b/addons/website_quote/views/website_quote_templates.xml @@ -163,6 +163,34 @@ </xpath> </template> + <!-- duplicata of the template payment.payment_confirmation_status. + The duplication avoid to break an existing installation in stable version--> + <template id="payment_confirmation_status"> + <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">&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"/> + </div> + <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">&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"/> + </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">&times;</button> + <span t-if='payment_tx_id.acquirer_id.cancel_msg' t-raw="payment_tx_id.acquirer_id.cancel_msg"/> + </div> + <div t-if="payment_tx_id and payment_tx_id.state == 'error'" class="alert alert-danger alert-dismissable"> + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> + <span t-if='payment_tx_id.acquirer_id.error_msg' t-raw="payment_tx_id.acquirer_id.error_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">&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"/> + </div> + </template> + <!-- Complete page of the quotation --> <template id="so_quotation" name="Product Quotation"> <t t-call="portal.portal_layout"> @@ -257,21 +285,10 @@ and do not hesitate to <a href="#discussion">contact us</a> for any question. </div> - <div class="alert alert-warning alert-dismissable" t-if="tx_id and tx_state == 'done'"> - <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> - Your payment has been received, thank you for your trust. - <span t-if='tx_post_msg' t-raw="tx_post_msg"/> - </div> - <div class="alert alert-warning alert-dismissable" t-if="tx_id and tx_state == 'pending'"> - <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> - Your transaction is waiting confirmation. - <span t-if='tx_post_msg' t-raw="tx_post_msg"/> - </div> - <div class="alert alert-success alert-dismissable" t-if="tx_id and tx_state == 'authorized'"> - <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> - Your payment has been authorized. - <span t-if='tx_post_msg' t-raw="tx_post_msg"/> - </div> + <t t-if="payment_tx"> + <t t-set="payment_tx_id" t-value="payment_tx"/> + <t t-call="website_quote.payment_confirmation_status"/> + </t> <div class="alert alert-warning alert-dismissable" t-if="message==4 and quotation.state != 'sent'"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> This order |
