[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@4eeeb4f172 and odoo/enterprise@be3cfc3bab
and odoo/enterprise@227da38f9a .

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) <tde@openerp.com>
This commit is contained in:
Thibault Delavallée
2020-03-04 13:47:45 +00:00
parent 4e14151465
commit 4501e3081d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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')
@@ -59,7 +59,7 @@
Digitalize your receipts with OCR and Artificial Intelligence
</div>
<div class="mt16" attrs="{'invisible': [('module_hr_expense_extract', '=', False)]}">
<field name="expense_extract_show_ocr_option_selection" class="o_light_label" widget="radio"/>
<field name="expense_extract_show_ocr_option_selection" class="o_light_label" widget="radio" required="True"/>
</div>
</div>
</div>