跳至内容
菜单
此问题已终结
1 回复
4065 查看

_makeNewLine: function (product, barcode, qty_done, package_id, result_package_id) {
var self = this;
var virtualId = this._getNewVirtualId();
var currentPage = this.pages[this.currentPageIndex];

var suggested_bin_loc;
// var sug_bin ={};
// this._rpc({
// 'model': 'stock.move.line',
// 'method': 'get_suggested_bin',
// 'args': [[],product.id],
// }).then(function(ress) {
// sug_bin['suggested_loc'] = ress;
// // return newLine;

// });

// console.log(sug_bin);


var newLine = {
'picking_id': this.currentState.id,
'product_id': {
'id': product.id,
'display_name': product.display_name,
'barcode': barcode,
'tracking': product.tracking,
},
'product_barcode': barcode,
'display_name': product.display_name,
'product_uom_qty': 0,
'product_uom_id': product.uom_id,
'qty_done': qty_done,
'location_id': {
'id': currentPage.location_id,
'display_name': currentPage.location_name,
},
'location_dest_id': {
'id': currentPage.location_dest_id,
'display_name': currentPage.location_dest_name,
},
'package_id': package_id,
'result_package_id': result_package_id,
'state': 'assigned',
'reference': this.name,
'virtual_id': virtualId,


};

this._rpc({
'model': 'stock.move.line',
'method': 'get_suggested_bin',
'args': [[],product.id],
}).then(function(ress) {
newLine['suggested_bin_loc'] = ress;
// return newLine;

});
console.log(newLine.suggested_bin_loc); // i can see the value here
window.alert(newLine.suggested_bin_loc); // showing un defined
return newLine;
},



});


This is the where i'm trying to get suggested location for product  after scanning barcode, by passing product id to method in defined in stock.move.line. some how managed to get the value but its been able to access only inside console but not in front end view for example like window.alert() function. 


形象
丢弃
最佳答案

Hi,

Check this link:

https://stackoverflow.com/questions/19317550/js-alert-showing-undefined

Also, make sure your browser page has not prevented it if you are using chrome.

形象
丢弃
相关帖文 回复 查看 活动
1
6月 24
1504
2
1月 23
5380
0
2月 21
3550
1
8月 23
411
1
12月 22
3450