Merge lp:~openerp-dev/openerp-web/6.1-opw-574224-msh into lp:openerp-web/6.1

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/6.1-opw-574224-msh
Merge into: lp:openerp-web/6.1
Diff against target: 129 lines (+37/-7)
4 files modified
addons/web/static/src/js/chrome.js (+20/-5)
addons/web/static/src/js/views.js (+9/-0)
addons/web/static/src/xml/base.xml (+2/-2)
addons/web_process/static/src/js/process.js (+6/-0)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/6.1-opw-574224-msh
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Needs Fixing
Mohammed Shekha(Open ERP) (community) Needs Resubmitting
Review via email: mp+105957@code.launchpad.net

Description of the change

Hello,

Improved the notification message, when record is unsaved which was not working when user clicks on home, company logo, menu, switch view and on process view button.

Hence checked whether form is dirty or not using can_be_discarded method on each of above event so that it can show the notification about the record changed.

Thanks.

To post a comment you must log in.
2322. By Fabien Meghazi (OpenERP)

[FIX] Problems with statusbar widget under IE8

2323. By Xavier (Open ERP)

[MERGE] missing translation mark in import error dialogs

2324. By Xavier (Open ERP)

[MERGE] fix for form field translation dialog's button label translations

2325. By Fabien Meghazi (OpenERP)

[FIX] Set name when uploading an image is broken on 6.1

2326. By Fabien Meghazi (OpenERP)

[FIX] when dialog is resized, the content pane should reflect the new height too

2327. By Xavier (Open ERP)

[FIX] context and domain of an action being added to a dashboard

* The action's context and domain are needed because they are
  explicitly ignored by those codepaths when the action is ultimately
  executed in the dashboard, and their data are needed: such flags as
  group_by_no_leaf may be set in the action's context, or things like
  the leads/opportunities filters which need to remain in the
  dashboard view.

* On the other hand, some keys in the action's context may be
  detrimental to the correct behavior of the action in the dashboard,
  one such key (group) is the search_default_*: these default values
  for the search view may have been unset by the user before adding to
  the dashboard, we must not add them back. And since the dashboard
  will instantiate a full action/view manager for each action there
  will be (empty) search views which will try to make use of those
  defaults.

As a result, add the action's context and domain to those of the
research while *creating* the dashboard action/section, *but* filter
out search_default_* context keys while doing so.

If new problematic context keys are discovered, they should be added
to the filter.

2328. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2329. By Xavier (Open ERP)

[FIX] correctly save group_by context key when saving a search to a dashboard

2330. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2331. By Xavier (Open ERP)

[FIX] issue with handling of list view priorities in dashboard

dashboard would select the default list view (id=false) instead of the asked/needed one, breaking the application of filters

2332. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2333. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2334. By Olivier Dony (Odoo)

[FIX] data_import: allow importing m2o via name_search() on top of their XML ID

We do default to exporting the XML ID, but there are
many cases where completely new data needs to be
imported and there is no XML ID available to do so.
In that case allowing name_search() to be used as in
6.0 is a life-saver. This patch simply makes the
m2o field itself visible during import, so users can
use it in their CSV file or manually select it.

Some trivial examples:
- you need to import 2000 new leads with their countries,
  obviously you can't guess that base.be should be used
  for country Belgium
- you need to update 2000 unassigned leads in the system
  and assign them to some of the salemen... but you don't
  have their XML IDs and even if you had, the match is
  quite hard to do.

2335. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2336. By Christophe Simonis (OpenERP)

[FIX] web: correct jsonp behavior when len(payload) >= 2000

2337. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2338. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2339. By Xavier (Open ERP)

[FIX] handling of empty lines in CSV file being imported (ignore them)

2340. By Xavier (Open ERP)

[FIX] handling of get_selection in listview in case of non-selectable lists (e.g. editable o2ms?)

OPW 572764

2341. By Xavier (Open ERP)

