Priyesh (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-calendar-form-twice-pso into lp:openerp-web.

Requested reviews:
  Stephane Wirtel (OpenERP) (stephane-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-calendar-form-twice-pso/+merge/119484

Hello,

Task: Addons-issues4

Fixed issue of switching from calendar to form view, form view is coming twice.

Kindly review it.

Thanks,
Priyesh
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-calendar-form-twice-pso/+merge/119484
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-calendar-form-twice-pso.
=== modified file 'addons/web_calendar/static/src/js/calendar.js'
--- addons/web_calendar/static/src/js/calendar.js	2012-07-26 14:57:15 +0000
+++ addons/web_calendar/static/src/js/calendar.js	2012-08-14 08:38:19 +0000
@@ -444,18 +444,22 @@
         this.dataset = dataset;
         this.view_id = view_id;
         this.view = view;
+        this.form = false;
     },
     start: function() {
         var self = this;
         this._super();
-        this.form = new instance.web.FormView(this, this.dataset, this.view_id, {
-            pager: false
-        });
-        this.form.appendTo(this.$element);
-        this.form.on_created.add_last(this.on_form_dialog_saved);
-        this.form.on_saved.add_last(this.on_form_dialog_saved);
-        this.form.on_button_cancel = function() {
-            self.close();
+        // TOFIX: why we call start method second time ? I think, it's due to init_dialog() of instance.web.Dialog ?
+        if(!this.form){
+           this.form = new instance.web.FormView(this, this.dataset, this.view_id, {
+               pager: false
+           });
+           this.form.appendTo(this.$element);
+           this.form.on_created.add_last(this.on_form_dialog_saved);
+           this.form.on_saved.add_last(this.on_form_dialog_saved);
+           this.form.on_button_cancel = function() {
+               self.close();
+           }
         }
     },
     on_form_dialog_saved: function() {

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to