diff --git a/beesdoo_easy_my_coop/__openerp__.py b/beesdoo_easy_my_coop/__openerp__.py index 08abe57..1610526 100644 --- a/beesdoo_easy_my_coop/__openerp__.py +++ b/beesdoo_easy_my_coop/__openerp__.py @@ -16,7 +16,7 @@ # Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml # for the full list 'category': 'Cooperative management', - 'version': '9.0.1.1.2', + 'version': '9.0.1.1.3', # any module necessary for this one to work correctly 'depends': ['beesdoo_base', 'beesdoo_shift', 'easy_my_coop', 'easy_my_coop_eater'], @@ -32,4 +32,3 @@ 'auto_install': True, # only loaded in demonstration mode } - diff --git a/beesdoo_easy_my_coop/migrations/9.0.1.1.3/pre-migration.py b/beesdoo_easy_my_coop/migrations/9.0.1.1.3/pre-migration.py new file mode 100644 index 0000000..e47dc66 --- /dev/null +++ b/beesdoo_easy_my_coop/migrations/9.0.1.1.3/pre-migration.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- + +def migrate(cr, version): + if not version: + return + + cr.execute("UPDATE res_company " + "SET info_session_confirmation_required = FALSE " + "WHERE display_info_session_confirmation = FALSE") diff --git a/beesdoo_easy_my_coop/models/res_company.py b/beesdoo_easy_my_coop/models/res_company.py index bd1f360..38bfb96 100644 --- a/beesdoo_easy_my_coop/models/res_company.py +++ b/beesdoo_easy_my_coop/models/res_company.py @@ -25,3 +25,12 @@ class ResCompany(models.Model): def onchange_info_session_confirmatio_required(self): if self.info_session_confirmation_required: self.display_info_session_confirmation = True + + _sql_constraints = [( + 'info_session_approval_constraint', + """CHECK ((info_session_confirmation_required=FALSE + AND display_info_session_confirmation=FALSE) + OR display_info_session_confirmation=TRUE) + """, + "Approval can't be mandatory and not displayed." + )]