Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/新增销售权限

# Conflicts:
#	sf_bf_connect/models/process_status.py
This commit is contained in:
jinling.yang
2023-11-21 16:11:24 +08:00
7 changed files with 58 additions and 57 deletions

View File

@@ -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)}%`;
}
});
},

View File

@@ -3,6 +3,7 @@ import logging
import requests
from odoo import fields, models
_logger = logging.getLogger(__name__)

View File

@@ -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 {

View File

@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
import base64
from collections import defaultdict, namedtuple
import logging
from re import findall as regex_findall
from datetime import datetime
import json
from re import split as regex_split
from re import findall as regex_findall
from datetime import datetime, timedelta
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 UserError

View File

@@ -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));

View File

@@ -1,3 +1,2 @@
# -*-coding:utf-8-*-
from . import models

View File

@@ -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'))