Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] website_sale_payment_term_acquirer #816

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion website_sale_payment_term_acquirer/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
from odoo import models
from odoo import api, models


class SaleOrder(models.Model):
_inherit = "sale.order"

@api.model
def get_payment_term_by_order_id(self, order_id):
"""Get property term by order id"""
return self.sudo().browse(order_id).partner_id.property_payment_term_id

def _create_payment_transaction(self, vals):
transactions = super()._create_payment_transaction(vals)
for transaction in transactions:
Expand Down
16 changes: 14 additions & 2 deletions website_sale_payment_term_acquirer/views/payment_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@
name="Payment Trace"
priority="100"
>
<form position="before">
<t
t-set="payment_term_id"
t-value="env['sale.order'].get_payment_term_by_order_id(order_id)"
/>
<t t-if="not payment_term_id">
<t
t-set="acquirers"
t-value="list(filter(lambda acq: not acq.display_main_payment_term, acquirers))"
/>
</t>
</form>
<span class="payment_option_name" position="replace">
<t
t-if="acq.display_main_payment_term"
t-esc="user_id.partner_id.property_payment_term_id.display_name"
t-if="acq.display_main_payment_term and payment_term_id"
t-esc="payment_term_id.display_name"
/>
<t t-else="" t-esc="acq.display_as or acq.name" />
<div
Expand Down
Loading