From 4501e3081d4744f78e3694ad4abf07bdbd4d59f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 28 Feb 2020 16:07:56 +0000 Subject: [PATCH] [FIX] hr_expense: set expense_extract_show_ocr_option_selection as not required Adding required fields on company model is annoying for tests. Indeed multi company tests may run during module installation, notably in CRM. Those tests generally require to create a new company which is not possible if the column is required but module not already loaded in registry. This is the case if for example hr_expense is installed and updating CRM. When possible, avoid required fields on a such used model as company. In this case we can easily consider a void value as 'no_send'. In this commit we simply make the field not required in database but set a required on the view itself to avoid confusion. That way behavior is still the same, existing databases are left untouched as all keys still exist and running tests is smoother. LINKS Follow up of odoo/odoo@4eeeb4f172c10f2a8e190fb9afcf440ddaaf5d34 and odoo/enterprise@be3cfc3babf0a642423e8a82f9919a65a46e9fa2 and odoo/enterprise@227da38f9a09199e4de5d4649bc1dd6fadfd1a0d . Task ID 2207180 Community PR odoo/odoo#46601 Enterprise PR odoo/enterprise#8903 closes odoo/odoo#46889 X-original-commit: 1c289d8692e0cdff25b08988994820af655cb289 Related: odoo/enterprise#9013 Signed-off-by: Thibault Delavallee (tde) --- addons/hr_expense/models/res_company.py | 2 +- addons/hr_expense/views/res_config_settings_views.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_expense/models/res_company.py b/addons/hr_expense/models/res_company.py index 7c2549f47bf..c7f91ae07e9 100644 --- a/addons/hr_expense/models/res_company.py +++ b/addons/hr_expense/models/res_company.py @@ -11,4 +11,4 @@ class ResCompany(models.Model): ('no_send', 'Do not digitalize bills'), ('manual_send', "Digitalize bills on demand only"), ('auto_send', 'Digitalize all bills automatically')], string="Send mode on expense attachments", - required=True, default='auto_send') + required=False, default='auto_send') diff --git a/addons/hr_expense/views/res_config_settings_views.xml b/addons/hr_expense/views/res_config_settings_views.xml index f85825a87b9..0660bf8cdd7 100644 --- a/addons/hr_expense/views/res_config_settings_views.xml +++ b/addons/hr_expense/views/res_config_settings_views.xml @@ -59,7 +59,7 @@ Digitalize your receipts with OCR and Artificial Intelligence
- +