Skip to content

Commit

Permalink
[FIX] website_sale_payment_term_acquirer: Fixed behavior for public u…
Browse files Browse the repository at this point in the history
…ser.
  • Loading branch information
geomer198 committed Jul 16, 2023
1 parent 0b23513 commit 2a0f995
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
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

0 comments on commit 2a0f995

Please sign in to comment.