summaryrefslogtreecommitdiff
path: root/addons/account_lock
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-06-04 18:06:44 +0200
committerChristophe Simonis <chs@odoo.com>2018-06-04 18:06:44 +0200
commit97d611fcd40681ff43c78e405089d6bb6c472874 (patch)
tree43ce5467498d9f35ce3de801c6f50fcd64a1ac59 /addons/account_lock
parent57a64bbc8686d96d97015e5fb0c14aa427286114 (diff)
parent66a60c70f313496c7998e385bd214590d05234d5 (diff)
[MERGE] forward port branch 9.0 up to 66a60c70f31
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)