mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[FIX] sale_payment_deposit: remove unneeded code and fix sale portal template
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
'name': 'Sale Payment Deposit',
|
||||
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||
'category': 'Sales',
|
||||
'license': 'AGPL-3',
|
||||
'version': '15.0.1.0.0',
|
||||
'description':
|
||||
"""
|
||||
|
||||
@@ -31,19 +31,3 @@ class PaymentTransaction(models.Model):
|
||||
self.amount,
|
||||
)
|
||||
)
|
||||
|
||||
def render_sale_button(self, order, submit_txt=None, render_values=None):
|
||||
values = {
|
||||
'partner_id': order.partner_id.id,
|
||||
'type': self.type,
|
||||
}
|
||||
if render_values:
|
||||
values.update(render_values)
|
||||
# Not very elegant to do that here but no choice regarding the design.
|
||||
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.pricelist_id.currency_id.id,
|
||||
values=values,
|
||||
)
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<template id="sale_order_portal_template_deposit" name="Sales Order Portal Template - Deposit" inherit_id="sale.sale_order_portal_template">
|
||||
<!-- Set payment amount here rather than overriding the controller -->
|
||||
<xpath expr="//div[1]" position="before">
|
||||
<t t-if="sale_order.has_to_be_paid(True)">
|
||||
<t t-set="amount" t-value="sale_order.amount_total_deposit or amount"/>
|
||||
</t>
|
||||
</xpath>
|
||||
<!-- Display the Deposit amount prominently -->
|
||||
<xpath expr="//t[@t-set='title']/h2" position="replace">
|
||||
<h2 class="mb-0"><b t-field="sale_order.amount_total"/></h2>
|
||||
<xpath expr="//t[@t-set='title']/h2" position="after">
|
||||
<h5 t-if="sale_order.amount_total_deposit"><b t-field="sale_order.amount_total_deposit"/> Deposit</h5>
|
||||
</xpath>
|
||||
<!-- Display the Deposit and Total when Signing -->
|
||||
<xpath expr="//div[@id='modalaccept']/div/form/main/p/ul/li[2]" position="replace">
|
||||
<li><span>For an amount of:</span> <b data-id="total_amount" t-field="sale_order.amount_total"/></li>
|
||||
<xpath expr="//div[@id='modalaccept']/div/form/main/p/ul/li[2]" position="after">
|
||||
<li t-if="sale_order.amount_total_deposit"><span>Deposit today of:</span> <b data-id="total_amount_deposit" t-field="sale_order.amount_total_deposit"/></li>
|
||||
<li t-if="sale_order.payment_term_id.note.striptags()"><span t-field="sale_order.payment_term_id.note"/></li>
|
||||
</xpath>
|
||||
<!-- Display the Deposit when Paying -->
|
||||
<xpath expr="//div[@id='modalaccept']/div/div/main/p/ul/li[2]" position="replace">
|
||||
<li t-if="sale_order.amount_total_deposit"><span>For the deposit amount of:</span> <b data-id="total_amount_deposit" t-field="sale_order.amount_total_deposit"/></li>
|
||||
<li t-else=""><span>For an amount of:</span> <b data-id="total_amount" t-field="sale_order.amount_total"/></li>
|
||||
<li t-if="sale_order.payment_term_id.note.striptags()"><span t-field="sale_order.payment_term_id.note"/></li>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user