[FIX] reloading of o2m forms in dialogs (popups) after clicking on a button

2342. By Xavier (Open ERP)

[FIX] handling of empty domains, context and view_id in action descriptors

* Some literal actions (not stored) provide an empty string for
  domains and contexts instead of (respectively) an empty array or an
  empty dict literal inside the string. Treat those case as nothing
  being provided.
* Likewise some literal actions provide nonsensical (but falsy, but
  not False) values for view_id (such as an empty list). Yield a
  ``False`` view_id for all falsy ``view_id`` received (``0`` should
  not be a valid view_id, so ``False`` works)

2343. By Xavier (Open ERP)

[IMP] performances when opening an m2o "search" without any filtering term

Don't prefilter via name_search if no data has been entered in the m2o
field, it's going to return all records (not paginated) so it's a
waste of time and resources

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

* Use event delegation, it is cheaper than eagerly finding objects if they are never used
* Correctly declare variable, in `on_logout`, `inner_viewmanager` is not declared and will create a global. Same in "on_home" and "on_company_logo"
* Fix indentation, it is wrong and inconsistent
* on_home and on_company_logo are exact same function, why?
* Click events on link (like home and company logo) have default behavior which can be prevented[0], this allows links to remain links instead of be unneeded javascript crap everywhere, please use this.
* Also please ensure button from middle click works correctly (I am pretty sure it just can not work with this patch)
* Extract testing of view being discardable into dedicated method, exact same thing is written 4 times (and 2 more with variation for process and view)

[0] http://api.jquery.com/event.preventDefault/

review: Needs Fixing
2344. By Xavier (Open ERP)

[FIX] incorrect handling of 'None of the following condition must match' advanced search combinator

Introduced during 'simple style fixes' (sic) of rev <email address hidden>

2345. By Olivier Dony (Odoo)

[MERGE] OPW 574895: fix incorrect matching of column headers when importing CSV files

- required fields may sometimes be provided by alternative columns,
  and all the alternatives are therefore not required (e.g. for
  a m2o the CSV can provide m2o or m2o/id columns)
- when fields share the same label, precedence when matching
  column headers should be given to the field with the exact
  same name, rather than just the first one encountered

2346. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2347. By Xavier (Open ERP)

[IMP] formatting of o2m and m2m fields in list views, courtesy of William Beltrán

backported from trunk revision <email address hidden>

2348. By Xavier (Open ERP)

[FIX] re-display [Add Pad] button after removing the pad from a document

2349. By Xavier (Open ERP)

[IMP] display clean error dialog when user tries to create a database which already exists

2350. By Xavier (Open ERP)

[FIX] Error while deleting a record when there is only one record in pageview

2351. By Xavier (Open ERP)

[ADD] handling of required attr on m2m fields

2352. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2353. By Xavier (Open ERP)

[FIX] mis-handling of url actions in sidebar

2354. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2355. By Fabien Meghazi (OpenERP)

[FIX] Fixed http header Content-Disposition for non-ascii filenames

2356. By Fabien Meghazi (OpenERP)

[FIX] In form view, <image> tag is not a binary image but an <img>

2357. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2358. By Olivier Dony (Odoo)

[FIX] base.xml: missing base URL for <img src> and <form action>, for embeddded mode

2359. By Olivier Dony (Odoo)

[MERGE] Missing tab title made multi-tab use of OpenERP quite difficult - now fixed.

2360. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2361. By Fabien Meghazi (OpenERP)

[REV] Revert revid:<email address hidden> which broke field@widget=image

2362. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2363. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2364. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2365. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2366. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2367. By Xavier (Open ERP)

[FIX] actually clear basic textual fields in search view when [Clear] button used, don't just reset to default value

2368. By Xavier (Open ERP)

[MERGE] vertically flipped x axis labels in MSIE

2369. By Xavier (Open ERP)

[FIX] incorrect clearing of default values on selection fields in search view

and simplification of the same on basic fields

