-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TA#67540 [ADD] account_sale_invoice_date_required (#213)
* TA#67540 [ADD] account_sale_invoice_date_required --------- Co-authored-by: majouda <[email protected]>
- Loading branch information
Showing
12 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Account sale invoice date required | ||
============================ | ||
|
||
.. contents:: Table of Contents | ||
|
||
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 | ||
|
||
|
||
Contributors | ||
------------ | ||
* Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
|
||
More information | ||
---------------- | ||
* Meet us at https://bit.ly/numigi-com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"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", | ||
"maintainer": "Numigi", | ||
"license": "AGPL-3", | ||
"depends": ["account"], | ||
"installable": True | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_sale_invoice_date_required | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-08-29 12:04+0000\n" | ||
"PO-Revision-Date: 2024-08-29 12:04+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_sale_invoice_date_required | ||
#: model:ir.model.fields,field_description:account_sale_invoice_date_required.field_account_move__display_name | ||
msgid "Display Name" | ||
msgstr "Nom d'affichage" | ||
|
||
#. module: account_sale_invoice_date_required | ||
#: model:ir.model.fields,field_description:account_sale_invoice_date_required.field_account_move__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: account_sale_invoice_date_required | ||
#: model:ir.model,name:account_sale_invoice_date_required.model_account_move | ||
msgid "Journal Entry" | ||
msgstr "Pièce comptable" | ||
|
||
#. module: account_sale_invoice_date_required | ||
#: model:ir.model.fields,field_description:account_sale_invoice_date_required.field_account_move____last_update | ||
msgid "Last Modified on" | ||
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/refund date is required to validate this document." | ||
msgstr "La date de facturation/remboursement est requise pour valider ce document." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import account_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
from odoo import models, _ | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class AccountMove(models.Model): | ||
|
||
_inherit = 'account.move' | ||
|
||
def action_post(self): | ||
for move in self: | ||
if move.is_sale_document(include_receipts=True) and not move.invoice_date: | ||
raise UserError( | ||
_("The invoice/refund date is required to validate this document.") | ||
) | ||
return super(AccountMove, self).action_post() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+79.9 KB
account_sale_invoice_date_required/static/description/invoice_date_required.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import test_account_move |
35 changes: 35 additions & 0 deletions
35
account_sale_invoice_date_required/tests/test_account_move.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.tests.common import TransactionCase | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class TestAccountMove(TransactionCase): | ||
|
||
def setUp(self): | ||
super(TestAccountMove, self).setUp() | ||
self.partner = self.env['res.partner'].create({ | ||
'name': 'Test Customer', | ||
}) | ||
self.invoice = self.env['account.move'].create([ | ||
{ | ||
'move_type': 'out_invoice', | ||
'date': '2017-01-01', | ||
'invoice_date': '2017-01-01', | ||
'partner_id': self.partner.id, | ||
'invoice_line_ids': [ | ||
(0, 0, {'name': 'aaaa', 'price_unit': 100.0}) | ||
], | ||
} | ||
]) | ||
|
||
def test_invoice_without_date(self): | ||
self.invoice.invoice_date = False | ||
with self.assertRaises(UserError): | ||
self.invoice.action_post() | ||
|
||
def test_invoice_with_date(self): | ||
self.invoice.invoice_date = '2023-08-01' | ||
self.invoice.action_post() | ||
self.assertEqual(self.invoice.state, 'posted') |