diff --git a/account_sale_invoice_date_required/README.rst b/account_sale_invoice_date_required/README.rst index f7d1569..55901c5 100644 --- a/account_sale_invoice_date_required/README.rst +++ b/account_sale_invoice_date_required/README.rst @@ -8,4 +8,13 @@ Summary This module triggers an error when posting a customer invoice that does not have an invoice date. -.. image:: static/description/invoice_date_required.png \ No newline at end of file +.. image:: static/description/invoice_date_required.png + + +Contributors +------------ +* Numigi (tm) and all its contributors (https://bit.ly/numigiens) + +More information +---------------- +* Meet us at https://bit.ly/numigi-com diff --git a/account_sale_invoice_date_required/__manifest__.py b/account_sale_invoice_date_required/__manifest__.py index 22936a3..6759449 100644 --- a/account_sale_invoice_date_required/__manifest__.py +++ b/account_sale_invoice_date_required/__manifest__.py @@ -2,8 +2,8 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "Account sale invoice date required", - "summary": "Raise an error posting customer invoice without invoice date.", + "name": "Account Sale Invoice Date Required", + "summary": "Raise an error when posting customer invoice without invoice date.", "version": "14.0.1.0.0", "website": "https://bit.ly/numigi-com", "author": "Numigi", diff --git a/account_sale_invoice_date_required/i18n/fr.po b/account_sale_invoice_date_required/i18n/fr.po index cf88a65..b3ceaee 100644 --- a/account_sale_invoice_date_required/i18n/fr.po +++ b/account_sale_invoice_date_required/i18n/fr.po @@ -38,5 +38,5 @@ msgstr "Dernière modification le" #. module: account_sale_invoice_date_required #: code:addons/account_sale_invoice_date_required/models/account_move.py:0 #, python-format -msgid "The invoice date is required to validate this document." -msgstr "La datede facturation est requise pour valider ce document." +msgid "The invoice/refund date is required to validate this document." +msgstr "La date de facturation/remboursement est requise pour valider ce document." diff --git a/account_sale_invoice_date_required/models/account_move.py b/account_sale_invoice_date_required/models/account_move.py index 217623b..954c9b4 100644 --- a/account_sale_invoice_date_required/models/account_move.py +++ b/account_sale_invoice_date_required/models/account_move.py @@ -3,7 +3,6 @@ from odoo import models, _ - from odoo.exceptions import UserError @@ -12,10 +11,8 @@ class AccountMove(models.Model): _inherit = 'account.move' def action_post(self): - if not self.invoice_date: - if self.is_sale_document(include_receipts=True): - raise UserError( - _("The invoice date is required to validate this document.") - ) - res = super(AccountMove, self).action_post() - return res + if self.is_sale_document(include_receipts=True) and not self.invoice_date: + raise UserError( + _("The invoice/refund date is required to validate this document.") + ) + return super(AccountMove, self).action_post()