Merge lp:~openerp-dev/openerp-web/trunk-imp-calendar-dragdrop-dka into lp:openerp-web

Proposed by Darshan Kalola(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/trunk-imp-calendar-dragdrop-dka
Merge into: lp:openerp-web
Diff against target: 177 lines (+76/-5)
3 files modified
addons/web/static/src/css/base.css (+5/-0)
addons/web/static/src/css/base.sass (+4/-0)
addons/web_calendar/static/src/js/web_calendar.js (+67/-5)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-imp-calendar-dragdrop-dka
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+206709@code.launchpad.net

Description of the change

 Hello,

    i have FIX the following points:
        1 -> if the SO/MO/PO is done, date field is readonly so we cannot change it. but dragging/dropping it in calendar view changes date value, it should not
        2 -> when the record's name field contains more values the breadcrumb is getting expanded, it should cut after 45Char length(approx when it reaches right edge of More button) with ...

Thanks,
Darshan

To post a comment you must log in.
3941. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3942. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk and resolve conflicts from web_calendar.

3943. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3944. By Darshan Kalola(OpenERP)

[IMP]calendar:process invisible modifier.

3945. By Darshan Kalola(OpenERP)

[IMP]improved code.

3946. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3947. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3948. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3949. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3950. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3951. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3952. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3953. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3954. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

Unmerged revisions

3954. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3953. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3952. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3951. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3950. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3949. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3948. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3947. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3946. By Darshan Kalola(OpenERP)

[MERGE]sync with trunk.

3945. By Darshan Kalola(OpenERP)

[IMP]improved code.

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-04-23 09:14:14 +0000
3+++ addons/web/static/src/css/base.css 2014-04-29 04:41:05 +0000
4@@ -1100,6 +1100,11 @@
5 white-space: nowrap;
6 text-overflow: ellipsis;
7 }
8+.openerp .oe_application .oe_breadcrumb_item:last-child {
9+ max-width: 20em;
10+ white-space: nowrap;
11+ text-overflow: ellipsis;
12+}
13 .openerp .oe_application .oe_breadcrumb_title > * {
14 display: inline-block;
15 overflow: hidden;
16
17=== modified file 'addons/web/static/src/css/base.sass'
18--- addons/web/static/src/css/base.sass 2014-04-23 09:14:14 +0000
19+++ addons/web/static/src/css/base.sass 2014-04-29 04:41:05 +0000
20@@ -932,6 +932,10 @@
21 max-width: 7em
22 white-space: nowrap
23 text-overflow: ellipsis
24+ .oe_breadcrumb_item:last-child
25+ max-width: 20em
26+ white-space: nowrap
27+ text-overflow: ellipsis
28 .oe_breadcrumb_title > *
29 display: inline-block
30 overflow: hidden
31
32=== modified file 'addons/web_calendar/static/src/js/web_calendar.js'
33--- addons/web_calendar/static/src/js/web_calendar.js 2014-04-16 15:15:43 +0000
34+++ addons/web_calendar/static/src/js/web_calendar.js 2014-04-29 04:41:05 +0000
35@@ -103,6 +103,8 @@
36 this.$calendar = this.$el.find(".oe_calendar_widget");
37
38 this.info_fields = [];
39+ this.field_modifiers = [];
40+ this.field_attrs_modifiers = [];
41
42 /* buttons */
43 this.$buttons = $(QWeb.render("CalendarView.buttons", {'widget': this}));
44@@ -211,6 +213,30 @@
45 for (var fld = 0; fld < fv.arch.children.length; fld++) {
46 this.info_fields.push(fv.arch.children[fld].attrs.name);
47 }
48+ _.each(this.fields_view.arch.children, function(node) {
49+ if (node.attrs) {
50+ modifier = JSON.parse(node.attrs.modifiers || '{}')
51+ if (modifier.invisible == true){
52+ _.each(self.info_fields, function (fieldname) {
53+ if(fieldname == node.attrs.name){
54+ self.info_fields.splice(self.info_fields.indexOf(fieldname), 1);
55+ }
56+ });
57+ }
58+ if (node.attrs.name == self.date_start)
59+ self.field_attrs_modifiers = modifier['readonly'];
60+ }
61+ });
62+ if (this.fields[this.date_start].states) {
63+ var states = [];
64+ var res = "";
65+ _.each (this.fields[this.date_start].states, function(modifier, state) {
66+ if (modifier[0][0] == "readonly")
67+ states.push(state);
68+ res = (modifier[0][1] == false) ? ['state', 'not in', states] : ['state', 'in', states];
69+ });
70+ this.field_modifiers.push(res);
71+ }
72
73 return (new instance.web.Model(this.dataset.model))
74 .call("check_access_rights", ["create", false])
75@@ -246,10 +272,12 @@
76
77 eventDrop: function (event, _day_delta, _minute_delta, _all_day, _revertFunc) {
78 var data = self.get_event_data(event);
79+ if (event.readonly == true) return _revertFunc();
80 self.proxy('update_record')(event._id, data); // we don't revert the event, but update it.
81 },
82 eventResize: function (event, _day_delta, _minute_delta, _revertFunc) {
83 var data = self.get_event_data(event);
84+ if (event.readonly == true) return _revertFunc();
85 self.proxy('update_record')(event._id, data);
86 },
87 eventRender: function (event, element, view) {
88@@ -490,18 +518,50 @@
89 });
90 return def;
91 },
92-
93+
94+ process_modifiers: function(evt, modifier){
95+ var compute_domain = instance.web.form.compute_domain;
96+ var result = {
97+ 'readonly':false,
98+ 'invisible': false,
99+ }
100+ var fields = [];
101+ _.each(evt, function(d, k){
102+ fields[k] = {'value': d};
103+ });
104+ if (this.field_attrs_modifiers.length) result['readonly'] = compute_domain(this.field_attrs_modifiers, fields);
105+ else if (this.field_modifiers.length) result['readonly'] = compute_domain(this.field_modifiers, fields);
106+ if (modifier) result['invisible'] = compute_domain(modifier, fields);
107+ return result;
108+ },
109+
110 /**
111 * Transform OpenERP event object to fullcalendar event object
112 */
113 event_data_transform: function(evt) {
114 var self = this;
115+ _.each(this.fields_view.arch.children, function(node) {
116+ if (node.attrs) {
117+ modifier = JSON.parse(node.attrs.modifiers || '{}')
118+ if (modifier.invisible instanceof Array){
119+ _.each(self.info_fields, function (fieldname) {
120+ if(fieldname == node.attrs.name){
121+ var result = self.process_modifiers(evt, modifier.invisible);
122+ if (result.invisible)
123+ evt[fieldname] = null;
124+ }
125+ });
126+ }
127+ }
128+ });
129+
130
131 var date_delay = evt[this.date_delay] || 1.0,
132 all_day = this.all_day ? evt[this.all_day] : false,
133 res_computed_text = '',
134 the_title = '',
135 attendees = [];
136+ readonly = self.process_modifiers(evt, false)['readonly'];
137
138 if (!all_day) {
139 date_start = instance.web.auto_str_to_date(evt[this.date_start]);
140@@ -518,7 +578,8 @@
141
142 _.each(this.info_fields, function (fieldname) {
143 var value = evt[fieldname];
144- if (_.contains(["many2one", "one2one"], self.fields[fieldname].type)) {
145+ if (value == null) return
146+ else if (_.contains(["many2one", "one2one"], self.fields[fieldname].type)) {
147 if (value === false) {
148 temp_ret[fieldname] = null;
149 }
150@@ -546,7 +607,7 @@
151 res_computed_text = res_computed_text.replace("["+fieldname+"]",temp_ret[fieldname]);
152 });
153
154-
155+
156 if (res_computed_text.length) {
157 the_title = res_computed_text;
158 }
159@@ -594,7 +655,7 @@
160 the_title = the_title_avatar + the_title;
161 }
162 }
163-
164+
165 if (!date_stop && date_delay) {
166 date_stop = date_start.clone().addHours(date_delay);
167 }
168@@ -604,7 +665,8 @@
169 'title': the_title,
170 'allDay': (this.fields[this.date_start].type == 'date' || (this.all_day && evt[this.all_day]) || false),
171 'id': evt.id,
172- 'attendees':attendees
173+ 'attendees':attendees,
174+ 'readonly': readonly,
175 };
176 if (!self.useContacts || self.all_filters[evt[this.color_field]] !== undefined) {
177 if (this.color_field && evt[this.color_field]) {