diff --git a/.docker_files/main/__manifest__.py b/.docker_files/main/__manifest__.py index 84e10da3..aa10bafa 100644 --- a/.docker_files/main/__manifest__.py +++ b/.docker_files/main/__manifest__.py @@ -61,7 +61,7 @@ "old_accounts", "payment_list_not_sent", "payment_stripe_not_silenced", - "account_sale_invoice_date_required" + # "account_sale_invoice_date_required" ], "installable": True, } diff --git a/.docker_files/test-requirements.txt b/.docker_files/test-requirements.txt index bb169387..9608304d 100644 --- a/.docker_files/test-requirements.txt +++ b/.docker_files/test-requirements.txt @@ -1,2 +1,3 @@ freezegun==0.3.4 ddt==1.4.2 +pytest-odoo==2.1.1 diff --git a/Dockerfile b/Dockerfile index 83d3c81c..d02f5fac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ COPY account_payment_term_usage_sale /mnt/extra-addons/account_payment_term_usag COPY account_payment_widget_link /mnt/extra-addons/account_payment_widget_link COPY account_report_line_menu /mnt/extra-addons/account_report_line_menu COPY account_report_trial_balance /mnt/extra-addons/account_report_trial_balance -COPY account_sale_invoice_date_required /mnt/extra-addons/account_sale_invoice_date_required +#COPY account_sale_invoice_date_required /mnt/extra-addons/account_sale_invoice_date_required COPY account_search_by_amount /mnt/extra-addons/account_search_by_amount COPY account_show_full_features /mnt/extra-addons/account_show_full_features COPY account_type_archive /mnt/extra-addons/account_type_archive diff --git a/account_check_deposit_enhanced/models/account_check_deposit.py b/account_check_deposit_enhanced/models/account_check_deposit.py index ac93dd22..df36ec74 100644 --- a/account_check_deposit_enhanced/models/account_check_deposit.py +++ b/account_check_deposit_enhanced/models/account_check_deposit.py @@ -6,9 +6,9 @@ class AccountCheckDeposit(models.Model): _inherit = "account.check.deposit" - - @api.model - def _prepare_counterpart_move_lines_vals(self, *args, **kwargs): - vals = super()._prepare_counterpart_move_lines_vals(*args, **kwargs) - vals["partner_id"] = self.company_id.partner_id.id + + def _prepare_move_vals(self): + vals = super()._prepare_move_vals() + for line in vals["line_ids"]: + line["partner_id"] = self.company_id.partner_id.id return vals diff --git a/account_check_deposit_enhanced/tests/test_account_check_deposit.py b/account_check_deposit_enhanced/tests/test_account_check_deposit.py index f1c43603..42c85c24 100644 --- a/account_check_deposit_enhanced/tests/test_account_check_deposit.py +++ b/account_check_deposit_enhanced/tests/test_account_check_deposit.py @@ -17,12 +17,14 @@ def setUpClass(cls): "code": "210110", "reconcile": True, "user_type_id": cls.env.ref("account.data_account_type_payable").id, + "company_id": cls.main_company.id, } ) cls.partner = cls.env["res.partner"].create( { "name": "Partner", "property_account_payable_id": cls.payable.id, + "company_id": cls.main_company.id, } ) @@ -31,6 +33,7 @@ def setUpClass(cls): "name": "Check Journal", "type": "bank", "code": "CH", + "company_id": cls.main_company.id, } ) cls.bank_journal = cls.env["account.journal"].create( @@ -38,6 +41,7 @@ def setUpClass(cls): "name": "Bank Journal", "type": "bank", "code": "BNK", + "company_id": cls.main_company.id, } ) cls.payment = cls.env["account.payment"].create( @@ -70,7 +74,7 @@ def setUpClass(cls): def test_debit_move_line_has_company(self): self.deposit.validate_deposit() - debit = self.deposit.line_ids.filtered(lambda l: l.debit) + debit = self.deposit.move_id.line_ids.filtered(lambda l: l.debit) assert debit.partner_id == self.env.user.company_id.partner_id - credit = self.deposit.line_ids.filtered(lambda l: l.credit) + credit = self.deposit.move_id.line_ids.filtered(lambda l: l.credit) assert credit.partner_id == self.partner diff --git a/account_sale_invoice_date_required/README.rst b/account_sale_invoice_date_required/README.rst deleted file mode 100644 index 55901c5f..00000000 --- a/account_sale_invoice_date_required/README.rst +++ /dev/null @@ -1,20 +0,0 @@ -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 diff --git a/account_sale_invoice_date_required/__init__.py b/account_sale_invoice_date_required/__init__.py deleted file mode 100644 index d4039356..00000000 --- a/account_sale_invoice_date_required/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# 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 diff --git a/account_sale_invoice_date_required/__manifest__.py b/account_sale_invoice_date_required/__manifest__.py deleted file mode 100644 index 67594496..00000000 --- a/account_sale_invoice_date_required/__manifest__.py +++ /dev/null @@ -1,14 +0,0 @@ -# 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 -} diff --git a/account_sale_invoice_date_required/i18n/fr.po b/account_sale_invoice_date_required/i18n/fr.po deleted file mode 100644 index b3ceaee8..00000000 --- a/account_sale_invoice_date_required/i18n/fr.po +++ /dev/null @@ -1,42 +0,0 @@ -# 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." diff --git a/account_sale_invoice_date_required/models/__init__.py b/account_sale_invoice_date_required/models/__init__.py deleted file mode 100644 index df011060..00000000 --- a/account_sale_invoice_date_required/models/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# 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 diff --git a/account_sale_invoice_date_required/models/account_move.py b/account_sale_invoice_date_required/models/account_move.py deleted file mode 100644 index 0e2a57cf..00000000 --- a/account_sale_invoice_date_required/models/account_move.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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() diff --git a/account_sale_invoice_date_required/static/description/icon.png b/account_sale_invoice_date_required/static/description/icon.png deleted file mode 100644 index 92a86b10..00000000 Binary files a/account_sale_invoice_date_required/static/description/icon.png and /dev/null differ diff --git a/account_sale_invoice_date_required/static/description/invoice_date_required.png b/account_sale_invoice_date_required/static/description/invoice_date_required.png deleted file mode 100644 index b4aa26e3..00000000 Binary files a/account_sale_invoice_date_required/static/description/invoice_date_required.png and /dev/null differ diff --git a/account_sale_invoice_date_required/tests/__init__.py b/account_sale_invoice_date_required/tests/__init__.py deleted file mode 100644 index 193bdf9c..00000000 --- a/account_sale_invoice_date_required/tests/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# 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 diff --git a/account_sale_invoice_date_required/tests/test_account_move.py b/account_sale_invoice_date_required/tests/test_account_move.py deleted file mode 100644 index a957872e..00000000 --- a/account_sale_invoice_date_required/tests/test_account_move.py +++ /dev/null @@ -1,35 +0,0 @@ -# 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')