2370. By Xavier (Open ERP)

[MERGE] move filtering of non-searchable fields to prune the fields list itself

if only the *display* list is filtered, the advanced search engine may
still attempt to *select* a non-searchable field (if it's the first
one) leading to broken/nonsensical behavior.

Non-searchable fields should be removed from the advanced search's
ability to find them altogether.

2371. By Xavier (Open ERP)

[MERGE] ensure exception information is correctly converted to string before being concatenated with the faultCode string (sic) of emulated XMLRPC faults

2372. By Xavier (Open ERP)

[IMP] simplify localconnector's exception converter: use Python's facilities correctly

2373. By Xavier (Open ERP)

[MERGE] visual effects fix on diagram nodes in firefox

2374. By Xavier (Open ERP)

[MERGE] behavioral fixes and changes to editable list o2ms

* Correctly propagate current validation status of row being edited
* Automatically save row being edited upon leaving it
* Replace "Save" button (floppy) by "Cancel" (cross)
* Allow easier overriding of Groups and List sub-widgets

2375. By Xavier (Open ERP)

[FIX] action buttons activated in editable o2m lists during or after row edition

2376. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2377. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2378. By Xavier ALT

[MERGE] OPW 573621: web_calendar: fix localisation of calendar view

   backport of trunk <email address hidden>

2379. By Xavier (Open ERP)

[FIX] server action not returning anything should be treated as an empty action descriptor

2380. By Xavier (Open ERP)

[FIX] action-type button from a list row being edited in an o2m

Issue 575065

