From d53e6648819457caa747d54528ae1dd77eeece0f Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 20 Nov 2023 17:38:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8C=E4=BC=98=E5=8C=96=E4=B8=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/models/process_status.py | 2 +- sf_manufacturing/models/stock.py | 4 ++-- web_widget_model_viewer/static/src/js/3d_viewer.js | 14 ++++---------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/sf_bf_connect/models/process_status.py b/sf_bf_connect/models/process_status.py index 069ef2d4..ceb566c5 100644 --- a/sf_bf_connect/models/process_status.py +++ b/sf_bf_connect/models/process_status.py @@ -1,10 +1,10 @@ from datetime import datetime +from collections import defaultdict, namedtuple import logging import requests from odoo import api, fields, models, SUPERUSER_ID, _ from odoo.exceptions import UserError from odoo.exceptions import ValidationError -from collections import defaultdict, namedtuple _logger = logging.getLogger(__name__) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 49d6f140..27cb69f9 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- import base64 +from collections import defaultdict, namedtuple import logging import json +from re import split as regex_split from re import findall as regex_findall from datetime import datetime, timedelta -from re import split as regex_split import requests from odoo import SUPERUSER_ID, _, api, fields, models from odoo.tools import float_compare -from collections import defaultdict, namedtuple from odoo.addons.stock.models.stock_rule import ProcurementException from odoo.addons.sf_base.commons.common import Common from odoo.exceptions import ValidationError, UserError diff --git a/web_widget_model_viewer/static/src/js/3d_viewer.js b/web_widget_model_viewer/static/src/js/3d_viewer.js index 0f8ef168..9d3afd50 100644 --- a/web_widget_model_viewer/static/src/js/3d_viewer.js +++ b/web_widget_model_viewer/static/src/js/3d_viewer.js @@ -3,20 +3,14 @@ import {registry} from "@web/core/registry"; import {_lt} from "@web/core/l10n/translation"; import {standardFieldProps} from "@web/views/fields/standard_field_props"; -import {useInputField} from "@web/views/fields/input_field_hook"; -import {FileUploader} from "@web/views/fields/file_handler"; import {session} from "@web/session"; -import {useService} from "@web/core/utils/hooks"; -import {isBinarySize} from "@web/core/utils/binary"; -import {download} from "@web/core/network/download"; -import utils from 'web.utils'; import core from 'web.core'; -import rpc from 'web.rpc'; + var QWeb = core.qweb; -import {Component, onWillUpdateProps, useState, useRef, useEffect} from "@odoo/owl"; +import {Component} from "@odoo/owl"; export class StepViewer extends Component { setup() { @@ -35,11 +29,11 @@ export class StepViewer extends Component { } url = url_props['base_url'].replace('http://', 'https://') + '/web/content/' + url_props['model'] + '/' + url_props['id'] + '/' + url_props['field'] + '?download=true' // url = 'http://localhost:8069'+'/web/content/'+url_props['model']+'/'+url_props['id']+'/'+url_props['field']+'?download=true' - console.log('url111111', url) + // console.log('url111111', url) return url } else { url = "data:model/gltf-binary;base64," + this.props.value; - console.log('url2', url) + // console.log('url2', url) return url // localStorage.setItem('url',url) // let new_url = localStorage.getItem(('url')) 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 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96js=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=BF=87=E9=95=BF=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=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 -