From e95ccf0908c263f6cf23c91c477a8e252e936ff1 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 5 Feb 2020 10:34:51 +0000 Subject: [PATCH] [FIX] *: domains should not have as many binary operator as there are terms * modify client-side domain normalisation to error if the domain is invalid (not enough terms / segments for the number of operators) * add better error reporting to attrs / modifiers parsing * add a few layered error augmentation to provide clearer context e.g. "error: invalid domain " is helpful but "error while parsing modifiers for field foo: modifier invisible: invalid domain " is much more helpful * rework _evalModifiers to deduplicate it in order to more easily implement this contextual augmentation * test that improper domains are properly found improper * fix a bunch of incorrect attrs domains * also removed an apparently undefined (& unused) "options" argument to a _applyModifiers call closes odoo/odoo#44642 Related: odoo/enterprise#8175 Signed-off-by: Xavier Morel (xmo) --- addons/account/views/account_move_views.xml | 4 +-- addons/account/views/account_view.xml | 4 +-- addons/hr/views/res_users.xml | 2 +- .../hr_attendance/views/hr_employee_view.xml | 2 +- .../mail/wizard/mail_compose_message_view.xml | 2 +- addons/stock/views/product_views.xml | 2 +- addons/web/static/src/js/core/domain.js | 7 ++++ .../static/src/js/views/basic/basic_model.js | 36 +++++++++---------- .../src/js/views/basic/basic_renderer.js | 13 +++++-- addons/web/static/tests/core/domain_tests.js | 21 +++++++++++ 10 files changed, 63 insertions(+), 30 deletions(-) diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 7d5116f93fc..47321ee5ad0 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -634,7 +634,7 @@ placeholder="Terms" attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/> or + attrs="{'invisible': [ '|', '|', ('state', '!=', 'draft'), ('invoice_payment_term_id', '!=', False), ('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"> or @@ -1024,7 +1024,7 @@
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 77592e57e53..78e01b03510 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -612,12 +612,12 @@ action = model.setting_init_bank_account_action()