mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[MIG]account_lock_to_date to v13
This commit is contained in:
committed by
Simone Rubino
parent
1eaa85a60f
commit
bb6e329fe6
@@ -14,13 +14,13 @@ Account Lock To 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_lock_to_date
|
||||
:target: https://github.com/OCA/account-financial-tools/tree/13.0/account_lock_to_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_lock_to_date
|
||||
:target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_lock_to_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|
|
||||
@@ -51,7 +51,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_lock_to_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_lock_to_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.
|
||||
|
||||
@@ -82,6 +82,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_lock_to_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_lock_to_date>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"name": "Account Lock To Date",
|
||||
"summary": """
|
||||
Allows to set an account lock date in the future.""",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "13.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/account-financial-tools",
|
||||
|
||||
@@ -1,30 +1,25 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_lock_to_date
|
||||
# * account_lock_to_date
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 11.0\n"
|
||||
"Project-Id-Version: Odoo Server 13.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: <>\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_lock_to_date
|
||||
#: model:ir.model,name:account_lock_to_date.model_account_move
|
||||
msgid "Account Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model,name:account_lock_to_date.model_account_update_lock_to_date
|
||||
msgid "Account Update Lock_to_date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.ui.view,arch_db:account_lock_to_date.account_update_lock_to_date_form_view
|
||||
#: model_terms:ir.ui.view,arch_db:account_lock_to_date.account_update_lock_to_date_form_view
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
@@ -34,97 +29,115 @@ msgid "Companies"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_company_id
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__company_id
|
||||
msgid "Company"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_create_uid
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__create_uid
|
||||
msgid "Created by"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_create_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__create_date
|
||||
msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_display_name
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_id
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date___last_update
|
||||
#: model:ir.model,name:account_lock_to_date.model_account_move
|
||||
msgid "Journal Entries"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_write_uid
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_write_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_fiscalyear_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_res_company_fiscalyear_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__fiscalyear_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_res_company__fiscalyear_lock_to_date
|
||||
msgid "Lock To Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date_period_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_res_company_period_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_account_update_lock_to_date__period_lock_to_date
|
||||
#: model:ir.model.fields,field_description:account_lock_to_date.field_res_company__period_lock_to_date
|
||||
msgid "Lock To Date for Non-Advisers"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,help:account_lock_to_date.field_account_update_lock_to_date_fiscalyear_lock_to_date
|
||||
msgid "No users, including Advisers, can edit accounts after and inclusive of this date. Use it for fiscal year locking for example."
|
||||
#: model:ir.model.fields,help:account_lock_to_date.field_account_update_lock_to_date__fiscalyear_lock_to_date
|
||||
msgid ""
|
||||
"No users, including Advisers, can edit accounts after and inclusive of this "
|
||||
"date. Use it for fiscal year locking for example."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,help:account_lock_to_date.field_res_company_fiscalyear_lock_to_date
|
||||
msgid "No users, including Advisers, can edit accounts after this date. Use it for fiscal year locking for example."
|
||||
#: model:ir.model.fields,help:account_lock_to_date.field_res_company__fiscalyear_lock_to_date
|
||||
msgid ""
|
||||
"No users, including Advisers, can edit accounts after this date. Use it for "
|
||||
"fiscal year locking for example."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,help:account_lock_to_date.field_account_update_lock_to_date_period_lock_to_date
|
||||
msgid "Only users with the 'Adviser' role can edit accounts after and inclusive of this date. Use it for period locking inside an open fiscal year, for example."
|
||||
#: model:ir.model.fields,help:account_lock_to_date.field_account_update_lock_to_date__period_lock_to_date
|
||||
msgid ""
|
||||
"Only users with the 'Adviser' role can edit accounts after and inclusive of "
|
||||
"this date. Use it for period locking inside an open fiscal year, for "
|
||||
"example."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.model.fields,help:account_lock_to_date.field_res_company_period_lock_to_date
|
||||
msgid "Only users with the 'Adviser' role can edit accounts after this date. Use it for period locking inside an open fiscal year, for example."
|
||||
#: model:ir.model.fields,help:account_lock_to_date.field_res_company__period_lock_to_date
|
||||
msgid ""
|
||||
"Only users with the 'Adviser' role can edit accounts after this date. Use it"
|
||||
" for period locking inside an open fiscal year, for example."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:63
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:0
|
||||
#, python-format
|
||||
msgid "The lock date for advisors is irreversible and can't be removed."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:71
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:0
|
||||
#, python-format
|
||||
msgid "The new lock to date for advisors must be set after the previous lock to date."
|
||||
msgid ""
|
||||
"The new lock to date for advisors must be set after the previous lock to "
|
||||
"date."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:117
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:0
|
||||
#, python-format
|
||||
msgid "There are still unposted entries in the period to date you want to lock. You should either post or delete them."
|
||||
msgid ""
|
||||
"There are still unposted entries in the period to date you want to lock. You"
|
||||
" should either post or delete them."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: model:ir.ui.view,arch_db:account_lock_to_date.account_update_lock_to_date_form_view
|
||||
#: model_terms:ir.ui.view,arch_db:account_lock_to_date.account_update_lock_to_date_form_view
|
||||
msgid "Update"
|
||||
msgstr ""
|
||||
|
||||
@@ -135,32 +148,38 @@ msgid "Update accounting lock to dates"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: code:addons/account_lock_to_date/wizards/account_update_lock_to_date.py:43
|
||||
#: code:addons/account_lock_to_date/wizards/account_update_lock_to_date.py:0
|
||||
#, python-format
|
||||
msgid "You are not allowed to execute this action."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: code:addons/account_lock_to_date/models/account_move.py:21
|
||||
#: code:addons/account_lock_to_date/models/account_move.py:0
|
||||
#, python-format
|
||||
msgid "You cannot add/modify entries after and inclusive of the lock to date %s"
|
||||
msgid ""
|
||||
"You cannot add/modify entries after and inclusive of the lock to date %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: code:addons/account_lock_to_date/models/account_move.py:25
|
||||
#: code:addons/account_lock_to_date/models/account_move.py:0
|
||||
#, python-format
|
||||
msgid "You cannot add/modify entries after and inclusive of the lock to date %s. Check the company settings or ask someone with the 'Adviser' role"
|
||||
msgid ""
|
||||
"You cannot add/modify entries after and inclusive of the lock to date %s. "
|
||||
"Check the company settings or ask someone with the 'Adviser' role"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:103
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:0
|
||||
#, python-format
|
||||
msgid "You cannot define stricter conditions on advisors than on users. Please make sure that the lock date on advisor is set after the lock date for users."
|
||||
msgid ""
|
||||
"You cannot define stricter conditions on advisors than on users. Please make"
|
||||
" sure that the lock date on advisor is set after the lock date for users."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_lock_to_date
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:85
|
||||
#: code:addons/account_lock_to_date/models/res_company.py:0
|
||||
#, python-format
|
||||
msgid "You cannot lock a period that is not finished yet. Please make sure that the lock date for advisors is not set after the last day of the previous month."
|
||||
msgid ""
|
||||
"You cannot lock a period that is not finished yet. Please make sure that the"
|
||||
" lock date for advisors is not set after the last day of the previous month."
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
# Copyright 2019 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import _, api, models
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
@api.multi
|
||||
def _check_lock_date(self):
|
||||
res = super()._check_lock_date()
|
||||
def _check_lock_to_dates(self):
|
||||
for move in self:
|
||||
lock_to_date = (
|
||||
min(
|
||||
@@ -34,4 +32,15 @@ class AccountMove(models.Model):
|
||||
"with the 'Adviser' role"
|
||||
) % (lock_to_date)
|
||||
raise UserError(message)
|
||||
return res
|
||||
|
||||
def action_post(self):
|
||||
self._check_lock_to_dates()
|
||||
return super().action_post()
|
||||
|
||||
def button_cancel(self):
|
||||
self._check_lock_to_dates()
|
||||
return super().button_cancel()
|
||||
|
||||
def button_draft(self):
|
||||
self._check_lock_to_dates()
|
||||
return super().button_draft()
|
||||
|
||||
@@ -7,7 +7,7 @@ from time import mktime
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import SUPERUSER_ID, _, api, fields, models
|
||||
from odoo import SUPERUSER_ID, _, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tools.misc import DEFAULT_SERVER_DATE_FORMAT
|
||||
|
||||
@@ -28,14 +28,12 @@ class ResCompany(models.Model):
|
||||
"this date. Use it for fiscal year locking for example.",
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
# fiscalyear_lock_date can't be set to a prior date
|
||||
if "fiscalyear_lock_to_date" in vals or "period_lock_to_date" in vals:
|
||||
self._check_lock_to_dates(vals)
|
||||
return super(ResCompany, self).write(vals)
|
||||
|
||||
@api.multi
|
||||
def _check_lock_to_dates(self, vals):
|
||||
"""Check the lock to dates for the current companies.
|
||||
|
||||
@@ -118,7 +116,6 @@ class ResCompany(models.Model):
|
||||
)
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def _validate_fiscalyear_lock(self, values):
|
||||
res = super()._validate_fiscalyear_lock(values)
|
||||
if values.get("fiscalyear_lock_to_date"):
|
||||
|
||||
@@ -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_lock_to_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_lock_to_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_lock_to_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_lock_to_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>This module allows to set a Period and Fiscal year Locking end dates. This
|
||||
will prevent users from posting journal entries on a date after the defined
|
||||
period or fiscal year end date.</p>
|
||||
@@ -397,7 +397,7 @@ journal entries on the date “Lock To Date” or after.</p>
|
||||
<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_lock_to_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_lock_to_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">
|
||||
@@ -425,7 +425,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_lock_to_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_lock_to_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>
|
||||
|
||||
@@ -14,9 +14,9 @@ class TestAccountLockToDateUpdate(TransactionCase):
|
||||
self.company = self.env.ref("base.main_company")
|
||||
self.demo_user = self.env.ref("base.user_demo")
|
||||
self.adviser_group = self.env.ref("account.group_account_manager")
|
||||
self.UpdateLockToDateUpdateObj = self.env["account.update.lock_to_date"].sudo(
|
||||
self.demo_user
|
||||
)
|
||||
self.UpdateLockToDateUpdateObj = self.env[
|
||||
"account.update.lock_to_date"
|
||||
].with_user(self.demo_user)
|
||||
self.AccountObj = self.env["account.account"]
|
||||
self.AccountJournalObj = self.env["account.journal"]
|
||||
self.AccountMoveObj = self.env["account.move"]
|
||||
@@ -89,7 +89,7 @@ class TestAccountLockToDateUpdate(TransactionCase):
|
||||
)
|
||||
self.demo_user.write({"groups_id": [(3, self.adviser_group.id)]})
|
||||
with self.assertRaises(UserError):
|
||||
wizard.sudo(self.demo_user.id).execute()
|
||||
wizard.with_user(self.demo_user.id).execute()
|
||||
|
||||
def test_02_update_with_access(self):
|
||||
wizard = self.create_account_lock_date_update()
|
||||
@@ -100,7 +100,7 @@ class TestAccountLockToDateUpdate(TransactionCase):
|
||||
}
|
||||
)
|
||||
self.demo_user.write({"groups_id": [(4, self.adviser_group.id)]})
|
||||
wizard.sudo(self.demo_user.id).execute()
|
||||
wizard.with_user(self.demo_user.id).execute()
|
||||
self.assertEqual(
|
||||
self.company.period_lock_to_date,
|
||||
datetime.strptime("2900-01-01", DEFAULT_SERVER_DATE_FORMAT).date(),
|
||||
@@ -117,7 +117,7 @@ class TestAccountLockToDateUpdate(TransactionCase):
|
||||
self.company.fiscalyear_lock_to_date = "2900-02-01"
|
||||
move = self.create_account_move("2900-01-01")
|
||||
with self.assertRaises(UserError):
|
||||
move.sudo(self.demo_user.id).post()
|
||||
move.with_user(self.demo_user.id).action_post()
|
||||
|
||||
def test_04_create_move_inside_period(self):
|
||||
"""We test that we can successfully create a journal entry
|
||||
@@ -125,7 +125,7 @@ class TestAccountLockToDateUpdate(TransactionCase):
|
||||
self.company.period_lock_to_date = "2900-01-01"
|
||||
self.company.fiscalyear_lock_to_date = "2900-02-01"
|
||||
move = self.create_account_move("2800-01-01")
|
||||
move.sudo(self.demo_user.id).post()
|
||||
move.with_user(self.demo_user.id).action_post()
|
||||
self.assertEqual(move.state, "posted")
|
||||
|
||||
def test_05_lock_period_with_draft_moves(self):
|
||||
|
||||
@@ -41,14 +41,12 @@ class AccountUpdateLockToDate(models.TransientModel):
|
||||
)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def _check_execute_allowed(self):
|
||||
self.ensure_one()
|
||||
has_adviser_group = self.env.user.has_group("account.group_account_manager")
|
||||
if not (has_adviser_group or self.env.uid == SUPERUSER_ID):
|
||||
raise UserError(_("You are not allowed to execute this action."))
|
||||
|
||||
@api.multi
|
||||
def execute(self):
|
||||
self.ensure_one()
|
||||
self._check_execute_allowed()
|
||||
|
||||
@@ -1,44 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- # Copyright 2019 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).-->
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="account_update_lock_to_date_form_view">
|
||||
<field name="name">account.update.lock_to_date.form</field>
|
||||
<field name="model">account.update.lock_to_date</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header/>
|
||||
<header />
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="company_id" options="{'no_create': True}"
|
||||
groups="base.group_multi_company"/>
|
||||
<field name="period_lock_to_date"/>
|
||||
<field name="fiscalyear_lock_to_date"/>
|
||||
<field
|
||||
name="company_id"
|
||||
options="{'no_create': True}"
|
||||
groups="base.group_multi_company"
|
||||
/>
|
||||
<field name="period_lock_to_date" />
|
||||
<field name="fiscalyear_lock_to_date" />
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button string="Update" name="execute" type="object" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-default" special="cancel"/>
|
||||
<button
|
||||
string="Update"
|
||||
name="execute"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
/>
|
||||
<button string="Cancel" class="btn-default" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="account_update_lock_to_date_act_window">
|
||||
<field name="name">Update accounting lock to dates</field>
|
||||
<field name="res_model">account.update.lock_to_date</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.menu" id="account_update_lock_to_date_menu">
|
||||
<field name="name">Update accounting lock to dates</field>
|
||||
<field name="parent_id" ref="account.menu_finance_entries_actions"/>
|
||||
<field name="action" ref="account_update_lock_to_date_act_window"/>
|
||||
<field name="groups_id" eval="[(6, 0, [ref('account.group_account_manager')])]"/>
|
||||
<field name="sequence" eval="70"/>
|
||||
<field name="parent_id" ref="account.menu_finance_entries_actions" />
|
||||
<field name="action" ref="account_update_lock_to_date_act_window" />
|
||||
<field
|
||||
name="groups_id"
|
||||
eval="[(6, 0, [ref('account.group_account_manager')])]"
|
||||
/>
|
||||
<field name="sequence" eval="70" />
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user