Merge lp:~camptocamp/openerp-humanitarian-ngo/purchase-wkfl-fix-js into lp:openerp-humanitarian-ngo/purchase-wkfl

Proposed by Nicolas Bessi - Camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openerp-humanitarian-ngo/purchase-wkfl-fix-js
Merge into: lp:openerp-humanitarian-ngo/purchase-wkfl
Diff against target: 94 lines (+49/-27)
2 files modified
purchase_requisition_extended/model/purchase_requisition.py (+1/-1)
purchase_requisition_extended/static/src/js/web_addons.js (+48/-26)
To merge this branch: bzr merge lp:~camptocamp/openerp-humanitarian-ngo/purchase-wkfl-fix-js
Reviewer Review Type Date Requested Status
OpenERP for Humanitarian Core Editors Pending
Review via email: mp+246902@code.launchpad.net

Description of the change

Fix javascript to be resilient to return values~humanitarian-core-editors/openerp-humanitarian-ngo/ngo-github-7.0

To post a comment you must log in.
80. By Nicolas Bessi - Camptocamp on 2015-01-19

Fix javascript that confirm line selection

Unmerged revisions

80. By Nicolas Bessi - Camptocamp on 2015-01-19

Fix javascript that confirm line selection

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'purchase_requisition_extended/model/purchase_requisition.py'
2--- purchase_requisition_extended/model/purchase_requisition.py 2014-05-01 12:12:51 +0000
3+++ purchase_requisition_extended/model/purchase_requisition.py 2015-01-19 14:48:21 +0000
4@@ -395,7 +395,7 @@
5 for id in ids:
6 wf_service.trg_validate(uid, 'purchase.requisition',
7 id, 'close_bid', cr)
8- return False
9+ return True
10
11
12 class purchase_requisition_line(orm.Model):
13
14=== modified file 'purchase_requisition_extended/static/src/js/web_addons.js'
15--- purchase_requisition_extended/static/src/js/web_addons.js 2013-11-01 11:44:19 +0000
16+++ purchase_requisition_extended/static/src/js/web_addons.js 2015-01-19 14:48:21 +0000
17@@ -1,29 +1,51 @@
18 openerp.purchase_requisition_extended = function(instance) {
19 var QWeb = instance.web.qweb,
20- _t = instance.web._t;
21-
22- instance.web.purchase_requisition.CompareListView.include({
23- init: function () {
24- var self = this;
25- this._super.apply(this, arguments);
26- this.on('list_view_loaded', this, function() {
27- if(self.$buttons.find('.oe_close_bid').length == 0){
28- var button = $("<button type='button' class='oe_button oe_highlight oe_close_bid'>Confirm Selection</button>")
29- .click(this.proxy('close_bids_selection'));
30- button.after('<span class="oe_fade" style="margin:0 4px">or</span>');
31- button.after($('<a accesskey="D" class="oe_bold oe_form_button_cancel" href="#">Close</a>')
32- .click(function(){self.do_action('history_back')}));
33- self.$buttons.append(button);
34- }
35- self.$buttons.find('.oe_generate_po').remove();
36- });
37- },
38- close_bids_selection: function () {
39- var self = this;
40- new instance.web.Model('purchase.requisition').call("close_callforbids",[self.dataset.context.active_id,self.dataset.context]).then(function(result) {
41- self.do_action(result,{on_close:function(){self.do_action('history_back')}});
42- });
43- },
44- });
45-
46+ _t = instance.web._t;
47+
48+ instance.web.purchase_requisition.CompareListView.include(
49+ {
50+ init: function () {
51+ var self = this;
52+ this._super.apply(this, arguments);
53+ this.on(
54+ 'list_view_loaded',
55+ this,
56+ function() {
57+ if(self.$buttons.find('.oe_close_bid').length == 0){
58+ var button_body = "<button type='button' class='oe_button oe_highlight oe_close_bid'>Confirm Selection</button>"
59+ var return_link = '<a accesskey="D" class="oe_bold oe_form_button_cancel" href="#">Close</a>'
60+ var button = $(button_body).click(
61+ this.proxy('close_bids_selection')
62+ );
63+ button.after('<span class="oe_fade" style="margin:0 4px">or</span>');
64+ button.after(
65+ $(return_link).click(
66+ function(){self.do_action('history_back')}
67+ )
68+ );
69+ self.$buttons.append(button);
70+ }
71+ self.$buttons.find('.oe_generate_po').remove();
72+ }
73+ );
74+ },
75+ close_bids_selection: function () {
76+ var self = this;
77+ new instance.web.Model('purchase.requisition').call(
78+ "close_callforbids",
79+ [self.dataset.context.active_id, self.dataset.context]
80+ ).then(
81+ function(result) {
82+ self.do_action(
83+ false,
84+ {
85+ on_close: function(){self.do_action('history_back')},
86+ context: {}
87+ }
88+ );
89+ }
90+ );
91+ },
92+ }
93+ );
94 }

Subscribers

People subscribed via source and target branches