Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4088 Widoki

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


Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
cze 24
1509
2
sty 23
5402
0
lut 21
3553
1
sie 23
411
1
gru 22
3455