Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
4098 Переглядів

_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.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
черв. 24
1515
2
січ. 23
5406
0
лют. 21
3556
1
серп. 23
411
1
груд. 22
3456