summaryrefslogtreecommitdiff
path: root/addons/account_lock
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-06-05 16:27:49 +0200
committerChristophe Simonis <chs@odoo.com>2018-06-05 16:27:49 +0200
commitaba8c2b8fbfb024652f0a080c657eb2369088eda (patch)
treebbb10ed85d2ae7f0bc1e77234fc1d24d9067de8d /addons/account_lock
parentfc5e61b63d1357f4c89e68e108de1ade21db724f (diff)
parent1b272a20504e16e0c170ea717f5bcf63d38e7cb5 (diff)
[MERGE] forward port branch 11.0 up to 1b272a20504
Diffstat (limited to 'addons/account_lock')
-rw-r--r--addons/account_lock/__init__.py3
-rw-r--r--addons/account_lock/__manifest__.py16
-rw-r--r--addons/account_lock/models/__init__.py3
-rw-r--r--addons/account_lock/models/res_company.py14
4 files changed, 36 insertions, 0 deletions
diff --git a/addons/account_lock/__init__.py b/addons/account_lock/__init__.py
new file mode 100644
index 00000000000..cde864bae21
--- /dev/null
+++ b/addons/account_lock/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import models
diff --git a/addons/account_lock/__manifest__.py b/addons/account_lock/__manifest__.py
new file mode 100644
index 00000000000..67e76b49098
--- /dev/null
+++ b/addons/account_lock/__manifest__.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+{
+ 'name' : 'Irreversible Lock Date',
+ 'version' : '1.0',
+ 'category': 'Accounting',
+ 'description': """
+ Make the lock date irreversible:
+
+ * You cannot define stricter conditions on advisors than on users. Then, the lock date on advisor must be set before the lock date for users.
+ * You cannot lock a period that is not finished yet. Then, the lock date for advisors must be set before the last day of the previous month.
+ * The new lock date for advisors must be set after the previous lock date.
+ """,
+ 'depends' : ['account'],
+ 'data': [],
+}
diff --git a/addons/account_lock/models/__init__.py b/addons/account_lock/models/__init__.py
new file mode 100644
index 00000000000..e759f74fc8d
--- /dev/null
+++ b/addons/account_lock/models/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import res_company
diff --git a/addons/account_lock/models/res_company.py b/addons/account_lock/models/res_company.py
new file mode 100644
index 00000000000..5a01046f36b
--- /dev/null
+++ b/addons/account_lock/models/res_company.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+
+from odoo import models, api
+
+
+class ResCompany(models.Model):
+ _inherit = 'res.company'
+
+ @api.multi
+ def write(self, vals):
+ # fiscalyear_lock_date can't be set to a prior date
+ if 'fiscalyear_lock_date' in vals or 'period_lock_date' in vals:
+ self._check_lock_dates(vals)
+ return super(ResCompany, self).write(vals)