Flow for a button[@type=action] requires going through multiple RPC
calls to execute action. Due to reloading behavior of o2m-list on
actions (saves containing form then executes action then reloads row),
internal form view gets removed while e.g. server action is being
fetched (in Views#do_execute_action).

Problem: there is guard on ``rpc`` call which drops response to
stopped widget (Widget#rpc) => action/load call never returns
successfully because linked form is dead.

Solution: instead of calling View#do_execute_action via the formview,
call it via the listview (do_execute_action was already partially
overridden to change the ``on_close`` callback, override it further).

=> widget still lives, and rpc requests execute correctly leading to
all actions being correctly called (mostly).

2381. By Xavier (Open ERP)

[FIX] Add new operator case to advanced search: field is set or is not set

2382. By Xavier (Open ERP)

[FIX] missing comma in CSS leading to incorrect selectors

2383. By Xavier (Open ERP)

[FIX] correctly pass along options in ProxyDataSet#write calls

2384. By Xavier (Open ERP)

[FIX] remove custom error handling on saving kanban records

hides actual error (which may be e.g. validation error) and adds no value

2385. By Xavier (Open ERP)

[FIX] make datepicker and timepicker translatable

2386. By Xavier (Open ERP)

[IMP] export translatable strings

2387. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2388. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2389. By Olivier Dony (Odoo)

[FIX] OPW 575804: web_gantt: hide internal dhtmlx duration for tasks/phases, as it is misleading

The `duration` used by the dhtmlx gantt component
corresponds to the calendar duration of the event
divided by 3. This makes sense only for events
spanning full days, and for working times
with 8 hours per day. Unfortunately these
hypotheses do not hold for most cases inside
OpenERP, so we should hide this information.
The actual duration of the items can always
been viewed by clicking on the corresponding
label.

2390. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2391. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2392. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2393. By Xavier (Open ERP)

[ADD] crash manager to embedded client, otherwise RPC errors get silently supressed

2394. By Xavier (Open ERP)

[IMP] make embedded client crash manager configurable

2395. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2396. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2397. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2398. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2399. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2400. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2401. By Xavier (Open ERP)

[FIX] m2o-in-list-o2m focus issues introduced in o2m-autosave

issue revid: <email address hidden>

2402. By Xavier (Open ERP)

[IMP] missing translation marks in form and view editor

2403. By Xavier (Open ERP)

[FIX] dynamic addition of options in select in IE8, for export screen

2404. By Xavier (Open ERP)

[MERGE] manual reimplementation of progress bar for better cross-platform consistency and usability

html5 progress bar can not show progress in letters, so much less precision

2405. By Xavier (Open ERP)

[IMP] automatically close m2o autocomplete list inside dialog if dialog is dragged or resized

avoids autocomplete list being out of sync (positionally) with related m2o dialog

2406. By Xavier (Open ERP)

[TRANSLATIONS] new extraction after addition of new translation marks

2407. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2408. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2409. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2410. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2411. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2412. By Xavier (Open ERP)

[FIX] handling of focus/blur in date fields in relation to o2m autosave

2413. By Xavier (Open ERP)

[FIX] Ensure static file URLs are actually URLs, not windows file paths

2414. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

2415. By Mohammed Shekha(Open ERP)

[FIX]Refixed the issue of notification, created separate function for check view discaradable, changed indentation, changed declaration, remove duplicated function.

Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello,

Changed the code according to above comment.

Thanks.

review: Needs Resubmitting
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Fix is incomplete, is not using event delegation and actual links (so can't open new openerp instance by middle-clicking on logo).

And there are semicolons missing at end of lines

Also,

    if(this.active_view == 'form' && !this.views['form'].controller.can_be_discarded()){
        return false;
    }
    return true;

can be reduced to:

    return this.active_view !== 'form' || this.views['form'].controller.can_be_discarded();

unless I am mistaken.

And why does `on_company_home_logo` return false when not discardable, but does not return anything when discardable? Not coherent behavior. Should probably return nothing in either case.

Also, code along lines of:

    var inner_viewmanager = this.action_manager.inner_viewmanager
    if(inner_viewmanager && !inner_viewmanager.check_view_discardable()){
        do something
    }

is used 3 different times, maybe there should be utility method on WebClient to check if current view is discardable directly no?

review: Needs Fixing

Unmerged revisions

2415. By Mohammed Shekha(Open ERP)

[FIX]Refixed the issue of notification, created separate function for check view discaradable, changed indentation, changed declaration, remove duplicated function.

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/chrome.js'
2--- addons/web/static/src/js/chrome.js 2012-07-05 10:27:24 +0000
3+++ addons/web/static/src/js/chrome.js 2012-07-24 06:22:19 +0000
4@@ -659,6 +659,8 @@
5 return func(self.session.uid, ["name", "company_id"]).pipe(function(res) {
6 self.$content = $(QWeb.render("Header-content", {widget: self, user: res}));
7 self.$content.appendTo(self.$element);
8+ self.$element.find(".home").click(self.on_company_home_logo);
9+ self.$element.find(".company_logo_link").click(self.on_company_home_logo);
10 self.$element.find(".logout").click(self.on_logout);
11 self.$element.find("a.preferences").click(self.on_preferences);
12 self.$element.find(".about").click(self.on_about);
13@@ -667,6 +669,14 @@
14 };
15 this.update_promise = this.update_promise.pipe(fct, fct);
16 },
17+ on_company_home_logo: function(ev){
18+ ev.preventDefault();
19+ var inner_viewmanager = this.widget_parent.action_manager.inner_viewmanager
20+ if(inner_viewmanager && !inner_viewmanager.check_view_discardable()){
21+ return false;
22+ }
23+ window.location.href = "/" + this.qs
24+ },
25 on_about: function() {
26 var self = this;
27 self.rpc("/web/webclient/version_info", {}).then(function(res) {
28@@ -725,11 +735,7 @@
29 e.stopPropagation();
30 var id = $(this).data('id');
31 self.session.active_id = id;
32- self.rpc('/web/menu/action', {'menu_id':id}, function(ir_menu_data) {
33- if (ir_menu_data.action.length){
34- self.on_action(ir_menu_data.action[0][2]);
35- }
36- });
37+ self.widget_parent.menu.on_menu_click(e,id)
38 });
39 });
40 },
41@@ -903,6 +909,11 @@
42 'div[data-menu-parent=' + $primary_menu.data('menu') + ']').addClass('active').toggle(!this.folded);
43 },
44 on_menu_click: function(ev, id) {
45+
46+ var inner_viewmanager = this.widget_parent.action_manager.inner_viewmanager;
47+ if(inner_viewmanager && !inner_viewmanager.check_view_discardable()){
48+ return false;
49+ }
50 id = id || 0;
51 var $clicked_menu, manual = false;
52
53@@ -1150,6 +1161,10 @@
54 },
55 on_logout: function() {
56 var self = this;
57+ var inner_viewmanager = this.action_manager.inner_viewmanager
58+ if(inner_viewmanager && !inner_viewmanager.check_view_discardable()){
59+ return false;
60+ }
61 this.session.session_logout().then(function () {
62 $(window).unbind('hashchange', self.on_hashchange);
63 self.do_push_state({});
64
65=== modified file 'addons/web/static/src/js/views.js'
66--- addons/web/static/src/js/views.js 2012-06-29 10:53:25 +0000
67+++ addons/web/static/src/js/views.js 2012-07-24 06:22:19 +0000
68@@ -260,6 +260,9 @@
69 this._super();
70 var self = this;
71 this.$element.find('.oe_vm_switch button').click(function() {
72+ if(!self.check_view_discardable()){
73+ return $.Deferred().reject();
74+ }
75 self.on_mode_switch($(this).data('view-type'));
76 });
77 var views_ids = {};
78@@ -447,6 +450,12 @@
79 return view.controller.fields_view.arch.attrs.string;
80 }
81 return '';
82+ },
83+ check_view_discardable: function() {
84+ if(this.active_view == 'form' && !this.views['form'].controller.can_be_discarded()){
85+ return false;
86+ }
87+ return true;
88 }
89 });
90
91
92=== modified file 'addons/web/static/src/xml/base.xml'
93--- addons/web/static/src/xml/base.xml 2012-07-03 14:02:51 +0000
94+++ addons/web/static/src/xml/base.xml 2012-07-24 06:22:19 +0000
95@@ -337,7 +337,7 @@
96 </t>
97 <t t-name="Header">
98 <div>
99- <a t-att-href="'/' + widget.qs" class="company_logo_link">
100+ <a href="javascript:void(0)" class="company_logo_link">
101 <div class="company_logo" />
102 </a>
103 </div>
104@@ -350,7 +350,7 @@
105 <div class="header_corner">
106 <ul class="block">
107 <li>
108- <a t-att-href="'/' + widget.qs" title="Home" class="home"><img t-att-src='_s + "/web/static/src/img/header-home.png"' width="16" height="16" border="0"/></a>
109+ <a href="javascript:void(0)" title="Home" class="home"><img t-att-src='_s + "/web/static/src/img/header-home.png"' width="16" height="16" border="0"/></a>
110 </li>
111 <li class="preferences">
112 <a href="javascript:void(0)" title="Preferences" class="preferences"><img t-att-src='_s + "/web/static/src/img/header-preferences.png"' width="16" height="16" border="0"/></a>
113
114=== modified file 'addons/web_process/static/src/js/process.js'
115--- addons/web_process/static/src/js/process.js 2012-01-31 10:58:46 +0000
116+++ addons/web_process/static/src/js/process.js 2012-07-24 06:22:19 +0000
117@@ -27,6 +27,12 @@
118 },
119 initialize_process_view: function() {
120 var self = this;
121+
122+ if(!this.check_view_discardable()){
123+ return $.Deferred().reject();
124+ }
125+ this.views['form'].controller.$element.removeClass('oe_form_dirty');
126+
127 this.record_id = false;
128 if(this.active_view == 'page' || this.active_view == 'form') {
129 this.record_id = this.views[this.active_view].controller.datarecord.id;