diff --git a/account_journal_lock_date/README.rst b/account_journal_lock_date/README.rst index 0f0d5bb59..36d49d33b 100644 --- a/account_journal_lock_date/README.rst +++ b/account_journal_lock_date/README.rst @@ -1,11 +1,30 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ========================= Account Journal Lock Date ========================= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github + :target: https://github.com/OCA/account-financial-tools/tree/12.0/account_journal_lock_date + :alt: OCA/account-financial-tools +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-financial-tools-12-0/account-financial-tools-12-0-account_journal_lock_date + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/92/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + Lock each accounting journal independently. In addition to the lock dates provided by standard Odoo and @@ -19,17 +38,10 @@ Note: the journal lock date is ignored for users that are part of the Adviser group. This rule can be adapted by overriding method `_can_bypass_journal_lock_date` of `account.journal`. -Usage -===== +**Table of contents** -To use this module, you need to set - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} - -.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt -.. branch is "8.0" for example +.. contents:: + :local: Known issues / Roadmap ====================== @@ -41,35 +53,48 @@ Known issues / Roadmap Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* ACSONE SA/NV Contributors ------------- +~~~~~~~~~~~~ -* Stéphane Bidoul +* `Akretion `_: -Maintainer ----------- + * Benoît GUILLOT + * Chafique DELLI + * Alexis de Lattre + * Mourad EL HADJ MIMOUNE + +* `Tecnativa `_: + + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/account-financial-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_journal_lock_date/__manifest__.py b/account_journal_lock_date/__manifest__.py index fe491dc75..eb18a363f 100644 --- a/account_journal_lock_date/__manifest__.py +++ b/account_journal_lock_date/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -6,12 +5,12 @@ 'name': 'Account Journal Lock Date', 'summary': """ Lock each journal independently""", - 'version': '10.0.1.0.0', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', - 'website': 'https://acsone.eu/', + 'website': 'https://github.com/OCA/account-financial-tools', 'depends': [ - 'account_permanent_lock_move', + 'account', ], 'data': [ 'views/account_journal.xml', diff --git a/account_journal_lock_date/models/account_journal.py b/account_journal_lock_date/models/account_journal.py index 134f231ba..bd1cc7393 100644 --- a/account_journal_lock_date/models/account_journal.py +++ b/account_journal_lock_date/models/account_journal.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/account_journal_lock_date/models/account_move.py b/account_journal_lock_date/models/account_move.py index 1aaaaee5b..634b9763b 100644 --- a/account_journal_lock_date/models/account_move.py +++ b/account_journal_lock_date/models/account_move.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -11,6 +10,19 @@ class AccountMove(models.Model): _inherit = 'account.move' + @api.model + def create(self, values): + move = super().create(values) + move._check_lock_date() + return move + + @api.multi + def write(self, values): + self._check_lock_date() + res = super().write(values) + self._check_lock_date() + return res + @api.multi def _check_lock_date(self): res = super(AccountMove, self)._check_lock_date() diff --git a/account_journal_lock_date/readme/CONTRIBUTORS.rst b/account_journal_lock_date/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..21d67b3a9 --- /dev/null +++ b/account_journal_lock_date/readme/CONTRIBUTORS.rst @@ -0,0 +1,10 @@ +* `Akretion `_: + + * Benoît GUILLOT + * Chafique DELLI + * Alexis de Lattre + * Mourad EL HADJ MIMOUNE + +* `Tecnativa `_: + + * Pedro M. Baeza diff --git a/account_journal_lock_date/readme/DESCRIPTION.rst b/account_journal_lock_date/readme/DESCRIPTION.rst new file mode 100644 index 000000000..aa9ab76f5 --- /dev/null +++ b/account_journal_lock_date/readme/DESCRIPTION.rst @@ -0,0 +1,12 @@ +Lock each accounting journal independently. + +In addition to the lock dates provided by standard Odoo and +account_permanent_lock_move, provide a per journal lock date. + +Note: this module depends on account_permanent_lock_move because it +implements stricter checks than standard Odoo, such as verifying that +one cannot create draft moves before the lock date. + +Note: the journal lock date is ignored for users that are part of +the Adviser group. This rule can be adapted by overriding method +`_can_bypass_journal_lock_date` of `account.journal`. diff --git a/account_journal_lock_date/readme/ROADMAP.rst b/account_journal_lock_date/readme/ROADMAP.rst new file mode 100644 index 000000000..6b1f5ba3b --- /dev/null +++ b/account_journal_lock_date/readme/ROADMAP.rst @@ -0,0 +1,3 @@ +* a wizard to set the lock date on several journals could be nice to have +* the module does not check that all moves prior the lock date are posted, this could be + made as part of the wizard \ No newline at end of file diff --git a/account_journal_lock_date/static/description/index.html b/account_journal_lock_date/static/description/index.html new file mode 100644 index 000000000..edd7d2421 --- /dev/null +++ b/account_journal_lock_date/static/description/index.html @@ -0,0 +1,446 @@ + + + + + + +Account Journal Lock Date + + + +
+

Account Journal Lock Date

+ + +

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runbot

+

Lock each accounting journal independently.

+

In addition to the lock dates provided by standard Odoo and +account_permanent_lock_move, provide a per journal lock date.

+

Note: this module depends on account_permanent_lock_move because it +implements stricter checks than standard Odoo, such as verifying that +one cannot create draft moves before the lock date.

+

Note: the journal lock date is ignored for users that are part of +the Adviser group. This rule can be adapted by overriding method +_can_bypass_journal_lock_date of account.journal.

+

Table of contents

+ +
+

Known issues / Roadmap

+
    +
  • a wizard to set the lock date on several journals could be nice to have
  • +
  • the module does not check that all moves prior the lock date are posted, this could be +made as part of the wizard
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/account-financial-tools project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_journal_lock_date/tests/test_journal_lock_date.py b/account_journal_lock_date/tests/test_journal_lock_date.py index 7b1d1bd4b..741a99103 100644 --- a/account_journal_lock_date/tests/test_journal_lock_date.py +++ b/account_journal_lock_date/tests/test_journal_lock_date.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -29,6 +28,9 @@ class TestJournalLockDate(common.TransactionCase): self.journal = self.browse_ref("account.bank_journal") def test_journal_lock_date(self): + self.env.user.write({ + 'groups_id': [(3, self.ref('base.group_system'))], + }) self.env.user.write({ 'groups_id': [(3, self.ref('account.group_account_manager'))], }) @@ -73,10 +75,12 @@ class TestJournalLockDate(common.TransactionCase): with self.assertRaises(JournalLockDateError): move.write({'name': 'TEST'}) + # allow cancel posted move + self.journal.update_posted = True with self.assertRaises(JournalLockDateError): move.button_cancel() - # create a move after ther lock date and post it + # create a move after the lock date and post it tomorrow = date.today() + timedelta(days=1) move3 = self.account_move_obj.create({ 'date': tomorrow,