diff --git a/account_lock_date_update/README.rst b/account_lock_date_update/README.rst index 05cb77a6e..d968297b2 100644 --- a/account_lock_date_update/README.rst +++ b/account_lock_date_update/README.rst @@ -6,7 +6,7 @@ Account Lock Date Update ======================== -Allow an Account adviser to update locking date without having +Allow an Account adviser to update lock dates without having access to all technical settings. Installation @@ -24,8 +24,8 @@ Usage To use this module, you need to be an account adviser and go to: -* Accounting -> Configuration -> Accounting -> Update accounting lock dates -* Change values and click on update button +* Accounting -> Configuration -> Accounting -> Lock Dates +* Change values and click on *Update* button .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot diff --git a/account_lock_date_update/__manifest__.py b/account_lock_date_update/__manifest__.py index 8499968b7..8b9806c91 100644 --- a/account_lock_date_update/__manifest__.py +++ b/account_lock_date_update/__manifest__.py @@ -5,9 +5,9 @@ { 'name': 'Account Lock Date Update', 'summary': """ - Allow an Account adviser to update locking date without having + Allow an Account adviser to update lock dates without having access to all technical settings""", - 'version': '10.0.1.0.0', + 'version': '10.0.1.0.1', 'license': 'AGPL-3', 'author': 'ACSONE SA/NV, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/account-financial-tools', diff --git a/account_lock_date_update/wizards/account_update_lock_date.py b/account_lock_date_update/wizards/account_update_lock_date.py index 6f5aa9901..22886a6ea 100644 --- a/account_lock_date_update/wizards/account_update_lock_date.py +++ b/account_lock_date_update/wizards/account_update_lock_date.py @@ -7,7 +7,6 @@ from odoo.exceptions import UserError class AccountUpdateLockDate(models.TransientModel): - _name = 'account.update.lock_date' _description = 'Account Update Lock_date' @@ -35,7 +34,6 @@ class AccountUpdateLockDate(models.TransientModel): }) return res - @api.multi def _check_execute_allowed(self): self.ensure_one() has_adviser_group = self.env.user.has_group( @@ -43,11 +41,15 @@ class AccountUpdateLockDate(models.TransientModel): 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() - self.company_id.sudo().write({ + vals = { 'period_lock_date': self.period_lock_date, 'fiscalyear_lock_date': self.fiscalyear_lock_date, - }) + } + if ( + self.period_lock_date and self.fiscalyear_lock_date and + self.period_lock_date < self.fiscalyear_lock_date): + vals['period_lock_date'] = self.fiscalyear_lock_date + self.company_id.sudo().write(vals) diff --git a/account_lock_date_update/wizards/account_update_lock_date.xml b/account_lock_date_update/wizards/account_update_lock_date.xml index 48caff625..2697f8ef9 100644 --- a/account_lock_date_update/wizards/account_update_lock_date.xml +++ b/account_lock_date_update/wizards/account_update_lock_date.xml @@ -9,14 +9,11 @@ account.update.lock_date
-
- - - - - - - + + + + +