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

[17.0][FIX] account_payment_term_extension: Add selection options translatable #734

Open
wants to merge 2 commits into
base: 17.0
Choose a base branch
from
Open
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
22 changes: 11 additions & 11 deletions account_payment_term_extension/models/account_payment_term_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AccountPaymentTermLine(models.Model):
help="Sets the amount so that it is a multiple of this value.",
)
delay_type = fields.Selection(
selection=lambda self: self._get_delay_type(),
selection=lambda self: self._selection_delay_type(),
ondelete={
"weeks_after": "set default",
"weeks_after_end_of_month": "set default",
Expand All @@ -47,25 +47,25 @@ class AccountPaymentTermLine(models.Model):
"or spaces ( ).",
)

def _get_delay_type(self):
def _selection_delay_type(self):
delay_setting = self.env.company.payment_terms_delay_type
payment_terms_delay_type = delay_setting or False

delay_type = [
("days_after", "Days after invoice date"),
("days_after_end_of_month", "Days after end of month"),
("days_after_end_of_next_month", "Days after end of next month"),
("days_end_of_month_on_the", "Days end of month on the"),
("days_after", _("Days after invoice date")),
("days_after_end_of_month", _("Days after end of month")),
("days_after_end_of_next_month", _("Days after end of next month")),
("days_end_of_month_on_the", _("Days end of month on the")),
]

weeks_delay_type = [
("weeks_after", "Weeks after invoice date"),
("weeks_after_end_of_month", "Weeks after end of month"),
("weeks_after_end_of_next_month", "Weeks after end of next month"),
("weeks_after", _("Weeks after invoice date")),
("weeks_after_end_of_month", _("Weeks after end of month")),
("weeks_after_end_of_next_month", _("Weeks after end of next month")),
]
months_delay_type = [
("months_after", "Months after invoice date"),
("months_after_end_of_month", "Months after end of month"),
("months_after", _("Months after invoice date")),
("months_after_end_of_month", _("Months after end of month")),
]

if payment_terms_delay_type:
Expand Down
4 changes: 2 additions & 2 deletions account_payment_term_extension/views/account_payment_term.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<field name="model">account.payment.term</field>
<field name="inherit_id" ref="account.view_payment_term_form" />
<field name="arch" type="xml">
<field name="company_id" position="after">
<xpath expr="//group/field[@name='company_id']" position="after">
<field name="sequential_lines" />
</field>
</xpath>
<data>
<xpath expr="//sheet" position="inside">
<separator string="Holidays" col="12" />
Expand Down
Loading