Merge lp:~openerp-dev/openerp-web/7.0-opw-601553-xal into lp:openerp-web/7.0

Proposed by Xavier ALT
Status: Merged
Merged at revision: 4111
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-601553-xal
Merge into: lp:openerp-web/7.0
Diff against target: 67 lines (+21/-1)
3 files modified
addons/web/static/src/css/base.css (+3/-0)
addons/web/static/src/css/base.sass (+2/-0)
addons/web/static/src/js/view_list.js (+16/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-601553-xal
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Approve
Review via email: mp+201583@code.launchpad.net

Description of the change

Hi,

This MP fix fields.reference in editable tree view.

For example, try to change tree view of "System / Technical / Parameters / Configuration Parameters" to editable, it's was not possible change "Resource" (res_id) field (missing original value, selection field not visible, ...)

Regards,
Xavier

To post a comment you must log in.
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Thanks for the patch, LGTM, I have just removed the left console.log and merged it in 7.0

revno: 4111 [merge]
revision-id: <email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/css/base.css'
2--- addons/web/static/src/css/base.css 2014-01-03 09:44:15 +0000
3+++ addons/web/static/src/css/base.css 2014-01-14 12:48:18 +0000
4@@ -2850,6 +2850,9 @@
5 .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master {
6 width: 100% !important;
7 }
8+.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_reference {
9+ display: table;
10+}
11 .openerp .oe_list_group_name {
12 white-space: nowrap;
13 }
14
15=== modified file 'addons/web/static/src/css/base.sass'
16--- addons/web/static/src/css/base.sass 2014-01-03 09:44:15 +0000
17+++ addons/web/static/src/css/base.sass 2014-01-14 12:48:18 +0000
18@@ -2243,6 +2243,8 @@
19 &.oe_form_field_datetime,&.oe_form_field_date
20 input.oe_datepicker_master
21 width: 100% !important
22+ &.oe_form_field_reference
23+ display: table
24 .oe_list_group_name
25 white-space: nowrap
26 // }}}
27
28=== modified file 'addons/web/static/src/js/view_list.js'
29--- addons/web/static/src/js/view_list.js 2013-12-11 11:33:30 +0000
30+++ addons/web/static/src/js/view_list.js 2014-01-14 12:48:18 +0000
31@@ -1022,7 +1022,7 @@
32 id = parseInt(ref_match[2], 10);
33 new instance.web.DataSet(this.view, model).name_get([id]).done(function(names) {
34 if (!names.length) { return; }
35- record.set(column.id, names[0][1]);
36+ record.set(column.id + '__display', names[0][1]);
37 });
38 }
39 } else if (column.type === 'many2one') {
40@@ -2095,6 +2095,7 @@
41 'field.handle': 'instance.web.list.Handle',
42 'button': 'instance.web.list.Button',
43 'field.many2onebutton': 'instance.web.list.Many2OneButton',
44+ 'field.reference': 'instance.web.list.Reference',
45 'field.many2many': 'instance.web.list.Many2Many'
46 });
47 instance.web.list.columns.for_ = function (id, field, node) {
48@@ -2307,5 +2308,19 @@
49 return this._super(row_data, options);
50 }
51 });
52+instance.web.list.Reference = instance.web.list.Column.extend({
53+ _format: function (row_data, options) {
54+ if (!_.isEmpty(row_data[this.id].value)) {
55+ // If value, use __display version for printing
56+ //console.log('_format', row_data[this.id], row_data[this.id + '__display']);
57+ if (!!row_data[this.id + '__display']) {
58+ row_data[this.id] = row_data[this.id + '__display'];
59+ } else {
60+ row_data[this.id] = {'value': ''};
61+ }
62+ }
63+ return this._super(row_data, options);
64+ }
65+});
66 };
67 // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: