Merge lp:~openerp-dev/openerp-web/6.1-opw-576121-bth into lp:openerp-web/6.1

Proposed by Bhumi Thakkar (Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/6.1-opw-576121-bth
Merge into: lp:openerp-web/6.1
Diff against target: 36 lines (+7/-6)
1 file modified
addons/web/static/src/js/view_form.js (+7/-6)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/6.1-opw-576121-bth
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Needs Information
Review via email: mp+112496@code.launchpad.net

Description of the change

Hello,

    web client makes multiple reads when clicking a button to perform action.Order of requests is not proper.

1. Sales => Sales => Sales Orders
2. Open any record and click on any button for example compute.

Observed: 'Main record is going to be saved of current model ('sale.order') then related models ('sale.order.line') records are going to be saved and then action is going to perform.'
Expected: 'First Action should perform then records of current model and related model should save.'

Order of request is changed on execute action. First call function of action perform and the recursive_save function and reload.

Thanks.

To post a comment you must log in.
2378. By Bhumi Thakkar (Open ERP)

[FIX] Reload on button action.

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

> First Action should perform then records of current model and related model should save.

That does not make sense, it means if user changed information in form or line when executing action action is always going to see old data, then data is going to be reloaded, and new data is going to be lost.

review: Needs Information

Unmerged revisions

2378. By Bhumi Thakkar (Open ERP)

[FIX] Reload on button action.

2377. By Bhumi Thakkar (Open ERP)

[FIX] Order of request is changed on action of button.

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 2012-06-25 07:20:46 +0000
3+++ addons/web/static/src/js/view_form.js 2012-06-28 13:01:41 +0000
4@@ -1298,25 +1298,26 @@
5 });
6 return def.promise();
7 } else {
8- return self.on_confirmed();
9+ return self.on_confirmed().then( function() {
10+ self.view.recursive_save().pipe( function() { self.view.reload(); });
11+ });
12 }
13 };
14 if (!this.node.attrs.special) {
15 this.view.force_dirty = true;
16- return this.view.recursive_save().pipe(exec_action);
17- } else {
18- return exec_action();
19+ if (!this.view.datarecord.id) {
20+ return this.view.recursive_save().pipe(exec_action);
21+ }
22 }
23+ return exec_action();
24 },
25 on_confirmed: function() {
26 var self = this;
27-
28 var context = this.node.attrs.context;
29 if (context && context.__ref) {
30 context = new openerp.web.CompoundContext(context);
31 context.set_eval_context(this._build_eval_context());
32 }
33-
34 return this.view.do_execute_action(
35 _.extend({}, this.node.attrs, {context: context}),
36 this.view.dataset, this.view.datarecord.id, function () {