Browse Source

[REF] translate user messages

pull/142/head
robin.keunen 5 years ago
parent
commit
c1b146826e
  1. 2
      beesdoo_product/models/beesdoo_product.py
  2. 8
      beesdoo_shift/models/task.py
  3. 2
      beesdoo_shift_attendance/models/attendance_sheet.py
  4. 8
      purchase_order_generator/models/purchase_order_generator.py

2
beesdoo_product/models/beesdoo_product.py

@ -169,7 +169,7 @@ class BeesdooProduct(models.Model):
elif len(taxes_included) > 1:
raise ValidationError(
"Several tax strategies (price_include) defined for %s"
_("Several tax strategies (price_include) defined for %s")
% self.name
)

8
beesdoo_shift/models/task.py

@ -105,8 +105,10 @@ class Task(models.Model):
task.is_regular or task.is_compensation
):
raise ValidationError(
"You must choose between Regular Shift or "
"Compensation Shift."
_(
"You must choose between Regular Shift or "
"Compensation Shift."
)
)
@api.constrains("state")
@ -142,7 +144,7 @@ class Task(models.Model):
task.write({"is_regular": False, "is_compensation": False})
if task.worker_id:
if task.worker_id == task.replaced_id:
raise UserError("A worker cannot replace himself.")
raise UserError(_("A worker cannot replace himself."))
def message_auto_subscribe(self, updated_fields, values=None):
self._add_follower(values)

2
beesdoo_shift_attendance/models/attendance_sheet.py

@ -461,7 +461,7 @@ class AttendanceSheet(models.Model):
def _validate(self, user):
self.ensure_one()
if self.state == "validated":
raise UserError("The sheet has already been validated.")
raise UserError(_("The sheet has already been validated."))
# Expected shifts status update
for expected_shift in self.expected_shift_ids:

8
purchase_order_generator/models/purchase_order_generator.py

@ -12,7 +12,7 @@ class PurchaseOrderGenerator(models.Model):
_name = "purchase.order.generator"
_order = "id desc"
name = fields.Char(string="POG Reference", default=_("New"))
name = fields.Char(string="POG Reference", default="New")
order_date = fields.Datetime(
string="Purchase Order Date",
default=fields.Datetime.now,
@ -60,12 +60,12 @@ class PurchaseOrderGenerator(models.Model):
suppliers = products.mapped("main_supplier_id")
if not suppliers:
raise ValidationError("No supplier is set for selected articles.")
raise ValidationError(_("No supplier is set for selected articles."))
elif len(suppliers) == 1:
return suppliers
else:
raise ValidationError(
"You must select article from a single supplier."
_("You must select article from a single supplier.")
)
@api.model
@ -108,7 +108,7 @@ class PurchaseOrderGenerator(models.Model):
if sum(self.pog_line_ids.mapped("purchase_quantity")) == 0:
raise ValidationError(
"You need at least a product to generate " "a Purchase Order"
_("You need at least a product to generate " "a Purchase Order")
)
purchase_order = self.env["purchase.order"].create(

Loading…
Cancel
Save