From 890b73e108e5fdb4f53fc0641fcc0acc3a6a6a00 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Tue, 21 Nov 2023 14:18:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96js=E4=BB=A3=E7=A0=81=E8=BF=87?= =?UTF-8?q?=E9=95=BF=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9C=AA=E7=94=A8=E5=88=B0=E7=9A=84=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/src/list/custom_width.js | 17 +++-- .../static/src/js/barcode_button.js | 72 +++++++++---------- .../static/src/js/kanban_change.js | 3 +- sf_warehouse/__init__.py | 1 - 4 files changed, 49 insertions(+), 44 deletions(-) diff --git a/jikimo_frontend/static/src/list/custom_width.js b/jikimo_frontend/static/src/list/custom_width.js index 63da7fdd..ba35c605 100644 --- a/jikimo_frontend/static/src/list/custom_width.js +++ b/jikimo_frontend/static/src/list/custom_width.js @@ -45,7 +45,8 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', { setDefaultColumnWidths(column_num) { // const bbb = this.state.columns[0].name - const widths = this.state.columns.map((col) => this.calculateColumnWidth(col)); + const widths = this.state.columns.map((col) => + this.calculateColumnWidth(col)); // const sumOfRelativeWidths = (widths // .filter(({ type }) => type === "relative") // .reduce((sum, { value }) => sum + value, 0)); @@ -65,16 +66,19 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', { // } // 判断 this.state.columns 是否存在且长度大于零 - if (this.state.columns && this.state.columns.length > 0 && this.state.columns[0].name === "sequence") { + if (this.state.columns && this.state.columns.length > 0 && + this.state.columns[0].name === "sequence") { widths[1] = { type: "relative", value: 0.1 }; } - // 1 because nth-child selectors are 1-indexed, 2 when the first column contains + // 1 because nth-child selectors are 1-indexed, + // 2 when the first column contains // the checkboxes to select records. const columnOffset = this.hasSelectors ? 2 : 1; - widths.forEach(({ type, value }, i) => { - const headerEl = this.tableRef.el.querySelector(`th:nth-child(${i + columnOffset})`); + widths.forEach(({ type, value }, width) => { + const headerEl = this.tableRef.el.querySelector( + `th:nth-child(${width + columnOffset})`); if (type === "absolute") { if (this.isEmpty) { headerEl.style.width = value; @@ -82,7 +86,8 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', { headerEl.style.minWidth = value; } } else if (type === "relative" && this.isEmpty) { - headerEl.style.width = `${((value / column_num) * 100).toFixed(2)}%`; + headerEl.style.width = `${((value / column_num) * 100 + ).toFixed(2)}%`; } }); }, diff --git a/sf_machine_connect/static/src/js/barcode_button.js b/sf_machine_connect/static/src/js/barcode_button.js index a050b35a..e7d9f879 100644 --- a/sf_machine_connect/static/src/js/barcode_button.js +++ b/sf_machine_connect/static/src/js/barcode_button.js @@ -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 { diff --git a/sf_manufacturing/static/src/js/kanban_change.js b/sf_manufacturing/static/src/js/kanban_change.js index 1f25caf4..bc0fd418 100644 --- a/sf_manufacturing/static/src/js/kanban_change.js +++ b/sf_manufacturing/static/src/js/kanban_change.js @@ -21,7 +21,8 @@ class CustomKanbanController extends KanbanController { // console.log(typeof this.workOrders); // console.log(Array.isArray(this.workOrders)); // - // console.log(this.workOrders.every(order => typeof order === 'object' && order.id !== undefined)); + // console.log(this.workOrders.every(order => + // typeof order === 'object' && order.id !== undefined)); diff --git a/sf_warehouse/__init__.py b/sf_warehouse/__init__.py index 815c355c..c081ee06 100644 --- a/sf_warehouse/__init__.py +++ b/sf_warehouse/__init__.py @@ -1,3 +1,2 @@ # -*-coding:utf-8-*- from . import models -