From f6b048213067ff60e9c5cf0a009595a8ea9904bc Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 15 Nov 2011 11:58:09 +0100 Subject: [PATCH] [FIX] add active_id, active_ids and active_model to context send when fetching m2o widget values in forms lp bug: https://launchpad.net/bugs/878189 fixed bzr revid: xmo@openerp.com-20111115105809-phttoirkmq4rzd1w --- addons/web/static/src/js/view_form.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 84041ef8b60..861d45dcb19 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -798,8 +798,13 @@ openerp.web.form.Widget = openerp.web.Widget.extend(/** @lends openerp.web.form. _build_view_fields_values: function() { var a_dataset = this.view.dataset; var fields_values = this.view.get_fields_values(); - var parent_values = a_dataset.parent_view ? a_dataset.parent_view.get_fields_values() : {}; - fields_values.parent = parent_values; + var active_id = a_dataset.ids[a_dataset.index]; + _.extend(fields_values, { + active_id: active_id || false, + active_ids: active_id ? [active_id] : [], + active_model: a_dataset.model, + parent: a_dataset.parent_view ? a_dataset.parent_view.get_fields_values() : {} + }); return fields_values; }, _build_eval_context: function() {