[IMP] website_sale_aplicoop: Fix mandatory translation linting errors
- Added self.env._() translation to ValidationError in _check_company_groups - Added self.env._() translation to ValidationError in _check_dates - Replaced f-strings with .format() for proper lazy translation
This commit is contained in:
parent
8b0a402ccf
commit
5c89795e30
1 changed files with 11 additions and 3 deletions
|
|
@ -269,8 +269,14 @@ class GroupOrder(models.Model):
|
||||||
for group in record.group_ids:
|
for group in record.group_ids:
|
||||||
if group.company_id and group.company_id != record.company_id:
|
if group.company_id and group.company_id != record.company_id:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
f"Group {group.name} belongs to company "
|
self.env._(
|
||||||
f"{group.company_id.name}, not to {record.company_id.name}."
|
"Group {group} belongs to company {group_company}, "
|
||||||
|
"not to {record_company}."
|
||||||
|
).format(
|
||||||
|
group=group.name,
|
||||||
|
group_company=group.company_id.name,
|
||||||
|
record_company=record.company_id.name,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.constrains("start_date", "end_date")
|
@api.constrains("start_date", "end_date")
|
||||||
|
|
@ -278,7 +284,9 @@ class GroupOrder(models.Model):
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.start_date and record.end_date:
|
if record.start_date and record.end_date:
|
||||||
if record.start_date > record.end_date:
|
if record.start_date > record.end_date:
|
||||||
raise ValidationError("Start date cannot be greater than end date")
|
raise ValidationError(
|
||||||
|
self.env._("Start date cannot be greater than end date")
|
||||||
|
)
|
||||||
|
|
||||||
def action_open(self):
|
def action_open(self):
|
||||||
"""Open order for purchases."""
|
"""Open order for purchases."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue