Merge lp:~openerp-dev/openerp-web/7.0-opw-601800-msh into lp:openerp-web/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-601800-msh
Merge into: lp:openerp-web/7.0
Diff against target: 29 lines (+11/-1)
1 file modified
addons/web/static/src/js/views.js (+11/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-601800-msh
Reviewer Review Type Date Requested Status
Fabien Meghazi (OpenERP) Pending
Xavier (Open ERP) Pending
Martin Trigaux (OpenERP) Pending
Review via email: mp+199748@code.launchpad.net

Description of the change

Hello,

Fixed the issue of dialog open even if osv.exception raised through view_init, dialog should be opened only when either view_loaded(resolved once view is successfully loaded) or if its a form view then after is_initialized is resolved(resolved after default_get result).

Demo:- Warehouse -> Delivery Orders -> Open any delivery order -> Confirm It and then just click Return Product button and return the product -> again go back to same delivery order -> return Product button is still available -> Click on it, osv exception is raised (that you can return only those product which is in done state) but with exception dialog is also opened in background of exception dialog.

View Dialog must be opened after successful loading of View and successful loading of default_get result(if it is a form view).

Thanks.

To post a comment you must log in.

Unmerged revisions

4095. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]Web: Fixed the issue of dialog open even if osv.exception raised through view_init, dialog should be opened only when either view_loaded(resolved once view is successfully loaded) or if its a form view then after is_initialized is resolved(resolved after default_get result).

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/views.js'
2--- addons/web/static/src/js/views.js 2013-06-21 12:44:49 +0000
3+++ addons/web/static/src/js/views.js 2013-12-20 04:55:12 +0000
4@@ -364,6 +364,7 @@
5 * @return {*}
6 */
7 ir_actions_common: function(executor, options) {
8+ var self = this;
9 if (this.inner_widget && executor.action.target !== 'new') {
10 if (this.getParent().has_uncommitted_changes()) {
11 return $.Deferred().reject();
12@@ -391,7 +392,16 @@
13 this.dialog_widget = widget;
14 this.dialog_widget.setParent(this.dialog);
15 var initialized = this.dialog_widget.appendTo(this.dialog.$el);
16- this.dialog.open();
17+ var controller = this.dialog_widget.views[this.dialog_widget.active_view].controller;
18+ if (this.dialog_widget.active_view == 'form') {
19+ controller.is_initialized.done(function (){
20+ self.dialog.open();
21+ });
22+ } else {
23+ controller.on('view_loaded', this, function(){
24+ self.dialog.open();
25+ });
26+ }
27 return initialized;
28 } else {
29 this.dialog_stop();