[MIG] account_journal_lock_date: Migration to 13.0
This commit is contained in:
parent
72086957e1
commit
c8ef6d7b6f
@ -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 <https://github.com/OCA/account-financial-tools/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 <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_journal_lock_date%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_journal_lock_date%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
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 <https://github.com/OCA/account-financial-tools/tree/12.0/account_journal_lock_date>`_ project on GitHub.
|
||||
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/13.0/account_journal_lock_date>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
@ -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",
|
||||
|
@ -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' "
|
||||
|
@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/12.0/account_journal_lock_date"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-12-0/account-financial-tools-12-0-account_journal_lock_date"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/92/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_journal_lock_date"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_journal_lock_date"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/92/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>Lock each accounting journal independently.</p>
|
||||
<p>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.</p>
|
||||
@ -421,7 +421,7 @@ made as part of the wizard</li>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_journal_lock_date%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_journal_lock_date%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@ -456,7 +456,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/12.0/account_journal_lock_date">OCA/account-financial-tools</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_journal_lock_date">OCA/account-financial-tools</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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
|
||||
|
@ -30,12 +30,10 @@
|
||||
<act_window
|
||||
id="update_journal_lock_dates_wizard_action"
|
||||
name="Update journals lock dates"
|
||||
src_model="account.journal"
|
||||
binding_model="account.journal"
|
||||
res_model="update.journal.lock.dates.wizard"
|
||||
view_type="form"
|
||||
view_mode="form"
|
||||
key2="client_action_multi"
|
||||
binding_views="form"
|
||||
target="new"
|
||||
multi="True"
|
||||
/>
|
||||
</odoo>
|
||||
|
Loading…
Reference in New Issue
Block a user