diff --git a/account_journal_lock_date/README.rst b/account_journal_lock_date/README.rst index e42aabb4..7b9b7b30 100644 --- a/account_journal_lock_date/README.rst +++ b/account_journal_lock_date/README.rst @@ -14,13 +14,13 @@ Account Journal Lock Date :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 + :target: https://github.com/OCA/account-financial-tools/tree/13.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 + :target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-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 + :target: https://runbot.odoo-community.org/runbot/92/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -73,7 +73,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -113,6 +113,6 @@ 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. +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 1a8c659d..a2a41e8e 100644 --- a/account_journal_lock_date/__manifest__.py +++ b/account_journal_lock_date/__manifest__.py @@ -5,11 +5,11 @@ "name": "Account Journal Lock Date", "summary": """ Lock each journal independently""", - "version": "12.0.2.0.0", + "version": "13.0.1.0.0", "license": "AGPL-3", - "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-financial-tools", - "depends": ["account",], + "depends": ["account"], "data": [ "views/account_journal.xml", "wizards/update_journal_lock_dates_views.xml", diff --git a/account_journal_lock_date/models/account_move.py b/account_journal_lock_date/models/account_move.py index 4bd457f5..622a0a35 100644 --- a/account_journal_lock_date/models/account_move.py +++ b/account_journal_lock_date/models/account_move.py @@ -3,7 +3,8 @@ from datetime import date -from odoo import _, api, models +from odoo import _, models +from odoo.tools.misc import format_date from ..exceptions import JournalLockDateError @@ -12,21 +13,13 @@ 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() + self._check_fiscalyear_lock_date() return res - def _check_lock_date(self): - res = super()._check_lock_date() + def _check_fiscalyear_lock_date(self): + res = super()._check_fiscalyear_lock_date() if self.env.context.get("bypass_journal_lock_date"): return res for move in self: @@ -38,6 +31,7 @@ class AccountMove(models.Model): move.journal_id.fiscalyear_lock_date or date.min, ) if move.date <= lock_date: + lock_date = format_date(self.env, lock_date) if self.user_has_groups("account.group_account_manager"): message = _( "You cannot add/modify entries for the journal '%s' " diff --git a/account_journal_lock_date/static/description/index.html b/account_journal_lock_date/static/description/index.html index d719f421..b5e4ece7 100644 --- a/account_journal_lock_date/static/description/index.html +++ b/account_journal_lock_date/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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, this module provides a ‘Lock Date’ and a ‘Lock Date for Non-Advisers’ per journal.

@@ -421,7 +421,7 @@ made as part of the wizard

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.

+feedback.

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

@@ -456,7 +456,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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.

+

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 800ca059..61044f91 100644 --- a/account_journal_lock_date/tests/test_journal_lock_date.py +++ b/account_journal_lock_date/tests/test_journal_lock_date.py @@ -31,11 +31,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("base.group_system"))],} - ) - self.env.user.write( - {"groups_id": [(3, self.ref("account.group_account_manager"))],} + {"groups_id": [(3, self.ref("account.group_account_manager"))]} ) self.assertFalse(self.env.user.has_group("account.group_account_manager")) @@ -138,7 +136,7 @@ class TestJournalLockDate(common.TransactionCase): def test_journal_lock_date_adviser(self): """ The journal lock date is ignored for Advisers """ self.env.user.write( - {"groups_id": [(4, self.ref("account.group_account_manager"))],} + {"groups_id": [(4, self.ref("account.group_account_manager"))]} ) self.assertTrue(self.env.user.has_group("account.group_account_manager")) # create a move and post it diff --git a/account_journal_lock_date/wizards/update_journal_lock_dates_views.xml b/account_journal_lock_date/wizards/update_journal_lock_dates_views.xml index f426f4c9..14bd20f9 100644 --- a/account_journal_lock_date/wizards/update_journal_lock_dates_views.xml +++ b/account_journal_lock_date/wizards/update_journal_lock_dates_views.xml @@ -30,12 +30,10 @@