İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
4085 Görünümler

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


Avatar
Vazgeç
En İyi Yanıt

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.

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Haz 24
1507
2
Oca 23
5398
0
Şub 21
3551
1
Ağu 23
411
1
Ara 22
3455