From 34ba66c6873c52c3d5af5bf3f21eb9fae059b57e Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 20 Oct 2017 13:31:52 +0200 Subject: [PATCH] [FIX] web_m2x_options: Compatibilize with web_advanced_search_x2x `web_m2x_options` is supposed to render fields in the context of a form or tree view, where domains can safely be applied because there's a main record that includes a context. However, when installing along with `web_advanced_search_x2x`, they produce an incompatibility when a x2x field's domain is defined and depends on the current record's context, because a search view has no notion of a *current record*. The fix is simple: try to do as usual, and if it fails, try without the field's domain. Without this patch, an exception like this would be raised, i.e. when both addons are installed and you are trying to search project tasks by stage: ``` Error: NameError: name 'project_id' is not defined http://localhost/web/static/lib/py.js/lib/py.js:370# Traceback:# Changes to be committed: PY_ensurepy@http://localhost/web/static/lib/py.js/lib/py.js:370:19# modified: static/src/js/form.js py.evaluate@http://localhost/web/static/lib/py.js/lib/py.js:1340:20# py.evaluate@http://localhost/web/static/lib/py.js/lib/py.js:1397:35 py.evaluate@http://localhost/web/static/lib/py.js/lib/py.js:1409:34 py.eval@http://localhost/web/static/lib/py.js/lib/py.js:1453:16 eval_domains/<@http://localhost/web/static/src/js/framework/pyeval.js:869:39 _.forEach@http://localhost/web/static/lib/underscore/underscore.js:145:9 _.mixin/