[MIG] account_journal_lock_date: Migration to 16.0
This commit is contained in:
parent
7826f7b9fd
commit
0c5b530e84
@ -4,7 +4,7 @@
|
||||
{
|
||||
"name": "Account Journal Lock Date",
|
||||
"summary": "Lock each journal independently",
|
||||
"version": "15.0.1.0.1",
|
||||
"version": "16.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/account-financial-tools",
|
||||
|
@ -1,9 +1,7 @@
|
||||
# Copyright 2017 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from datetime import date
|
||||
|
||||
from odoo import _, models
|
||||
from odoo import _, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools.misc import format_date
|
||||
|
||||
@ -21,13 +19,15 @@ class AccountMove(models.Model):
|
||||
res = super()._check_fiscalyear_lock_date()
|
||||
if self.env.context.get("bypass_journal_lock_date"):
|
||||
return res
|
||||
|
||||
date_min = fields.date.min
|
||||
for move in self:
|
||||
if self.user_has_groups("account.group_account_manager"):
|
||||
lock_date = move.journal_id.fiscalyear_lock_date or date.min
|
||||
lock_date = move.journal_id.fiscalyear_lock_date or date_min
|
||||
else:
|
||||
lock_date = max(
|
||||
move.journal_id.period_lock_date or date.min,
|
||||
move.journal_id.fiscalyear_lock_date or date.min,
|
||||
move.journal_id.period_lock_date or date_min,
|
||||
move.journal_id.fiscalyear_lock_date or date_min,
|
||||
)
|
||||
if move.date <= lock_date:
|
||||
lock_date = format_date(self.env, lock_date)
|
||||
|
@ -9,3 +9,7 @@
|
||||
|
||||
* Pedro M. Baeza
|
||||
* Ernesto Tejeda
|
||||
|
||||
* `Factor Libre <https://www.factorlibre.com>`_:
|
||||
|
||||
* Rodrigo Bonilla Martinez <rodrigo.bonilla@factorlibre.com>
|
||||
|
Loading…
Reference in New Issue
Block a user