Merge lp:~openerp-dev/openerp-web/6.1-opw-591727-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-591727-msh
Merge into: lp:openerp-web/6.1
Diff against target: 36 lines (+14/-3)
1 file modified
addons/web/static/src/js/view_form.js (+14/-3)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/6.1-opw-591727-msh
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+160551@code.launchpad.net

Description of the change

Hello,

Allow whole one2many reload on button action, there are lot of scenario where button inside one2many creates new record for one2many which requires whole one2many to reloaad so that new record get retrieved.

Demo:- To generate this issue there are lot of scenario, go to Warehouse -> Delivery Order -> Open any existing one and click on "Split in Production Lots" button of stock move, and create one lot, it creates new record in stock move but it doesn't show up untill we reload whole view or re-open that record again.

So to fix this issue add reload_on_button option same as 7.0.

I also set options in addons wherever I faced this issue and created a branch lp:~openerp-dev/openobject-addons/6.1-opw-591727-msh.

Thanks.

To post a comment you must log in.

Unmerged revisions

2513. By Mohammed Shekha<email address hidden>

[IMP]Allow whole one2many reload on button action, there are lot of scenario where button inside one2many creates new record for one2many which requires whole one2many to reloaad so that new record get retrieved.

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-03-13 09:26:29 +0000
3+++ addons/web/static/src/js/view_form.js 2013-04-24 06:25:33 +0000
4@@ -2462,6 +2462,7 @@
5 this.form_last_update = $.Deferred();
6 this.init_form_last_update = this.form_last_update;
7 this.disable_utility_classes = true;
8+ this.options = this.get_definition_options();
9 },
10 start: function() {
11 this._super.apply(this, arguments);
12@@ -2839,11 +2840,21 @@
13 });
14 },
15 do_button_action: function (name, id, callback) {
16+ var self = this;
17 var _super = _.bind(this._super, this);
18+ //Reload whole record as it needed when record is created by button action, based on option reload_on_button
19+ if (!self.o2m.options.reload_on_button) {
20+ this.o2m.view.do_save().then(function () {
21+ _super(name, id, callback);
22+ });
23+ }else {
24+ this.o2m.view.do_save().then(function () {
25+ _super(name, id, function() {
26+ self.o2m.view.reload();
27+ });
28+ });
29+ }
30
31- this.o2m.view.do_save().then(function () {
32- _super(name, id, callback);
33- });
34 },
35 reload_record: function (record) {
36 // Evict record.id from cache to ensure it will be reloaded correctly