2
0

[REF] Account Invoice Constraint Chronology: better messages

This commit is contained in:
Thomas Binsfeld 2019-02-25 10:26:06 +01:00 committed by Zina Rasoamanana
parent 25d91cda4e
commit 2571215d3d
2 changed files with 9 additions and 6 deletions

View File

@ -32,7 +32,7 @@ msgid ""
"and try again." "and try again."
msgstr "" msgstr ""
"Erreur de chronologie. Veuillez confirmer les anciennes factures brouillon " "Erreur de chronologie. Veuillez confirmer les anciennes factures brouillon "
"avant %set réessayer." "avant le {date_invoice} et réessayer."
#. module: account_invoice_constraint_chronology #. module: account_invoice_constraint_chronology
#: code:addons/account_invoice_constraint_chronology/model/account_invoice.py:66 #: code:addons/account_invoice_constraint_chronology/model/account_invoice.py:66
@ -42,7 +42,7 @@ msgid ""
"{date_invoice}." "{date_invoice}."
msgstr "" msgstr ""
"Erreur de chronologie. Il existe au moins une facture avec une date " "Erreur de chronologie. Il existe au moins une facture avec une date "
"ultérieure à %s." "ultérieure au {date_invoice}."
#. module: account_invoice_constraint_chronology #. module: account_invoice_constraint_chronology
#: model:ir.model,name:account_invoice_constraint_chronology.model_account_invoice #: model:ir.model,name:account_invoice_constraint_chronology.model_account_invoice

View File

@ -5,6 +5,7 @@ import datetime
from odoo import models, api, fields, _ from odoo import models, api, fields, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
from odoo.tools.misc import format_date
class AccountInvoice(models.Model): class AccountInvoice(models.Model):
@ -46,8 +47,9 @@ class AccountInvoice(models.Model):
month=inv.date_invoice.month, month=inv.date_invoice.month,
day=inv.date_invoice.day, day=inv.date_invoice.day,
) )
date_invoice_tz = fields.Date.context_today( date_invoice_tz = format_date(
self, date_invoice_format) self.env, fields.Date.context_today(
self, date_invoice_format))
raise UserError(_( raise UserError(_(
"Chronology Error. Please confirm older draft invoices " "Chronology Error. Please confirm older draft invoices "
"before {date_invoice} and try again.").format( "before {date_invoice} and try again.").format(
@ -61,8 +63,9 @@ class AccountInvoice(models.Model):
month=inv.date_invoice.month, month=inv.date_invoice.month,
day=inv.date_invoice.day, day=inv.date_invoice.day,
) )
date_invoice_tz = fields.Date.context_today( date_invoice_tz = format_date(
self, date_invoice_format) self.env, fields.Date.context_today(
self, date_invoice_format))
raise UserError(_( raise UserError(_(
"Chronology Error. There exist at least one invoice " "Chronology Error. There exist at least one invoice "
"with a later date to {date_invoice}.").format( "with a later date to {date_invoice}.").format(