Merge lp:~openerp-dev/openobject-client-web/trunk-bug-729354-sma into lp:openobject-client-web/trunk

Proposed by Sananaz (Open ERP)
Status: Merged
Approved by: Xavier (Open ERP)
Approved revision: 4608
Merged at revision: 4612
Proposed branch: lp:~openerp-dev/openobject-client-web/trunk-bug-729354-sma
Merge into: lp:openobject-client-web/trunk
Diff against target: 18 lines (+6/-2)
1 file modified
addons/openerp/static/javascript/m2o.js (+6/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/trunk-bug-729354-sma
Reviewer Review Type Date Requested Status
OpenERP R&D Web Team Pending
Review via email: mp+52976@code.launchpad.net

Description of the change

Hello,

It create problem when click on m2o link (In non editable form view m2o value) when this field_name+'_text' is not there.
ex: go at Customer list view just click on row (open in non editable view)
> Click on country field value
> Gives traceback

Thanks.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/static/javascript/m2o.js'
2--- addons/openerp/static/javascript/m2o.js 2011-03-02 09:50:09 +0000
3+++ addons/openerp/static/javascript/m2o.js 2011-03-11 07:44:05 +0000
4@@ -183,8 +183,12 @@
5 * value of the m2o
6 */
7 ManyToOne.prototype.get_context = function () {
8- return jQuery(this.field).attr('context').replace(
9- /\bself\b/g, "'" + this.text.value + "'");
10+ if (jQuery(this.field).attr('context') != "{}" && this.text) {
11+ return jQuery(this.field).attr('context').replace(/\bself\b/g, "'" + this.text.value + "'");
12+ }
13+ else {
14+ return "{}";
15+ }
16 };
17
18 ManyToOne.prototype.on_change = function(evt) {