mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch 'fix/13.0/H5924_website_sale_payment_terms__refactor_amounts' into '13.0'
fix/13.0/H5924_website_sale_payment_terms__refactor_amounts into 13.0 See merge request hibou-io/hibou-odoo/suite!1166
This commit is contained in:
@@ -12,7 +12,7 @@ Allow customers to choose payment terms if order total meets a configured thresh
|
||||
""",
|
||||
'depends': [
|
||||
'sale_payment_deposit',
|
||||
'website_sale',
|
||||
# 'website_sale',
|
||||
'website_sale_delivery',
|
||||
],
|
||||
'auto_install': False,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
from odoo.http import request, route
|
||||
from odoo.addons.website_sale.controllers.main import WebsiteSale
|
||||
from odoo.addons.website_sale_delivery.controllers.main import WebsiteSaleDelivery
|
||||
|
||||
|
||||
class WebsiteSalePaymentTerms(WebsiteSale):
|
||||
class WebsiteSalePaymentTerms(WebsiteSaleDelivery):
|
||||
|
||||
# In case payment_term_id is set by query-string in a link (from website_sale_delivery)
|
||||
@route(['/shop/payment'], type='http', auth="public", website=True)
|
||||
def payment(self, **post):
|
||||
order = request.website.sale_get_order()
|
||||
payment_term_id = post.get('payment_term_id')
|
||||
if order.amount_total <= request.website.payment_deposit_threshold:
|
||||
if order.amount_total > request.website.payment_deposit_threshold:
|
||||
if payment_term_id:
|
||||
payment_term_id = int(payment_term_id)
|
||||
if order:
|
||||
@@ -36,11 +36,14 @@ class WebsiteSalePaymentTerms(WebsiteSale):
|
||||
# Return values after order payment_term_id is updated
|
||||
def _update_website_payment_term_return(self, order, **post):
|
||||
if order:
|
||||
Monetary = request.env['ir.qweb.field.monetary']
|
||||
currency = order.currency_id
|
||||
return {
|
||||
'payment_term_name': order.payment_term_id.name,
|
||||
'payment_term_id': order.payment_term_id.id,
|
||||
'note': order.payment_term_id.note,
|
||||
'require_payment': order.require_payment,
|
||||
'amount_due_today': order.amount_due_today,
|
||||
'amount_due_today_html': Monetary.value_to_html(order.amount_due_today, {'display_currency': currency}),
|
||||
}
|
||||
return {}
|
||||
|
||||
@@ -48,9 +51,7 @@ class WebsiteSalePaymentTerms(WebsiteSale):
|
||||
def reject_term_agreement(self, **kw):
|
||||
order = request.website.sale_get_order()
|
||||
if order:
|
||||
partner = request.env.user.partner_id
|
||||
order.write({'payment_term_id': request.website.sale_get_payment_term(partner),
|
||||
'require_payment': True})
|
||||
order.payment_term_id = False
|
||||
return request.redirect('/shop/cart')
|
||||
|
||||
# Confirm order without taking payment
|
||||
@@ -59,10 +60,7 @@ class WebsiteSalePaymentTerms(WebsiteSale):
|
||||
order = request.website.sale_get_order()
|
||||
if not order:
|
||||
return request.redirect('/shop')
|
||||
if order.require_payment:
|
||||
return request.redirect('/shop/payment')
|
||||
if not order.payment_term_id or (
|
||||
order.payment_term_id.deposit_percentage or order.payment_term_id.deposit_flat):
|
||||
if order.amount_due_today:
|
||||
return request.redirect('/shop/payment')
|
||||
|
||||
# made it this far, lets confirm
|
||||
@@ -74,3 +72,11 @@ class WebsiteSalePaymentTerms(WebsiteSale):
|
||||
if request.website and request.website.sale_reset:
|
||||
request.website.sale_reset()
|
||||
return request.redirect('/shop/confirmation')
|
||||
|
||||
def _update_website_sale_delivery_return(self, order, **post):
|
||||
res = super(WebsiteSalePaymentTerms, self)._update_website_sale_delivery_return(order, **post)
|
||||
Monetary = request.env['ir.qweb.field.monetary']
|
||||
currency = order.currency_id
|
||||
if order:
|
||||
res['amount_due_today'] = Monetary.value_to_html(order.amount_due_today, {'display_currency': currency})
|
||||
return res
|
||||
|
||||
@@ -2,4 +2,5 @@ from . import account
|
||||
from . import payment
|
||||
from . import res_config
|
||||
from . import sale
|
||||
from . import sale_patch
|
||||
from . import website
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from odoo import models, _
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PaymentTransaction(models.Model):
|
||||
@@ -15,7 +17,30 @@ class PaymentTransaction(models.Model):
|
||||
self._log_payment_transaction_sent()
|
||||
return self.acquirer_id.with_context(submit_class='btn btn-primary', submit_txt=submit_txt or _('Pay Now')).sudo().render(
|
||||
self.reference,
|
||||
order.amount_total_deposit or order.amount_total,
|
||||
order.amount_due_today,
|
||||
order.pricelist_id.currency_id.id,
|
||||
values=values,
|
||||
)
|
||||
|
||||
# Override to confirm payments totaling the amount_due_today
|
||||
def _check_amount_and_confirm_order(self):
|
||||
self.ensure_one()
|
||||
for order in self.sale_order_ids.filtered(lambda so: so.state in ('draft', 'sent')):
|
||||
amount = order.amount_due_today
|
||||
if order.currency_id.compare_amounts(self.amount, amount) == 0:
|
||||
order.with_context(send_email=True).action_confirm()
|
||||
else:
|
||||
_logger.warning(
|
||||
'<%s> transaction AMOUNT MISMATCH for order %s (ID %s): expected %r, got %r',
|
||||
self.acquirer_id.provider, order.name, order.id,
|
||||
amount, self.amount,
|
||||
)
|
||||
order.message_post(
|
||||
subject=_("Amount Mismatch (%s)") % self.acquirer_id.provider,
|
||||
body=_(
|
||||
"The order was not confirmed despite response from the acquirer (%s): order total is %r but acquirer replied with %r.") % (
|
||||
self.acquirer_id.provider,
|
||||
amount,
|
||||
self.amount,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
amount_due_today = fields.Float('Due Now', compute='_compute_amount_due_today',
|
||||
help='Amount due at checkout on the website.')
|
||||
|
||||
@api.depends('amount_total', 'payment_term_id')
|
||||
def _compute_amount_due_today(self):
|
||||
today_string = fields.Date.to_string(fields.Date.today())
|
||||
for order in self:
|
||||
amount = order.amount_total
|
||||
if order.payment_term_id:
|
||||
term_amount = [amt for date_string, amt in order.payment_term_id.compute(order.amount_total) if date_string == today_string]
|
||||
term_amount = term_amount and term_amount[0] or 0.0
|
||||
amount = term_amount if term_amount > order.amount_total_deposit else order.amount_total_deposit
|
||||
order.amount_due_today = amount
|
||||
|
||||
def _check_payment_term_quotation(self, payment_term_id):
|
||||
self.ensure_one()
|
||||
if payment_term_id and self.payment_term_id.id != payment_term_id:
|
||||
@@ -12,7 +26,4 @@ class SaleOrder(models.Model):
|
||||
payment_term = self.env['account.payment.term'].sudo().browse(payment_term_id)
|
||||
if not payment_term.exists():
|
||||
raise Exception('Could not find payment terms.')
|
||||
self.write({
|
||||
'payment_term_id': payment_term_id,
|
||||
'require_payment': bool(payment_term.deposit_percentage) or bool(payment_term.deposit_flat),
|
||||
})
|
||||
self.payment_term_id = payment_term
|
||||
|
||||
86
website_sale_payment_terms/models/sale_patch.py
Normal file
86
website_sale_payment_terms/models/sale_patch.py
Normal file
@@ -0,0 +1,86 @@
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.addons.sale.models.sale import SaleOrder
|
||||
|
||||
|
||||
def _create_payment_transaction(self, vals):
|
||||
# Code copied from sale_payment_deposit to use order.amount_due_today
|
||||
#
|
||||
# This is a copy job from odoo.addons.sale.models.sale due to the closed nature of the vals.update(dict) call
|
||||
# Ultimately, only the 'vals.update' with the new amount is really used.
|
||||
'''Similar to self.env['payment.transaction'].create(vals) but the values are filled with the
|
||||
current sales orders fields (e.g. the partner or the currency).
|
||||
:param vals: The values to create a new payment.transaction.
|
||||
:return: The newly created payment.transaction record.
|
||||
'''
|
||||
# Ensure the currencies are the same.
|
||||
|
||||
# extract variable for use later.
|
||||
sale = self[0]
|
||||
|
||||
currency = sale.pricelist_id.currency_id
|
||||
if any([so.pricelist_id.currency_id != currency for so in self]):
|
||||
raise ValidationError(_('A transaction can\'t be linked to sales orders having different currencies.'))
|
||||
|
||||
# Ensure the partner are the same.
|
||||
partner = sale.partner_id
|
||||
if any([so.partner_id != partner for so in self]):
|
||||
raise ValidationError(_('A transaction can\'t be linked to sales orders having different partners.'))
|
||||
|
||||
# Try to retrieve the acquirer. However, fallback to the token's acquirer.
|
||||
acquirer_id = vals.get('acquirer_id')
|
||||
acquirer = False
|
||||
payment_token_id = vals.get('payment_token_id')
|
||||
|
||||
if payment_token_id:
|
||||
payment_token = self.env['payment.token'].sudo().browse(payment_token_id)
|
||||
|
||||
# Check payment_token/acquirer matching or take the acquirer from token
|
||||
if acquirer_id:
|
||||
acquirer = self.env['payment.acquirer'].browse(acquirer_id)
|
||||
if payment_token and payment_token.acquirer_id != acquirer:
|
||||
raise ValidationError(_('Invalid token found! Token acquirer %s != %s') % (
|
||||
payment_token.acquirer_id.name, acquirer.name))
|
||||
if payment_token and payment_token.partner_id != partner:
|
||||
raise ValidationError(_('Invalid token found! Token partner %s != %s') % (
|
||||
payment_token.partner.name, partner.name))
|
||||
else:
|
||||
acquirer = payment_token.acquirer_id
|
||||
|
||||
# Check an acquirer is there.
|
||||
if not acquirer_id and not acquirer:
|
||||
raise ValidationError(_('A payment acquirer is required to create a transaction.'))
|
||||
|
||||
if not acquirer:
|
||||
acquirer = self.env['payment.acquirer'].browse(acquirer_id)
|
||||
|
||||
# Check a journal is set on acquirer.
|
||||
if not acquirer.journal_id:
|
||||
raise ValidationError(_('A journal must be specified of the acquirer %s.' % acquirer.name))
|
||||
|
||||
if not acquirer_id and acquirer:
|
||||
vals['acquirer_id'] = acquirer.id
|
||||
|
||||
# Override for Deposit
|
||||
amount = sum(self.mapped('amount_total'))
|
||||
# This is a patch, all databases will run this code even if this field doesn't exist.
|
||||
if hasattr(sale, 'amount_due_today'):
|
||||
amount = sum(self.mapped('amount_due_today'))
|
||||
|
||||
vals.update({
|
||||
'amount': amount,
|
||||
'currency_id': currency.id,
|
||||
'partner_id': partner.id,
|
||||
'sale_order_ids': [(6, 0, self.ids)],
|
||||
})
|
||||
|
||||
transaction = self.env['payment.transaction'].create(vals)
|
||||
|
||||
# Process directly if payment_token
|
||||
if transaction.payment_token_id:
|
||||
transaction.s2s_do_transaction()
|
||||
|
||||
return transaction
|
||||
|
||||
|
||||
# Patch core implementation.
|
||||
SaleOrder._create_payment_transaction = _create_payment_transaction
|
||||
@@ -9,12 +9,10 @@ odoo.define('website_sale_payment_terms.payment_terms', function (require) {
|
||||
require('website_sale_delivery.checkout');
|
||||
|
||||
|
||||
console.log('Payment Terms V10.2');
|
||||
|
||||
publicWidget.registry.websiteSalePaymentTerms = publicWidget.Widget.extend({
|
||||
selector: '.oe_website_sale',
|
||||
selector: '.oe_payment_terms',
|
||||
events: {
|
||||
"click #payment_terms input[name='payment_term_id']": '_onPaymentTermClick',
|
||||
"click input[name='payment_term_id']": '_onPaymentTermClick',
|
||||
"click #btn_accept_payment_terms": '_acceptPaymentTerms',
|
||||
"click #btn_deny_payment_terms": '_denyPaymentTerms',
|
||||
},
|
||||
@@ -23,61 +21,24 @@ odoo.define('website_sale_payment_terms.payment_terms', function (require) {
|
||||
* @override
|
||||
*/
|
||||
start: function () {
|
||||
core.bus.on('payment_terms_update_amount', this, this.updateAmountDue);
|
||||
console.log('Payment Terms V10.3');
|
||||
return this._super.apply(this, arguments).then(function () {
|
||||
var available_term = $('input[name="payment_term_id"]').length;
|
||||
var $payButton = $('#o_payment_form_pay');
|
||||
if (available_term > 0) {
|
||||
console.log('Payment term detected');
|
||||
var $payButton = $('#o_payment_form_pay');
|
||||
$payButton.prop('disabled', true);
|
||||
var disabledReasons = $payButton.data('disabled_reasons') || {};
|
||||
disabledReasons.payment_terms_selection = true;
|
||||
if ($('input[name="payment_term_id"][checked]')) {
|
||||
disabledReasons.payment_terms_selection = false;
|
||||
} else {
|
||||
disabledReasons.payment_terms_selection = true;
|
||||
}
|
||||
$payButton.data('disabled_reasons', disabledReasons);
|
||||
} else {
|
||||
console.log('no payment term detected');
|
||||
$payButton.prop('disabled', _.contains($payButton.data('disabled_reasons'), true));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Calculate amount Due Now
|
||||
*
|
||||
* @public
|
||||
* @param: {number} t Total
|
||||
* @param: {number} d Deposit percentage
|
||||
* @param: {number} f Deposit flat amount
|
||||
*/
|
||||
calculateDeposit: function (t, d, f) {
|
||||
var amount = t * d / 100 + f;
|
||||
if (amount > 0) {
|
||||
amount = amount.toFixed(2);
|
||||
amount = amount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
return amount;
|
||||
} else {
|
||||
amount = 0.00;
|
||||
return amount;
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* All input clicks update due amount
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
updateAmountDue: function () {
|
||||
var amount_total = $('#order_total span.oe_currency_value').html().replace(',', '');
|
||||
amount_total = parseFloat(amount_total);
|
||||
var $checked = $('input[name="payment_term_id"]:checked');
|
||||
var $deposit_percentage = $checked.attr('data-deposit-percentage');
|
||||
var $deposit_flat = parseFloat($checked.attr('data-deposit-flat'));
|
||||
var $due_amount = this.calculateDeposit(amount_total, $deposit_percentage, $deposit_flat);
|
||||
$('#order_due_today span.oe_currency_value').html($due_amount);
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -104,7 +65,8 @@ odoo.define('website_sale_payment_terms.payment_terms', function (require) {
|
||||
*/
|
||||
_onPaymentTermUpdateAnswer: function (result) {
|
||||
if (!result.error) {
|
||||
|
||||
console.log("_onPaymentTermUpdateAnswer");
|
||||
console.log(result);
|
||||
// Get Payment Term note/description for modal
|
||||
var note = result.note;
|
||||
if (!result.note) {
|
||||
@@ -112,15 +74,13 @@ odoo.define('website_sale_payment_terms.payment_terms', function (require) {
|
||||
}
|
||||
|
||||
// Change forms based on order payment requirement
|
||||
this.updateAmountDue();
|
||||
if(!result.require_payment) {
|
||||
$('#order_due_today .monetary_field').html(result.amount_due_today_html);
|
||||
if(result.amount_due_today == 0.0) {
|
||||
$('#payment_method').hide();
|
||||
$('#non_payment_method').show();
|
||||
$('#order_due_today').hide();
|
||||
} else {
|
||||
$('#payment_method').show();
|
||||
$('#non_payment_method').hide();
|
||||
$('#order_due_today').show();
|
||||
}
|
||||
|
||||
// Open success modal with message
|
||||
@@ -157,7 +117,7 @@ odoo.define('website_sale_payment_terms.payment_terms', function (require) {
|
||||
publicWidget.registry.websiteSaleDelivery.include({
|
||||
_handleCarrierUpdateResult: function (result) {
|
||||
this._super.apply(this, arguments);
|
||||
core.bus.trigger('payment_terms_update_amount');
|
||||
$('#order_due_today .monetary_field').html(result.amount_due_today);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
1
website_sale_payment_terms/tests/__init__.py
Normal file
1
website_sale_payment_terms/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_amount_due
|
||||
54
website_sale_payment_terms/tests/test_amount_due.py
Normal file
54
website_sale_payment_terms/tests/test_amount_due.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from odoo.tests import tagged, TransactionCase
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestWebsiteSalePaymentTerms(TransactionCase):
|
||||
def setUp(self):
|
||||
super(TestWebsiteSalePaymentTerms, self).setUp()
|
||||
self.so = self.env['sale.order'].create({
|
||||
'partner_id': self.ref('base.res_partner_12'),
|
||||
'order_line': [(0, 0, {
|
||||
'product_id': self.env['product.product'].create({'name': 'Product A', 'list_price': 100}).id,
|
||||
'product_uom_qty': 1,
|
||||
'name': 'Product A',
|
||||
'tax_id': False,
|
||||
})]
|
||||
})
|
||||
|
||||
def test_00_immediate(self):
|
||||
# Double-check that we're asking for money if no payment terms are set
|
||||
self.assertEqual(self.so.amount_due_today, self.so.amount_total)
|
||||
|
||||
immediate_terms = self.browse_ref('account.account_payment_term_immediate')
|
||||
self.so._check_payment_term_quotation(immediate_terms.id)
|
||||
self.assertEqual(self.so.amount_due_today, self.so.amount_total)
|
||||
|
||||
def test_10_thirty_percent(self):
|
||||
thirty_percent_terms = self.browse_ref('account.account_payment_term_advance_60days')
|
||||
self.so._check_payment_term_quotation(thirty_percent_terms.id)
|
||||
self.assertEqual(self.so.amount_due_today, 30.0)
|
||||
|
||||
def test_20_fifteen_days(self):
|
||||
fifteen_days_terms = self.browse_ref('account.account_payment_term_15days')
|
||||
self.so._check_payment_term_quotation(fifteen_days_terms.id)
|
||||
self.assertEqual(self.so.amount_due_today, 0.0)
|
||||
|
||||
def test_30_deposit_requested(self):
|
||||
"""
|
||||
Ask for deposit if deposit amount is greater
|
||||
"""
|
||||
thirty_percent_terms = self.browse_ref('account.account_payment_term_advance_60days')
|
||||
thirty_percent_terms.deposit_percentage = 40
|
||||
thirty_percent_terms.deposit_flat = 5
|
||||
self.so._check_payment_term_quotation(thirty_percent_terms.id)
|
||||
self.assertEqual(self.so.amount_due_today, 45.0)
|
||||
|
||||
def test_40_low_deposit(self):
|
||||
"""
|
||||
Ask for terms amount if greater than requested deposit
|
||||
"""
|
||||
thirty_percent_terms = self.browse_ref('account.account_payment_term_advance_60days')
|
||||
thirty_percent_terms.deposit_percentage = 20
|
||||
thirty_percent_terms.deposit_flat = 5
|
||||
self.so._check_payment_term_quotation(thirty_percent_terms.id)
|
||||
self.assertEqual(self.so.amount_due_today, 30.0)
|
||||
@@ -4,12 +4,10 @@
|
||||
<record id="view_payment_term_form" model="ir.ui.view">
|
||||
<field name="name">view.payment.term.form.inherit.website</field>
|
||||
<field name="model">account.payment.term</field>
|
||||
<field name="inherit_id" ref="account.view_payment_term_form"/>
|
||||
<field name="inherit_id" ref="sale_payment_deposit.view_payment_term_form_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='note']" position="before">
|
||||
<group>
|
||||
<field name="allow_in_website_sale"/>
|
||||
</group>
|
||||
<xpath expr="//field[@name='deposit_flat']" position="after">
|
||||
<field name="allow_in_website_sale"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<!-- Payment terms list items for /shop/payment -->
|
||||
<template id="payment_term_items">
|
||||
<t t-set="partner_term" t-value="order.partner_id.property_payment_term_id"/>
|
||||
<t t-set="selected_term" t-value="order.payment_term_id or partner_term"/>
|
||||
<!-- Show current partners payment terms -->
|
||||
<t t-if="partner_term and partner_term not in website_terms">
|
||||
<li class="list-group-item">
|
||||
@@ -12,7 +13,8 @@
|
||||
t-att-data-deposit-flat="partner_term.deposit_flat or '0'"
|
||||
name="payment_term_id"
|
||||
t-att-id="'payment_term_%i' % partner_term.id"
|
||||
type="radio"/>
|
||||
t-att-checked="partner_term == selected_term"
|
||||
type="radio"/>
|
||||
<label t-att-for="'payment_term_%i' % partner_term.id"
|
||||
t-field="partner_term.name"
|
||||
class="label-optional"/>
|
||||
@@ -24,6 +26,7 @@
|
||||
t-att-data-deposit-percentage="term.deposit_percentage or '0'"
|
||||
t-att-data-deposit-flat="term.deposit_flat or '0'"
|
||||
t-att-id="'payment_term_%i' % term.id"
|
||||
t-att-checked="term == selected_term"
|
||||
type="radio"
|
||||
name="payment_term_id"/>
|
||||
<label t-att-for="'payment_term_%i' % term.id"
|
||||
@@ -37,9 +40,9 @@
|
||||
<xpath expr="//div[@id='payment_method']" position="before">
|
||||
<t t-set="website_terms" t-value="website.get_payment_terms()" />
|
||||
<t t-if="website_terms and website_sale_order.amount_total > website.payment_deposit_threshold">
|
||||
<t t-call="website_sale_payment_terms.payment_term_success_modal"/>
|
||||
<t t-call="website_sale_payment_terms.payment_term_error_modal"/>
|
||||
<div id="payment_terms">
|
||||
<div class="oe_payment_terms">
|
||||
<t t-call="website_sale_payment_terms.payment_term_success_modal"/>
|
||||
<t t-call="website_sale_payment_terms.payment_term_error_modal"/>
|
||||
<h3 class="mb24 mt24">Payment Terms</h3>
|
||||
<div class="card border-0">
|
||||
<ul class="list-group">
|
||||
@@ -49,12 +52,23 @@
|
||||
</div>
|
||||
</t>
|
||||
</xpath>
|
||||
<xpath expr="//div[@id='payment_method']" position="attributes">
|
||||
<attribute name="t-att-style">'display: block;' if website_sale_order.amount_due_today else 'display: none;'</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@id='payment_method']" position="after">
|
||||
<!-- Bypass Validation for users with 0 deposit payment terms -->
|
||||
<div class="mt-3" style="display:none;" id="non_payment_method">
|
||||
<a href="/shop/confirm_without_payment" class="float-right btn btn-primary">
|
||||
<span>Confirm Order <span class="fa fa-chevron-right"/></span>
|
||||
</a>
|
||||
<div class="mt-3" t-if="website_sale_order.amount_total" t-att-style="'display: none;' if website_sale_order.amount_due_today else 'display: block;'" id="non_payment_method">
|
||||
<div class="float-left mt-2">
|
||||
<a role="button" href="/shop/cart" class="btn btn-secondary">
|
||||
<i class="fa fa-chevron-left"/>
|
||||
Return to Cart
|
||||
</a>
|
||||
</div>
|
||||
<div class="float-right mt-2" >
|
||||
<a href="/shop/confirm_without_payment" class="float-right btn btn-primary">
|
||||
<span>Confirm Order <span class="fa fa-chevron-right"/></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
@@ -118,12 +132,12 @@
|
||||
<!-- Add empty div to calculate amount due today in payment_terms.js -->
|
||||
<template id="amount_due_today" inherit_id="website_sale.total">
|
||||
<xpath expr="//tr[@id='order_total']" position="after">
|
||||
<tr id="order_due_today" t-att-style="'' if website_sale_order.amount_total_deposit else 'display: none;'">
|
||||
<tr id="order_due_today">
|
||||
<td class="text-right text-info">
|
||||
<strong>Due Now:</strong>
|
||||
</td>
|
||||
<td class="text-xl-right">
|
||||
<strong t-field="website_sale_order.amount_total_deposit"
|
||||
<strong t-field="website_sale_order.amount_due_today" class="monetary_field"
|
||||
t-options='{"widget": "monetary", "display_currency": website_sale_order.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user