优化js代码过长的问题,优化未用到的变量
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
import * as BarcodeScanner from "@web/webclient/barcode/barcode_scanner";
|
||||
// import { browser } from "@web/core/browser/browser";
|
||||
// import * as BarcodeScanner from "@web/webclient/barcode/barcode_scanner";
|
||||
const { Component } = owl;
|
||||
import { standardFieldProps } from "@web/views/fields/standard_field_props";
|
||||
import {registry} from "@web/core/registry";
|
||||
@@ -23,19 +23,19 @@ export class CodeField extends Component {
|
||||
this.record = this.props.record;
|
||||
}
|
||||
|
||||
async onBarcodeBtnClick() {
|
||||
const barcode = await BarcodeScanner.scanBarcode();
|
||||
if (barcode) {
|
||||
await this.onBarcodeScanned(barcode);
|
||||
if ("vibrate" in browser.navigator) {
|
||||
browser.navigator.vibrate(100);
|
||||
}
|
||||
} else {
|
||||
this.notification.add(this.env._t("Please, scan again !"), {
|
||||
type: "warning",
|
||||
});
|
||||
}
|
||||
}
|
||||
// async onBarcodeBtnClick() {
|
||||
// const barcode = await BarcodeScanner.scanBarcode();
|
||||
// if (barcode) {
|
||||
// await this.onBarcodeScanned(barcode);
|
||||
// if ("vibrate" in browser.navigator) {
|
||||
// browser.navigator.vibrate(100);
|
||||
// }
|
||||
// } else {
|
||||
// this.notification.add(this.env._t("Please, scan again !"), {
|
||||
// type: "warning",
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
async search(barcode) {
|
||||
// alert('我是search')
|
||||
const domain = [["code", "=", barcode]];
|
||||
@@ -65,33 +65,33 @@ export class CodeField extends Component {
|
||||
// console.log('currentModel',this)
|
||||
// console.log('this.record.data',this.record.data)
|
||||
// console.log('this.record.data.id', this.record.data.id)
|
||||
const workorder = await this.orm.call('mrp.workorder', 'read', [this.record.data.id]);
|
||||
// const workorder = await this.orm.call('mrp.workorder', 'read', [this.record.data.id]);
|
||||
// console.log('workorder', workorder[0])
|
||||
const updatedRecord = await this.orm.call("sf.tray", "write", [
|
||||
[records[0].id],
|
||||
{
|
||||
state: "占用",
|
||||
workorder_id: workorder[0].id,
|
||||
production_id: workorder[0].product_id[0],
|
||||
// workorder_id: workorder.id,
|
||||
}]);
|
||||
// const updatedRecord = await this.orm.call("sf.tray", "write", [
|
||||
// [records[0].id],
|
||||
// {
|
||||
// state: "占用",
|
||||
// workorder_id: workorder[0].id,
|
||||
// production_id: workorder[0].product_id[0],
|
||||
// // workorder_id: workorder.id,
|
||||
// }]);
|
||||
// console.log(workorder[0].routing_type);
|
||||
// console.log(workorder[0].production_id);
|
||||
// const productionIDS = await this.orm.call('mrp.production', 'search', [[['id', '=', workorder[0].production_id[0]]]]);
|
||||
const productionIDS = await this.orm.call('mrp.workorder', 'search', [[["production_id", "=", workorder[0].production_id[0]]]]);
|
||||
// const productionIDS = await this.orm.call('mrp.workorder', 'search', [[["production_id", "=", workorder[0].production_id[0]]]]);
|
||||
// console.log('prooooooo', productionIDS);
|
||||
// console.log('values', records[0].values[0]);
|
||||
productionIDS.forEach(async (data) => {
|
||||
// 处理每一个数据
|
||||
// console.log(data);
|
||||
const updatetrayRecord = await this.orm.call("mrp.workorder", "write", [
|
||||
[data],
|
||||
{
|
||||
tray_id: records[0].values[0].id,
|
||||
// tray_id: false,
|
||||
}]);
|
||||
// console.log(updatetrayRecord)
|
||||
});
|
||||
// productionIDS.forEach(async (data) => {
|
||||
// // 处理每一个数据
|
||||
// // console.log(data);
|
||||
// const updatetrayRecord = await this.orm.call("mrp.workorder", "write", [
|
||||
// [data],
|
||||
// {
|
||||
// tray_id: records[0].values[0].id,
|
||||
// // tray_id: false,
|
||||
// }]);
|
||||
// // console.log(updatetrayRecord)
|
||||
// });
|
||||
this.props.update(records[0].code);
|
||||
$('.o_form_button_save').click();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user