From 815169d5c65470d108c4621fe376a66bcb6c14fd Mon Sep 17 00:00:00 2001 From: Elouan Le Bars Date: Tue, 5 Nov 2019 18:25:17 +0100 Subject: [PATCH] [FIX] Mandatory field not displayed Mandatory configuration approval field must be displayed now. Same modifications as in f406155d5c7250b773a70ec7b8b4d6dd6bdd3da7 --- beesdoo_easy_my_coop/__openerp__.py | 3 +-- .../migrations/9.0.1.1.3/pre-migration.py | 9 +++++++++ beesdoo_easy_my_coop/models/res_company.py | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 beesdoo_easy_my_coop/migrations/9.0.1.1.3/pre-migration.py 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." + )]