I want to change the return into true of if condition given below
if (this.config.restrict_scan_source_location && !this.lastScanned.sourceLocation && !line.qty_done) {
console.log("IF 2", this.config)
return true; // Can't select a line if source is mandatory and wasn't scanned yet.
}
patch(BarcodePickingModel.prototype, 'custom_barcode_enterprise', {
lineCanBeSelected(line) {
console.log("LINEssssss", line)
console.log("THIS OF LINE CAN BE SELECT", this)
if (this.selectedLine && this.selectedLine.virtual_id === line.virtual_id) {
console.log("1")
return true; // We consider an already selected line can always be re-selected.
}
if (this.config.restrict_scan_source_location && !this.lastScanned.sourceLocation && !line.qty_done) {
console.log("IF 2", this.config)
return true; // Can't select a line if source is mandatory and wasn't scanned yet.
}
if (line.isPackageLine) {
console.log("3")
// The next conditions concern product, skips them in case of package line.
return super.lineCanBeSelected(...arguments);
}
const product = line.product_id;
if (this.config.restrict_put_in_pack === 'mandatory' && this.selectedLine &&
this.selectedLine.qty_done && !this.selectedLine.result_package_id &&
this.selectedLine.product_id.id != product.id) {
console.log("4")
return false; // Can't select another product if a package must be scanned first.
}
if (this.config.restrict_scan_product && product.barcode) {
// If the product scan is mandatory, a line can't be selected if its product isn't
// scanned first (as we can't keep track of each line's product scanned state, we
// consider a product was scanned if the line has a qty. greater than zero).
if (product.tracking === 'none' || !this.config.restrict_scan_tracking_number) {
return !this.getQtyDemand(line) || this.getQtyDone(line) || (
this.lastScanned.product && this.lastScanned.product.id === line.product_id.id
);
} else if (product.tracking != 'none') {
console.log("5")
return line.lot_name || (line.lot_id && line.qty_done);
}
}
console.log("@@@@@@@@@", super.lineCanBeSelected(...arguments))
return super.lineCanBeSelected(...arguments);
}
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Dự án
- MRP
Câu hỏi này đã bị gắn cờ
1
Trả lời
1816
Lượt xem
Hi
Please Try This
patch(BarcodePickingModel.prototype, 'path', {
lineCanBeSelected(line) {
if (this.config.restrict_scan_source_location && !this.lastScanned.sourceLocation && !line.qty_done) {
return true;
}
return this._super(line)
}
});Regards
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký