Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4097 มุมมอง

_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