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

Fix javascript that confirm line selection

Unmerged revisions

80. By Nicolas Bessi - Camptocamp

Fix javascript that confirm line selection

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'purchase_requisition_extended/model/purchase_requisition.py'
--- purchase_requisition_extended/model/purchase_requisition.py 2014-05-01 12:12:51 +0000
+++ purchase_requisition_extended/model/purchase_requisition.py 2015-01-19 14:48:21 +0000
@@ -395,7 +395,7 @@
395 for id in ids:395 for id in ids:
396 wf_service.trg_validate(uid, 'purchase.requisition',396 wf_service.trg_validate(uid, 'purchase.requisition',
397 id, 'close_bid', cr)397 id, 'close_bid', cr)
398 return False398 return True
399399
400400
401class purchase_requisition_line(orm.Model):401class purchase_requisition_line(orm.Model):
402402
=== modified file 'purchase_requisition_extended/static/src/js/web_addons.js'
--- purchase_requisition_extended/static/src/js/web_addons.js 2013-11-01 11:44:19 +0000
+++ purchase_requisition_extended/static/src/js/web_addons.js 2015-01-19 14:48:21 +0000
@@ -1,29 +1,51 @@
1openerp.purchase_requisition_extended = function(instance) {1openerp.purchase_requisition_extended = function(instance) {
2 var QWeb = instance.web.qweb,2 var QWeb = instance.web.qweb,
3 _t = instance.web._t;3 _t = instance.web._t;
44
5 instance.web.purchase_requisition.CompareListView.include({5 instance.web.purchase_requisition.CompareListView.include(
6 init: function () {6 {
7 var self = this;7 init: function () {
8 this._super.apply(this, arguments);8 var self = this;
9 this.on('list_view_loaded', this, function() {9 this._super.apply(this, arguments);
10 if(self.$buttons.find('.oe_close_bid').length == 0){10 this.on(
11 var button = $("<button type='button' class='oe_button oe_highlight oe_close_bid'>Confirm Selection</button>")11 'list_view_loaded',
12 .click(this.proxy('close_bids_selection'));12 this,
13 button.after('<span class="oe_fade" style="margin:0 4px">or</span>');13 function() {
14 button.after($('<a accesskey="D" class="oe_bold oe_form_button_cancel" href="#">Close</a>')14 if(self.$buttons.find('.oe_close_bid').length == 0){
15 .click(function(){self.do_action('history_back')}));15 var button_body = "<button type='button' class='oe_button oe_highlight oe_close_bid'>Confirm Selection</button>"
16 self.$buttons.append(button);16 var return_link = '<a accesskey="D" class="oe_bold oe_form_button_cancel" href="#">Close</a>'
17 }17 var button = $(button_body).click(
18 self.$buttons.find('.oe_generate_po').remove();18 this.proxy('close_bids_selection')
19 });19 );
20 },20 button.after('<span class="oe_fade" style="margin:0 4px">or</span>');
21 close_bids_selection: function () {21 button.after(
22 var self = this;22 $(return_link).click(
23 new instance.web.Model('purchase.requisition').call("close_callforbids",[self.dataset.context.active_id,self.dataset.context]).then(function(result) {23 function(){self.do_action('history_back')}
24 self.do_action(result,{on_close:function(){self.do_action('history_back')}});24 )
25 });25 );
26 },26 self.$buttons.append(button);
27 });27 }
2828 self.$buttons.find('.oe_generate_po').remove();
29 }
30 );
31 },
32 close_bids_selection: function () {
33 var self = this;
34 new instance.web.Model('purchase.requisition').call(
35 "close_callforbids",
36 [self.dataset.context.active_id, self.dataset.context]
37 ).then(
38 function(result) {
39 self.do_action(
40 false,
41 {
42 on_close: function(){self.do_action('history_back')},
43 context: {}
44 }
45 );
46 }
47 );
48 },
49 }
50 );
29}51}

Subscribers

People subscribed via source and target branches