Merge lp:~openerp-dev/openerp-web/saas-2-stages-fold-tde into lp:openerp-web

Proposed by Thibault Delavallée (OpenERP)
Status: Superseded
Proposed branch: lp:~openerp-dev/openerp-web/saas-2-stages-fold-tde
Merge into: lp:openerp-web
Diff against target: 96 lines (+32/-22)
2 files modified
addons/web/static/src/js/view_form.js (+26/-16)
addons/web/static/src/xml/base.xml (+6/-6)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/saas-2-stages-fold-tde
Reviewer Review Type Date Requested Status
OpenERP R&D Web Team Pending
Review via email: mp+191815@code.launchpad.net

This proposal has been superseded by a proposal from 2013-10-31.

Description of the change

[IMP] form_view: statusbar improvements
It now uses the bar_fold field instead of the fold field
to hide the stage.
It now uses bar_color to personnalize the stage.

Added css for oe_bar_1 (still WIP, just for testing purpose)

To post a comment you must log in.
3857. By Thibault Delavallée (OpenERP)

[REV] StatusField: reverted changes about bar widget color and thing slike that.

3858. By Thibault Delavallée (OpenERP)

[MERGE] Sync with saas-2 branch

3859. By Thibault Delavallée (OpenERP)

[MERGE] Sync with saas-2

3860. By Thibault Delavallée (OpenERP)

[IMP] view_form: fieldstatus: deprecated folded on widget

3861. By Thibault Delavallée (OpenERP)

[MERGE] Sync with saas-2 branch

3862. By Thibault Delavallée (OpenERP)

[REV] Reverted most changes, to lessen the number of
changed in a stable branch.

3863. By Thibault Delavallée (OpenERP)

[REV] view_form: statusbar widget: indentation issue + reverted some more changes

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/js/view_form.js'
2--- addons/web/static/src/js/view_form.js 2013-10-22 13:34:32 +0000
3+++ addons/web/static/src/js/view_form.js 2013-10-23 12:08:17 +0000
4@@ -5556,23 +5556,30 @@
5
6 var calculation = _.bind(function() {
7 if (this.field.type == "many2one") {
8- return self.get_distant_fields().then(function(fields) {
9- return new instance.web.DataSetSearch(self, self.field.relation, self.build_context(), self.get("evaluated_selection_domain"))
10- .read_slice(fields.fold ? ['fold'] : ['id'], {}).then(function (records) {
11-
12- var ids = _.map(records, function (val) {return val.id;});
13- return self.dataset.name_get(ids).then(function (records_name) {
14- _.each(records, function (record) {
15- var name = _.find(records_name, function (val) {return val[0] == record.id;})[1];
16- if (record.fold && record.id != self.get('value')) {
17- selection_folded.push([record.id, name]);
18- } else {
19- selection_unfolded.push([record.id, name]);
20- }
21- });
22+ /* :deprecated: fold feature will probably be removed */
23+ // return self.get_distant_fields().then(function(fields) {
24+ self.distant_fields = {};
25+ return new instance.web.DataSetSearch(self, self.field.relation, self.build_context(), self.get("evaluated_selection_domain"))
26+ .read_slice(_.union(_.keys(self.distant_fields), ['id']), {}).then(function (records) {
27+ var ids = _.pluck(records, 'id');
28+ return self.dataset.name_get(ids).then(function (records_name) {
29+ _.each(records, function (record) {
30+ var name = _.find(records_name, function (val) {return val[0] == record.id;})[1];
31+ var widget_item = {
32+ 'id': record.id,
33+ 'name': name,
34+ /* :deprecated: should probably be removed */
35+ 'bar_color': record.bar_color || 0,
36+ 'bar_fold': record.bar_fold || false,
37+ }
38+ if (record.bar_fold && record.id != self.get('value')) {
39+ selection_folded.push(widget_item);
40+ } else {
41+ selection_unfolded.push(widget_item);
42+ }
43 });
44 });
45- });
46+ });
47 } else {
48 // For field type selection filter values according to
49 // statusbar_visible attribute of the field. For example:
50@@ -5594,12 +5601,15 @@
51 }
52 });
53 },
54+ /*
55+ * :deprecated: this feature will probably be removed with OpenERP v8
56+ */
57 get_distant_fields: function() {
58 var self = this;
59 if (this.distant_fields) {
60 return $.when(this.distant_fields);
61 }
62- return new instance.web.Model(self.field.relation).call("fields_get", [["fold"]]).then(function(fields) {
63+ return new instance.web.Model(self.field.relation).call("fields_get", [["bar_fold", "bar_color"]]).then(function(fields) {
64 self.distant_fields = fields;
65 return fields;
66 });
67
68=== modified file 'addons/web/static/src/xml/base.xml'
69--- addons/web/static/src/xml/base.xml 2013-10-23 11:34:14 +0000
70+++ addons/web/static/src/xml/base.xml 2013-10-23 12:08:17 +0000
71@@ -1222,9 +1222,9 @@
72 <ul t-att-class="'oe_form_field_status ' + (widget.options.clickable ? 'oe_form_status_clickable' : 'oe_form_status')" t-att-style="widget.node.attrs.style"/>
73 </t>
74 <t t-name="FieldStatus.content">
75- <t t-foreach="widget.selection.unfolded" t-as="i">
76- <li t-att-class="i[0] === widget.get('value') ? 'oe_active' : ''" t-att-data-id="i[0]">
77- <span class="label"><t t-esc="i[1]"/></span>
78+ <t t-foreach="widget.selection.unfolded" t-as="item">
79+ <li t-attf-class="#{item.id === widget.get('value') and 'oe_active'}" t-att-data-id="item.id">
80+ <span class="label"><t t-esc="item.name"/></span>
81 <!-- are you mit ? -->
82 <span class="arrow"><span></span></span>
83 </li>
84@@ -1233,9 +1233,9 @@
85 <li>
86 <span class="label oe_dropdown_toggle oe_dropdown_arrow">More</span>
87 <ul class="oe_dropdown_menu">
88- <t t-foreach="widget.selection.folded" t-as="i">
89- <li t-att-class="i[0] === widget.get('value') ? 'oe_active' : ''" t-att-data-id="i[0]">
90- <span class="label"><t t-esc="i[1]"/></span>
91+ <t t-foreach="widget.selection.folded" t-as="item">
92+ <li t-att-class="item.id === widget.get('value') ? 'oe_active' : ''" t-att-data-id="item.id">
93+ <span class="label"><t t-esc="item.name"/></span>
94 </li>
95 </t>
96 </ul>