Merge branch refs/heads/develop into refs/heads/feature/修改机床参数bug
This commit is contained in:
@@ -32,8 +32,8 @@
|
|||||||
'jikimo_frontend/static/src/scss/rowno_in_tree.scss',
|
'jikimo_frontend/static/src/scss/rowno_in_tree.scss',
|
||||||
# 'jikimo_frontend/static/src/views/list_nums/list_render.xml',
|
# 'jikimo_frontend/static/src/views/list_nums/list_render.xml',
|
||||||
'jikimo_frontend/static/src/list/list_up_down_button.xml',
|
'jikimo_frontend/static/src/list/list_up_down_button.xml',
|
||||||
'jikimo_frontend/static/src/list/custom_import.js',
|
# 'jikimo_frontend/static/src/list/custom_import.js',
|
||||||
'jikimo_frontend/static/src/list/custom_width.js',
|
# 'jikimo_frontend/static/src/list/custom_width.js',
|
||||||
'jikimo_frontend/static/src/views/list_nums/extent_purchase.xml',
|
'jikimo_frontend/static/src/views/list_nums/extent_purchase.xml',
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -205,8 +205,8 @@ div[class="o_content o_component_with_search_panel"] img[name="equipment_image"]
|
|||||||
|
|
||||||
div[class="o_content o_component_with_search_panel"] .o_kanban_card_content button {
|
div[class="o_content o_component_with_search_panel"] .o_kanban_card_content button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -52px;
|
//top: -52px;
|
||||||
left: -55px;
|
//left: -55px;
|
||||||
width: 80px;
|
width: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,11 +253,11 @@ div[class="o_content o_component_with_search_panel"] .show_state span {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > .row {
|
//div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > .row {
|
||||||
position: absolute;
|
// position: absolute;
|
||||||
top: 55px;
|
// top: 55px;
|
||||||
right: 43.5%;
|
// right: 43.5%;
|
||||||
}
|
//}
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
.test_model > .o_form_label {
|
.test_model > .o_form_label {
|
||||||
@@ -270,10 +270,10 @@ div[class="o_content o_component_with_search_panel"] .o_kanban_primary_right > .
|
|||||||
right: 52%;
|
right: 52%;
|
||||||
}
|
}
|
||||||
|
|
||||||
div[class="o_content o_component_with_search_panel"] .o_kanban_card_content button {
|
//div[class="o_content o_component_with_search_panel"] .o_kanban_card_content button {
|
||||||
|
//
|
||||||
left: -95px;
|
// left: -95px;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -354,3 +354,25 @@ div:has(.o_required_modifier) > label::before {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 2023-11-16 hy 新增
|
||||||
|
.o_kanban_card_content .btn-group {
|
||||||
|
position: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.o_kanban_card_content .btn-group button{
|
||||||
|
top: 100px;
|
||||||
|
left: 168px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.o_kanban_primary_right {
|
||||||
|
position: absolute;
|
||||||
|
top: 40px;
|
||||||
|
left: 168px;
|
||||||
|
padding: 0;
|
||||||
|
.row {
|
||||||
|
>div {
|
||||||
|
width: unset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -86,7 +86,7 @@ class MachineTool(models.Model):
|
|||||||
state = fields.Selection(
|
state = fields.Selection(
|
||||||
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
||||||
default='正常', string="机床状态")
|
default='正常', string="机床状态")
|
||||||
#0606新增字段
|
# 0606新增字段
|
||||||
machine_tool_picture = fields.Binary('图片')
|
machine_tool_picture = fields.Binary('图片')
|
||||||
heightened_way = fields.Selection([
|
heightened_way = fields.Selection([
|
||||||
('sifudianji', '伺服电机驱动'),
|
('sifudianji', '伺服电机驱动'),
|
||||||
@@ -260,7 +260,7 @@ class MachineToolType(models.Model):
|
|||||||
default="", string="刀把类型")
|
default="", string="刀把类型")
|
||||||
number_of_knife_library = fields.Integer('刀库数量')
|
number_of_knife_library = fields.Integer('刀库数量')
|
||||||
rotate_speed = fields.Integer('转速')
|
rotate_speed = fields.Integer('转速')
|
||||||
#0606新增字段
|
# 0606新增字段
|
||||||
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||||
machine_tool_picture = fields.Binary('图片')
|
machine_tool_picture = fields.Binary('图片')
|
||||||
heightened_way = fields.Selection([
|
heightened_way = fields.Selection([
|
||||||
@@ -326,5 +326,4 @@ class MachineToolCategory(models.Model):
|
|||||||
remark = fields.Text('备注')
|
remark = fields.Text('备注')
|
||||||
active = fields.Boolean('有效', default=True)
|
active = fields.Boolean('有效', default=True)
|
||||||
category = fields.Selection([('shukong', u'数控'), ('putong', u'普通')], string=u'机床类别',
|
category = fields.Selection([('shukong', u'数控'), ('putong', u'普通')], string=u'机床类别',
|
||||||
default='shukong')
|
default='shukong')
|
||||||
|
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ class FeedPerTooth(models.Model):
|
|||||||
cutting_speed = fields.Char('径向切宽 ae(mm)')
|
cutting_speed = fields.Char('径向切宽 ae(mm)')
|
||||||
machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式')
|
machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式')
|
||||||
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
|
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
|
||||||
blade_diameter = fields.Char('刃部直径(mm)', readonly=True)
|
blade_diameter = fields.Integer('刃部直径(mm)', readonly=True)
|
||||||
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
|
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
|
||||||
|
|
||||||
def _json_feed_per_tooth(self, obj):
|
def _json_feed_per_tooth(self, obj):
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import cpca
|
# import cpca
|
||||||
import logging
|
|
||||||
import base64
|
import base64
|
||||||
import requests
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import requests
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||||
@@ -37,7 +37,7 @@ class JdEclp(models.Model):
|
|||||||
deliveryType = fields.Selection([('6', '特快零担'), ('25', '特快重货')], string='运输类型', default='25')
|
deliveryType = fields.Selection([('6', '特快零担'), ('25', '特快重货')], string='运输类型', default='25')
|
||||||
# bill = fields.Char(string='物流面单')
|
# bill = fields.Char(string='物流面单')
|
||||||
|
|
||||||
# bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
|
# bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
|
||||||
# bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas')
|
# bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas')
|
||||||
bill_show = fields.Binary(string='物流面单展示', readonly=True)
|
bill_show = fields.Binary(string='物流面单展示', readonly=True)
|
||||||
|
|
||||||
@@ -48,10 +48,11 @@ class JdEclp(models.Model):
|
|||||||
@api.depends('origin')
|
@api.depends('origin')
|
||||||
def _truck_info(self):
|
def _truck_info(self):
|
||||||
# if 'S' in self.origin:
|
# if 'S' in self.origin:
|
||||||
# if self.receiverName and self.receiverMobile and self.receiverProvinceName and self.receiverCityName and self.receiverCountyName and self.receiverTownName:
|
# if self.receiverName and self.receiverMobile and self.receiverProvinceName and self.receiverCityName and
|
||||||
|
# self.receiverCountyName and self.receiverTownName:
|
||||||
sale_order_id = self.env['sale.order'].search([('name', '=', self.origin)])
|
sale_order_id = self.env['sale.order'].search([('name', '=', self.origin)])
|
||||||
# stock_picking_type_id = self.enc['stock.picking.type'].search([('picking_type_id', '=', '')])
|
# stock_picking_type_id = self.enc['stock.picking.type'].search([('picking_type_id', '=', '')])
|
||||||
# if sale_order_id.address_of_delivery != False:
|
# if sale_order_id.address_of_delivery != False:
|
||||||
try:
|
try:
|
||||||
if 'OUT' in self.name:
|
if 'OUT' in self.name:
|
||||||
raw_addres = sale_order_id.address_of_delivery.split('这是一个标志位,用来不分隔字符串')
|
raw_addres = sale_order_id.address_of_delivery.split('这是一个标志位,用来不分隔字符串')
|
||||||
@@ -78,8 +79,6 @@ class JdEclp(models.Model):
|
|||||||
print(f"Error address is none: {e}")
|
print(f"Error address is none: {e}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create_order(self):
|
def create_order(self):
|
||||||
# sale_order_id = self.env['sale.order'].search([('name', '=', self.origin)])
|
# sale_order_id = self.env['sale.order'].search([('name', '=', self.origin)])
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
|
||||||
from odoo.exceptions import ValidationError
|
|
||||||
from collections import defaultdict, namedtuple
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
from odoo.exceptions import UserError
|
|
||||||
import requests
|
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__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -105,7 +105,6 @@ class StatusChange(models.Model):
|
|||||||
#
|
#
|
||||||
# return True
|
# return True
|
||||||
|
|
||||||
|
|
||||||
# def action_cancel(self):
|
# def action_cancel(self):
|
||||||
# """ Cancel SO after showing the cancel wizard when needed. (cfr `_show_cancel_wizard`)
|
# """ Cancel SO after showing the cancel wizard when needed. (cfr `_show_cancel_wizard`)
|
||||||
#
|
#
|
||||||
@@ -205,12 +204,12 @@ class FinishStatusChange(models.Model):
|
|||||||
[('id', 'child_of', self.picking_type_id.warehouse_id.view_location_id.id),
|
[('id', 'child_of', self.picking_type_id.warehouse_id.view_location_id.id),
|
||||||
('usage', '!=', 'supplier')])
|
('usage', '!=', 'supplier')])
|
||||||
if self.env['stock.move'].search([
|
if self.env['stock.move'].search([
|
||||||
('state', 'in', ['confirmed', 'partially_available', 'waiting', 'assigned']),
|
('state', 'in', ['confirmed', 'partially_available', 'waiting', 'assigned']),
|
||||||
('product_qty', '>', 0),
|
('product_qty', '>', 0),
|
||||||
('location_id', 'in', wh_location_ids),
|
('location_id', 'in', wh_location_ids),
|
||||||
('move_orig_ids', '=', False),
|
('move_orig_ids', '=', False),
|
||||||
('picking_id', 'not in', self.ids),
|
('picking_id', 'not in', self.ids),
|
||||||
('product_id', 'in', lines.product_id.ids)], limit=1):
|
('product_id', 'in', lines.product_id.ids)], limit=1):
|
||||||
action = self.action_view_reception_report()
|
action = self.action_view_reception_report()
|
||||||
action['context'] = {'default_picking_ids': self.ids}
|
action['context'] = {'default_picking_ids': self.ids}
|
||||||
return action
|
return action
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ class ResMrpBomMo(models.Model):
|
|||||||
limit=1,
|
limit=1,
|
||||||
order='volume desc'
|
order='volume desc'
|
||||||
)
|
)
|
||||||
# logging.info('get_bom-vals:%s' % embryo_has)
|
|
||||||
if embryo_has:
|
if embryo_has:
|
||||||
rate_of_waste = ((embryo_has.volume - product.model_volume) % embryo_has.volume) * 100
|
rate_of_waste = ((embryo_has.volume - product.model_volume) % embryo_has.volume) * 100
|
||||||
if rate_of_waste <= 20:
|
if rate_of_waste <= 20:
|
||||||
|
|||||||
@@ -262,7 +262,7 @@
|
|||||||
<span>(mm)&nbsp;</span>
|
<span>(mm)&nbsp;</span>
|
||||||
</div>
|
</div>
|
||||||
<field name="cutting_tool_clamping_way"
|
<field name="cutting_tool_clamping_way"
|
||||||
attrs="{'required': [('cutting_tool_type','in',('整体式刀具','刀片','刀杆','刀盘'))]}"/>
|
attrs="{'invisible': [('cutting_tool_type','not in',('刀柄','夹头'))]}"/>
|
||||||
<field name="cutting_tool_top_diameter" class="diameter"
|
<field name="cutting_tool_top_diameter" class="diameter"
|
||||||
attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
|
attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
|
||||||
<field name="cutting_tool_outer_diameter" class="diameter"
|
<field name="cutting_tool_outer_diameter" class="diameter"
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
},
|
},
|
||||||
|
'external_dependencies': {'python': ['opcua(使用pip install opcua -i https://pypi.tuna.tsinghua.edu.cn/simple)']},
|
||||||
|
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'application': True,
|
'application': True,
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import base64
|
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
import json
|
|
||||||
import hashlib
|
|
||||||
import time
|
import time
|
||||||
import requests
|
import json
|
||||||
from datetime import datetime, timedelta
|
import base64
|
||||||
from odoo.http import request
|
|
||||||
from odoo import fields, models, api, _
|
|
||||||
from odoo.exceptions import ValidationError
|
|
||||||
from odoo.exceptions import UserError
|
|
||||||
from odoo.addons.sf_machine_connect.models import py2opcua, ftp_operate
|
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
import logging
|
||||||
|
import hashlib
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
import requests
|
||||||
|
from odoo.http import request
|
||||||
|
from odoo import fields, models, api, _
|
||||||
|
from odoo.exceptions import UserError
|
||||||
from odoo.exceptions import MissingError
|
from odoo.exceptions import MissingError
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.addons.sf_machine_connect.models import py2opcua, ftp_operate
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -514,7 +513,6 @@ class WorkCenterBarcode(models.Model):
|
|||||||
print('111111111111111111111')
|
print('111111111111111111111')
|
||||||
workorder_obj_target = self.env['mrp.workorder'].sudo().search([('tray_code', '=', barcode)])
|
workorder_obj_target = self.env['mrp.workorder'].sudo().search([('tray_code', '=', barcode)])
|
||||||
workorder_obj_current = self.env['mrp.workorder'].sudo().search([('id', '=', kwargs['current_id'])])
|
workorder_obj_current = self.env['mrp.workorder'].sudo().search([('id', '=', kwargs['current_id'])])
|
||||||
# workorder_cnc = self.env['mrp.workorder'].sudo().search(['&', ('production_id', '=', workorder_obj.production_id.id), ('name', '=', 'CNC加工')])
|
|
||||||
workorder_cnc = self.env['mrp.workorder'].sudo().search(
|
workorder_cnc = self.env['mrp.workorder'].sudo().search(
|
||||||
['&', ('production_id', '=', workorder_obj_target.production_id.id),
|
['&', ('production_id', '=', workorder_obj_target.production_id.id),
|
||||||
('name', '=', workorder_obj_current.name)])
|
('name', '=', workorder_obj_current.name)])
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class FtpController:
|
|||||||
self.port = port
|
self.port = port
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
# _logger.info("===================ftppppp==================%s,%s,%s,%s" % self.host, self.port, self.username, self.password)
|
|
||||||
# 测试
|
# 测试
|
||||||
print("==============================================")
|
print("==============================================")
|
||||||
print(self.username, self.port, self.host, self.password)
|
print(self.username, self.port, self.host, self.password)
|
||||||
|
|||||||
@@ -33,4 +33,3 @@ class ResBFMConfigSettings(models.TransientModel):
|
|||||||
super(ResBFMConfigSettings, self).set_values()
|
super(ResBFMConfigSettings, self).set_values()
|
||||||
ir_config = self.env['ir.config_parameter'].sudo()
|
ir_config = self.env['ir.config_parameter'].sudo()
|
||||||
ir_config.set_param("bfm_url", self.bfm_url or "")
|
ir_config.set_param("bfm_url", self.bfm_url or "")
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,23 @@
|
|||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
|
||||||
import { browser } from "@web/core/browser/browser";
|
import { browser } from "@web/core/browser/browser";
|
||||||
import { Dialog } from "@web/core/dialog/dialog";
|
|
||||||
import { _lt } from "@web/core/l10n/translation";
|
|
||||||
import { useChildRef, useOwnedDialogs, useService } from "@web/core/utils/hooks";
|
|
||||||
import { sprintf } from "@web/core/utils/strings";
|
|
||||||
import { isMobileOS } from "@web/core/browser/feature_detection";
|
|
||||||
import * as BarcodeScanner from "@web/webclient/barcode/barcode_scanner";
|
import * as BarcodeScanner from "@web/webclient/barcode/barcode_scanner";
|
||||||
const { useRef } = owl;
|
const { Component } = owl;
|
||||||
const {xml, Component} = owl;
|
|
||||||
import { standardFieldProps } from "@web/views/fields/standard_field_props";
|
import { standardFieldProps } from "@web/views/fields/standard_field_props";
|
||||||
import {registry} from "@web/core/registry";
|
import {registry} from "@web/core/registry";
|
||||||
import {useInputField} from "@web/views/fields/input_field_hook";
|
import {useInputField} from "@web/views/fields/input_field_hook";
|
||||||
|
|
||||||
export class CodeField extends Component {
|
export class CodeField extends Component {
|
||||||
setup() {
|
setup() {
|
||||||
console.log('CodeField created')
|
// console.log('CodeField created')
|
||||||
console.log('this',this)
|
// console.log('this',this)
|
||||||
console.log('this.props',this.props)
|
// console.log('this.props',this.props)
|
||||||
console.log('this.props.record',this.props.value)
|
// console.log('this.props.record',this.props.value)
|
||||||
useInputField({
|
useInputField({
|
||||||
getValue: () => this.props.value,
|
getValue: () => this.props.value,
|
||||||
refName: "scan_code",
|
refName: "scan_code",
|
||||||
});
|
});
|
||||||
console.log('我是setup1')
|
// console.log('我是setup1')
|
||||||
super.setup();
|
super.setup();
|
||||||
this.orm = this.env.services.orm;
|
this.orm = this.env.services.orm;
|
||||||
this.record = this.props.record;
|
this.record = this.props.record;
|
||||||
@@ -45,12 +39,12 @@ export class CodeField extends Component {
|
|||||||
async search(barcode) {
|
async search(barcode) {
|
||||||
// alert('我是search')
|
// alert('我是search')
|
||||||
const domain = [["code", "=", barcode]];
|
const domain = [["code", "=", barcode]];
|
||||||
console.log(domain)
|
// console.log(domain)
|
||||||
const fields = ["id", "code", "name", "state"];
|
const fields = ["id", "code", "name", "state"];
|
||||||
console.log(fields)
|
// console.log(fields)
|
||||||
const results = await this.orm.call("sf.tray", "search_read", [domain, fields]);
|
const results = await this.orm.call("sf.tray", "search_read", [domain, fields]);
|
||||||
const values = await this.orm.call("sf.tray", "search_read", [domain]);
|
const values = await this.orm.call("sf.tray", "search_read", [domain]);
|
||||||
console.log(results)
|
// console.log(results)
|
||||||
return results.map((result) => {
|
return results.map((result) => {
|
||||||
return {
|
return {
|
||||||
id: result.id,
|
id: result.id,
|
||||||
@@ -63,16 +57,16 @@ export class CodeField extends Component {
|
|||||||
}
|
}
|
||||||
async onBarcodeScanned(barcode) {
|
async onBarcodeScanned(barcode) {
|
||||||
const results = await this.search(barcode);
|
const results = await this.search(barcode);
|
||||||
console.log(results)
|
// console.log(results)
|
||||||
const records = results.filter((r) => !!r.id);
|
const records = results.filter((r) => !!r.id);
|
||||||
console.log(records)
|
// console.log(records)
|
||||||
if (records.length === 1) {
|
if (records.length === 1) {
|
||||||
if (records[0].state === '空闲') {
|
if (records[0].state === '空闲') {
|
||||||
console.log('currentModel',this)
|
// console.log('currentModel',this)
|
||||||
console.log('this.record.data',this.record.data)
|
// console.log('this.record.data',this.record.data)
|
||||||
console.log('this.record.data.id', this.record.data.id)
|
// 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])
|
// console.log('workorder', workorder[0])
|
||||||
const updatedRecord = await this.orm.call("sf.tray", "write", [
|
const updatedRecord = await this.orm.call("sf.tray", "write", [
|
||||||
[records[0].id],
|
[records[0].id],
|
||||||
{
|
{
|
||||||
@@ -81,31 +75,32 @@ export class CodeField extends Component {
|
|||||||
production_id: workorder[0].product_id[0],
|
production_id: workorder[0].product_id[0],
|
||||||
// workorder_id: workorder.id,
|
// workorder_id: workorder.id,
|
||||||
}]);
|
}]);
|
||||||
console.log(workorder[0].routing_type);
|
// console.log(workorder[0].routing_type);
|
||||||
console.log(workorder[0].production_id);
|
// 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.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('prooooooo', productionIDS);
|
||||||
console.log('values', records[0].values[0]);
|
// console.log('values', records[0].values[0]);
|
||||||
productionIDS.forEach(async (data) => {
|
productionIDS.forEach(async (data) => {
|
||||||
// 处理每一个数据
|
// 处理每一个数据
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
const updatetrayRecord = await this.orm.call("mrp.workorder", "write", [
|
const updatetrayRecord = await this.orm.call("mrp.workorder", "write", [
|
||||||
[data],
|
[data],
|
||||||
{
|
{
|
||||||
tray_id: records[0].values[0].id,
|
tray_id: records[0].values[0].id,
|
||||||
// tray_id: false,
|
// tray_id: false,
|
||||||
}]);
|
}]);
|
||||||
console.log(updatetrayRecord)
|
// console.log(updatetrayRecord)
|
||||||
});
|
});
|
||||||
this.props.update(records[0].code);
|
this.props.update(records[0].code);
|
||||||
$('.o_form_button_save').click();
|
$('.o_form_button_save').click();
|
||||||
} else {
|
} else {
|
||||||
if (records[0].state === '占用') {
|
if (records[0].state === '占用') {
|
||||||
console.log('此托盘已占用,请检查')
|
// console.log('此托盘已占用,请检查')
|
||||||
alert('此托盘已占用,请检查')
|
alert('此托盘已占用,请检查')
|
||||||
} else {
|
} else {
|
||||||
console.log('此托盘已损坏,请登记')
|
// console.log('此托盘已损坏,请登记')
|
||||||
|
alert('此托盘已损坏,请登记')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ const { Component, xml } = owl;
|
|||||||
|
|
||||||
export class BarcodeHandlerField extends Component {
|
export class BarcodeHandlerField extends Component {
|
||||||
setup() {
|
setup() {
|
||||||
console.log('99999999111');
|
|
||||||
this.actionService = useService("action")
|
this.actionService = useService("action")
|
||||||
console.log(this.actionService)
|
|
||||||
|
|
||||||
const barcode = useService("barcode");
|
const barcode = useService("barcode");
|
||||||
// this.rpc = useService("rpc");
|
// this.rpc = useService("rpc");
|
||||||
// useBus(barcode.bus, "barcode_scanned", this.onBarcodeScanned.bind(this));
|
// useBus(barcode.bus, "barcode_scanned", this.onBarcodeScanned.bind(this));
|
||||||
@@ -20,9 +17,6 @@ export class BarcodeHandlerField extends Component {
|
|||||||
async _rpc(params) {
|
async _rpc(params) {
|
||||||
// const { data } = await this.env.services.rpc('/web/dataset/call_kw', params);
|
// const { data } = await this.env.services.rpc('/web/dataset/call_kw', params);
|
||||||
const response = await this.env.services.rpc('/web/dataset/call_kw', params);
|
const response = await this.env.services.rpc('/web/dataset/call_kw', params);
|
||||||
console.log('response', response);
|
|
||||||
console.log('response.result', response.result);
|
|
||||||
|
|
||||||
// return response
|
// return response
|
||||||
const responseObject = JSON.parse(response)
|
const responseObject = JSON.parse(response)
|
||||||
return responseObject;
|
return responseObject;
|
||||||
@@ -33,8 +27,6 @@ export class BarcodeHandlerField extends Component {
|
|||||||
this.props.update(barcode);
|
this.props.update(barcode);
|
||||||
// const actionService = useService("action");
|
// const actionService = useService("action");
|
||||||
// const productId = 12345
|
// const productId = 12345
|
||||||
console.log('111222222222211111');
|
|
||||||
|
|
||||||
// 根据条形码获取相关数据,例如产品ID
|
// 根据条形码获取相关数据,例如产品ID
|
||||||
const response = await this._rpc({
|
const response = await this._rpc({
|
||||||
model: 'mrp.workorder',
|
model: 'mrp.workorder',
|
||||||
@@ -42,11 +34,10 @@ export class BarcodeHandlerField extends Component {
|
|||||||
args: [barcode],
|
args: [barcode],
|
||||||
kwargs:{},
|
kwargs:{},
|
||||||
});
|
});
|
||||||
// console.log(productId.result)
|
|
||||||
if (response.result) {
|
if (response.result) {
|
||||||
const action = response.result;
|
// const action = response.result;
|
||||||
console.log(action)
|
// console.log(action)
|
||||||
console.log('11111111111111111111111111111111111');
|
// console.log('11111111111111111111111111111111111');
|
||||||
// 通过产品ID执行操作并跳转到表单视图
|
// 通过产品ID执行操作并跳转到表单视图
|
||||||
// await this.actionService.doAction({
|
// await this.actionService.doAction({
|
||||||
// // type: 'ir.actions.act_window',
|
// // type: 'ir.actions.act_window',
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ import os
|
|||||||
import json
|
import json
|
||||||
import hashlib
|
import hashlib
|
||||||
import time
|
import time
|
||||||
import requests
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import requests
|
||||||
from odoo import fields, models, api, _
|
from odoo import fields, models, api, _
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / (
|
y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / (
|
||||||
(y3 - y4) * (x1 - x2) - (y1 - y2) * (x3 - x4))
|
(y3 - y4) * (x1 - x2) - (y1 - y2) * (x3 - x4))
|
||||||
x1 = ((x7 - x8) * (x6 * y5 - x5 * y6) - (x5 - x6) * (x8 * y7 - x7 * y8)) / (
|
x1 = ((x7 - x8) * (x6 * y5 - x5 * y6) - (x5 - x6) * (x8 * y7 - x7 * y8)) / (
|
||||||
(x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8));
|
(x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8))
|
||||||
y1 = ((y7 - y8) * (y6 * x5 - y5 * x6) - (y5 - y6) * (y8 * x7 - y7 * x8)) / (
|
y1 = ((y7 - y8) * (y6 * x5 - y5 * x6) - (y5 - y6) * (y8 * x7 - y7 * x8)) / (
|
||||||
(y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8))
|
(y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8))
|
||||||
x = (x0 + x1) / 2
|
x = (x0 + x1) / 2
|
||||||
@@ -189,19 +189,26 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
def json_workorder_str(self, k, production, route):
|
def json_workorder_str(self, k, production, route):
|
||||||
# 计算预计时长duration_expected
|
# 计算预计时长duration_expected
|
||||||
if route.routing_type == '切割':
|
if route.routing_type == '切割':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '切割')]).time_cycle
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
|
[('name', '=', '切割')]).time_cycle
|
||||||
elif route.routing_type == '获取CNC加工程序':
|
elif route.routing_type == '获取CNC加工程序':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '获取CNC加工程序')]).time_cycle
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
|
[('name', '=', '获取CNC加工程序')]).time_cycle
|
||||||
elif route.routing_type == '工件装夹':
|
elif route.routing_type == '工件装夹':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '工件装夹')]).time_cycle
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
|
[('name', '=', '工件装夹')]).time_cycle
|
||||||
elif route.routing_type == '前置三元定位检测':
|
elif route.routing_type == '前置三元定位检测':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '前置三元定位检测')]).time_cycle
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
|
[('name', '=', '前置三元定位检测')]).time_cycle
|
||||||
elif route.routing_type == 'CNC加工':
|
elif route.routing_type == 'CNC加工':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', 'CNC加工')]).time_cycle
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
|
[('name', '=', 'CNC加工')]).time_cycle
|
||||||
elif route.routing_type == '后置三元质量检测':
|
elif route.routing_type == '后置三元质量检测':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '后置三元质量检测')]).time_cycle
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
|
[('name', '=', '后置三元质量检测')]).time_cycle
|
||||||
elif route.routing_type == '解除装夹':
|
elif route.routing_type == '解除装夹':
|
||||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '解除装夹')]).time_cycle
|
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
|
[('name', '=', '解除装夹')]).time_cycle
|
||||||
else:
|
else:
|
||||||
duration_expected = 60
|
duration_expected = 60
|
||||||
workorders_values_str = [0, '', {
|
workorders_values_str = [0, '', {
|
||||||
|
|||||||
@@ -151,33 +151,35 @@ class ResProductMo(models.Model):
|
|||||||
item.cutting_speed_ids = False
|
item.cutting_speed_ids = False
|
||||||
item.feed_per_tooth_ids = False
|
item.feed_per_tooth_ids = False
|
||||||
|
|
||||||
def choice(self):
|
# def choice(self):
|
||||||
if self.cutting_tool_type == '整体式刀具':
|
# if self.cutting_tool_type == '整体式刀具':
|
||||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_integral_tree')
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_integral_tree')
|
||||||
elif self.cutting_tool_type == '刀片':
|
# elif self.cutting_tool_type == '刀片':
|
||||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_blade_tree')
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_blade_tree')
|
||||||
elif self.cutting_tool_type == '刀杆':
|
# elif self.cutting_tool_type == '刀杆':
|
||||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_cutter_bar_tree')
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_cutter_bar_tree')
|
||||||
elif self.cutting_tool_type == '刀盘':
|
# elif self.cutting_tool_type == '刀盘':
|
||||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||||
elif self.cutting_tool_type == '刀柄':
|
# elif self.cutting_tool_type == '刀柄':
|
||||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||||
else:
|
# else:
|
||||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||||
return {
|
# return {
|
||||||
'name': _('规格'),
|
# 'name': _('规格'),
|
||||||
'view_mode': 'list',
|
# 'view_mode': 'list',
|
||||||
'view_id': tree_view.id,
|
# 'view_id': tree_view.id,
|
||||||
'type': 'ir.actions.act_window',
|
# 'type': 'ir.actions.act_window',
|
||||||
'res_model': 'sf.tool.materials.basic.parameters',
|
# 'res_model': 'sf.tool.materials.basic.parameters',
|
||||||
'target': 'new',
|
# 'target': 'new',
|
||||||
'domain': [('cutting_tool_type', '=', self.cutting_tool_type),
|
# 'domain': [('cutting_tool_type', '=', self.cutting_tool_type),
|
||||||
('standard_library_id', '=', self.cutting_tool_model_id.id)],
|
# ('standard_library_id', '=', self.cutting_tool_model_id.id)],
|
||||||
}
|
# }
|
||||||
|
|
||||||
@api.onchange('specification_id')
|
@api.onchange('specification_id')
|
||||||
def _onchange_specification(self):
|
def _onchange_specification(self):
|
||||||
if self.specification_id:
|
if self.specification_id:
|
||||||
|
self.cutting_speed_ids = False
|
||||||
|
self.feed_per_tooth_ids = False
|
||||||
self.cutting_tool_type_id = self.cutting_tool_model_id.cutting_tool_type_id.id
|
self.cutting_tool_type_id = self.cutting_tool_model_id.cutting_tool_type_id.id
|
||||||
self.brand_id = self.cutting_tool_model_id.brand_id.id
|
self.brand_id = self.cutting_tool_model_id.brand_id.id
|
||||||
self.tool_hardness = self.cutting_tool_model_id.tool_hardness
|
self.tool_hardness = self.cutting_tool_model_id.tool_hardness
|
||||||
@@ -202,14 +204,18 @@ class ResProductMo(models.Model):
|
|||||||
self.cutting_tool_blade_depth = self.specification_id.blade_depth
|
self.cutting_tool_blade_depth = self.specification_id.blade_depth
|
||||||
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
|
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
|
||||||
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
|
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
|
||||||
self.feed_per_tooth_ids = [(0, 0, {'product_template_id': product_template.id,
|
# # self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.
|
||||||
'cutting_speed': product_template.cutting_speed,
|
# for tooth in self.cutting_tool_model_id.feed_per_tooth_ids:
|
||||||
'machining_method': product_template.machining_method,
|
# print(int(tooth.blade_diameter))
|
||||||
'blade_diameter': product_template.blade_diameter,
|
# print(int(self.specification_id.blade_diameter))
|
||||||
'materials_type_id': product_template.materials_type_id.id}) for
|
# if int(tooth.blade_diameter) == int(self.specification_id.blade_diameter):
|
||||||
product_template in
|
# self.feed_per_tooth_ids = [(0, 0, {
|
||||||
self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
# 'cutting_speed': tooth.cutting_speed,
|
||||||
lambda r: r.blade_diameter == self.specification_id.blade_diameter)]
|
# 'machining_method': tooth.machining_method,
|
||||||
|
# 'blade_diameter': tooth.blade_diameter,
|
||||||
|
# 'materials_type_id': tooth.materials_type_id.id})]
|
||||||
|
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
||||||
|
lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter))
|
||||||
elif self.cutting_tool_type == '夹头':
|
elif self.cutting_tool_type == '夹头':
|
||||||
self.cutting_tool_clamping_length = self.specification_id.clamping_length
|
self.cutting_tool_clamping_length = self.specification_id.clamping_length
|
||||||
self.cutting_tool_clamping_tolerance = self.specification_id.clamping_tolerance
|
self.cutting_tool_clamping_tolerance = self.specification_id.clamping_tolerance
|
||||||
@@ -284,8 +290,8 @@ class ResProductMo(models.Model):
|
|||||||
elif self.cutting_tool_type == '刀柄':
|
elif self.cutting_tool_type == '刀柄':
|
||||||
self.cutting_tool_total_length = self.specification_id.total_length
|
self.cutting_tool_total_length = self.specification_id.total_length
|
||||||
self.cutting_tool_standard_speed = self.specification_id.standard_rotate_speed
|
self.cutting_tool_standard_speed = self.specification_id.standard_rotate_speed
|
||||||
self.cutting_tool_speed_max = self.specification_id.speed_max
|
self.cutting_tool_speed_max = self.specification_id.max_rotate_speed
|
||||||
self.cutting_tool_change_time = self.specification_id.change_time
|
self.cutting_tool_change_time = self.specification_id.tool_changing_time
|
||||||
self.cutting_tool_total_length = self.specification_id.total_length
|
self.cutting_tool_total_length = self.specification_id.total_length
|
||||||
self.cutting_tool_clamping_diameter_max = self.specification_id.max_clamping_diameter
|
self.cutting_tool_clamping_diameter_max = self.specification_id.max_clamping_diameter
|
||||||
self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter
|
self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter
|
||||||
@@ -313,6 +319,44 @@ class ResProductMo(models.Model):
|
|||||||
self.compaction_way_ids = [(6, 0,
|
self.compaction_way_ids = [(6, 0,
|
||||||
[])] if not self.cutting_tool_model_id.compaction_way_ids else [
|
[])] if not self.cutting_tool_model_id.compaction_way_ids else [
|
||||||
(6, 0, self.cutting_tool_model_id.compaction_way_ids.ids)]
|
(6, 0, self.cutting_tool_model_id.compaction_way_ids.ids)]
|
||||||
|
else:
|
||||||
|
self.cutting_tool_type_id = False
|
||||||
|
self.brand_id = False
|
||||||
|
self.tool_hardness = False
|
||||||
|
self.cutting_tool_run_out_accuracy_max = False
|
||||||
|
self.cutting_tool_run_out_accuracy_min = False
|
||||||
|
self.materials_type_id = False
|
||||||
|
self.cutting_tool_blade_type = False
|
||||||
|
self.cutting_tool_total_length = False
|
||||||
|
self.cutting_tool_clamping_way = False
|
||||||
|
self.cutting_tool_blade_diameter = False
|
||||||
|
self.cutting_tool_shank_length = False
|
||||||
|
self.cutting_tool_blade_length = False
|
||||||
|
self.cutting_tool_blade_number = False
|
||||||
|
self.cutting_tool_neck_length = False
|
||||||
|
self.cutting_tool_neck_diameter = False
|
||||||
|
self.cutting_tool_shank_diameter = False
|
||||||
|
self.cutting_tool_blade_tip_diameter = False
|
||||||
|
self.cutting_tool_blade_tip_taper = False
|
||||||
|
self.cutting_tool_blade_helix_angle = False
|
||||||
|
self.cutting_tool_blade_type = False
|
||||||
|
self.cutting_tool_pitch = False
|
||||||
|
self.cutting_tool_blade_width = False
|
||||||
|
self.cutting_tool_blade_depth = False
|
||||||
|
self.cutting_tool_cut_depth = False
|
||||||
|
self.cutting_tool_coarse_medium_fine = False
|
||||||
|
self.cutting_tool_run_out_accuracy_max = False
|
||||||
|
self.cutting_tool_run_out_accuracy_min = False
|
||||||
|
self.cutting_tool_blade_tip_working_size = False
|
||||||
|
self.fit_blade_shape_id = False
|
||||||
|
self.suitable_machining_method_ids = False
|
||||||
|
self.blade_tip_characteristics_id = False
|
||||||
|
self.handle_type_ids = False
|
||||||
|
self.cutting_direction_ids = False
|
||||||
|
self.suitable_coolant_ids = False
|
||||||
|
self.compaction_way_ids = False
|
||||||
|
self.cutting_speed_ids = False
|
||||||
|
self.feed_per_tooth_ids = False
|
||||||
|
|
||||||
# @api.constrains('suitable_machining_method_ids')
|
# @api.constrains('suitable_machining_method_ids')
|
||||||
# def _check_suitable_machining_method_ids(self):
|
# def _check_suitable_machining_method_ids(self):
|
||||||
@@ -899,7 +943,8 @@ class SfMaintenanceEquipmentTool(models.Model):
|
|||||||
_description = '机床刀位'
|
_description = '机床刀位'
|
||||||
|
|
||||||
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
||||||
product_template_id = fields.Many2one('product.template', string='功能刀具名称', domain="[('categ_type', '=', '刀具')]")
|
product_template_id = fields.Many2one('product.template', string='功能刀具名称',
|
||||||
|
domain="[('categ_type', '=', '刀具')]")
|
||||||
image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
|
image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
|
||||||
categ_type = fields.Char(string='功能刀具类型')
|
categ_type = fields.Char(string='功能刀具类型')
|
||||||
diameter = fields.Char('直径')
|
diameter = fields.Char('直径')
|
||||||
@@ -911,5 +956,3 @@ class SfMaintenanceEquipmentTool(models.Model):
|
|||||||
alarm_value = fields.Char('报警值')
|
alarm_value = fields.Char('报警值')
|
||||||
used_value = fields.Char('已使用值')
|
used_value = fields.Char('已使用值')
|
||||||
code = fields.Char('机床刀位号')
|
code = fields.Char('机床刀位号')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import logging
|
import logging
|
||||||
import base64
|
import base64
|
||||||
|
<<<<<<<
|
||||||
from collections import defaultdict, namedtuple
|
from collections import defaultdict, namedtuple
|
||||||
import requests
|
import requests
|
||||||
|
import logging
|
||||||
|
import json
|
||||||
from re import findall as regex_findall
|
from re import findall as regex_findall
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from re import split as regex_split
|
from re import split as regex_split
|
||||||
|
import requests
|
||||||
from odoo import SUPERUSER_ID, _, api, fields, models
|
from odoo import SUPERUSER_ID, _, api, fields, models
|
||||||
from odoo.tools import float_compare
|
from odoo.tools import float_compare
|
||||||
|
from collections import defaultdict, namedtuple
|
||||||
from odoo.addons.stock.models.stock_rule import ProcurementException
|
from odoo.addons.stock.models.stock_rule import ProcurementException
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
from odoo.exceptions import ValidationError, UserError
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
@@ -306,12 +312,12 @@ class StockPicking(models.Model):
|
|||||||
|
|
||||||
res = super().button_validate()
|
res = super().button_validate()
|
||||||
# 采购单验证(夹具)
|
# 采购单验证(夹具)
|
||||||
for item in self.move_ids_without_package:
|
# for item in self.move_ids_without_package:
|
||||||
if item.quantity_done > 0:
|
# if item.quantity_done > 0:
|
||||||
if item.product_id.categ_type == '夹具':
|
# if item.product_id.categ_type == '夹具':
|
||||||
item._register_fixture()
|
# item._register_fixture()
|
||||||
elif item.product_id.categ_type == '刀具':
|
# elif item.product_id.categ_type == '刀具':
|
||||||
item._register_cutting_tool()
|
# item._register_cutting_tool()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
# 创建 外协出库入单
|
# 创建 外协出库入单
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ class CustomKanbanController extends KanbanController {
|
|||||||
console.log('99999999111');
|
console.log('99999999111');
|
||||||
this.workOrders = await this.getAllWorkOrders();
|
this.workOrders = await this.getAllWorkOrders();
|
||||||
this.workOrdersNew = this.workOrders;
|
this.workOrdersNew = this.workOrders;
|
||||||
console.log('lines222222222', this.workOrders);
|
// console.log('lines222222222', this.workOrders);
|
||||||
|
//
|
||||||
console.log(typeof this.workOrders);
|
// console.log(typeof this.workOrders);
|
||||||
console.log(Array.isArray(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));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -104,5 +104,56 @@
|
|||||||
<!-- <filter string="草稿" name="filter_draft" domain="[('state', '=', 'draft')]"/> -->
|
<!-- <filter string="草稿" name="filter_draft" domain="[('state', '=', 'draft')]"/> -->
|
||||||
<!-- </xpath> -->
|
<!-- </xpath> -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 产品模板修改>>>增加“规格”字段specification_id -->
|
||||||
|
<record id="custom_product_template_kanban_view" model="ir.ui.view">
|
||||||
|
<field name="name">custom.Product.template.product.kanban</field>
|
||||||
|
<field name="model">product.template</field>
|
||||||
|
<field name="inherit_id" ref="product.product_template_kanban_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//kanban" position="replace">
|
||||||
|
<kanban sample="1" class="o_kanban_product_template">
|
||||||
|
<field name="id"/>
|
||||||
|
<field name="product_variant_count"/>
|
||||||
|
<field name="currency_id"/>
|
||||||
|
<field name="activity_state"/>
|
||||||
|
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
|
||||||
|
<templates>
|
||||||
|
<t t-name="kanban-box">
|
||||||
|
<div class="oe_kanban_card oe_kanban_global_click">
|
||||||
|
<div class="o_kanban_image me-1">
|
||||||
|
<img t-att-src="kanban_image('product.template', 'image_128', record.id.raw_value)" alt="Product" class="o_image_64_contain"/>
|
||||||
|
</div>
|
||||||
|
<div class="oe_kanban_details">
|
||||||
|
<div class="o_kanban_record_top mb-0">
|
||||||
|
<div class="o_kanban_record_headings">
|
||||||
|
<strong class="o_kanban_record_title">
|
||||||
|
<field name="name"/>
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
<field name="priority" widget="priority"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div name="product_specification_id" class="mt-1">
|
||||||
|
规格: <field name="specification_id"></field>
|
||||||
|
</div>
|
||||||
|
<t t-if="record.default_code.value">[<field name="default_code"/>]</t>
|
||||||
|
<div t-if="record.product_variant_count.value > 1" groups="product.group_product_variant">
|
||||||
|
<strong>
|
||||||
|
<t t-esc="record.product_variant_count.value"/> Variants
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
<div name="product_lst_price" class="mt-1">
|
||||||
|
价格: <field name="list_price" widget="monetary" options="{'currency_field': 'currency_id', 'field_digits': True}"></field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
|
</kanban>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import base64
|
import base64
|
||||||
import json, requests
|
import json
|
||||||
from odoo import models, fields, api, _
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
import requests
|
||||||
|
from odoo import models, fields, api, _
|
||||||
from odoo.exceptions import UserError, ValidationError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
|
|
||||||
|
|
||||||
# sf排程
|
# sf排程
|
||||||
class sf_production_plan(models.Model):
|
class sf_production_plan(models.Model):
|
||||||
_name = 'sf.production.plan'
|
_name = 'sf.production.plan'
|
||||||
# _inherit = 'mrp.production'
|
|
||||||
_description = 'sf_production_plan'
|
_description = 'sf_production_plan'
|
||||||
_order = 'create_date desc'
|
_order = 'create_date desc'
|
||||||
|
|
||||||
@@ -42,22 +42,13 @@ class sf_production_plan(models.Model):
|
|||||||
actual_end_time = fields.Datetime(string='实际结束时间')
|
actual_end_time = fields.Datetime(string='实际结束时间')
|
||||||
shift = fields.Char(string='班次')
|
shift = fields.Char(string='班次')
|
||||||
|
|
||||||
# 序号、坯料编号、坯料名称、材质、数量、长度、宽度、厚度、直径、计划开始时间、计划结束时间、状态(已产出与待产出)、操作、创建人、创建时间、客户名称、订单号、行号、长度、宽度、厚度、直径、交货数量、交货日期
|
# 序号、坯料编号、坯料名称、材质、数量、长度、宽度、厚度、直径、计划开始时间、计划结束时间、状态(已产出与待产出)、操作、创建人、创建时间、
|
||||||
|
# 客户名称、订单号、行号、长度、宽度、厚度、直径、交货数量、交货日期
|
||||||
# sequence = fields.Integer(string='序号', required=True, copy=False, readonly=True, index=True,
|
# sequence = fields.Integer(string='序号', required=True, copy=False, readonly=True, index=True,
|
||||||
# default=lambda self: self.env['ir.sequence'].sudo().next_by_code('sf.pl.plan'))
|
# default=lambda self: self.env['ir.sequence'].sudo().next_by_code('sf.pl.plan'))
|
||||||
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
|
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
|
||||||
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
|
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
|
||||||
|
|
||||||
# state = fields.Selection([
|
|
||||||
# ('未排程', '未排程'), ('已排程', '已排程')], string='State', copy=False, index=True, readonly=True,
|
|
||||||
# store=True, tracking=True)
|
|
||||||
|
|
||||||
# orderpoint_id = fields.Many2one('stock.warehouse.orderpoint', compute='_compute_orderpoint_id')
|
|
||||||
# location_src_id = fields.Many2one('stock.location', 'Components Location', compute='_compute_orderpoint_id', active=False)
|
|
||||||
# location_dest_id = fields.Many2one('stock.location', 'Finished Products Location', compute='_compute_orderpoint_id')
|
|
||||||
# picking_type_id = fields.Many2one('stock.picking.type', 'Operation Type', compute='_compute_orderpoint_id')
|
|
||||||
# move_dest_ids = fields.One2many('stock.move', 'created_production_id', compute='_compute_orderpoint_id')
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def get_import_templates(self):
|
def get_import_templates(self):
|
||||||
"""returns the xlsx import template file"""
|
"""returns the xlsx import template file"""
|
||||||
@@ -136,112 +127,6 @@ class sf_production_plan(models.Model):
|
|||||||
|
|
||||||
return num
|
return num
|
||||||
|
|
||||||
# pl_no = fields.Char(string='坯料编号', required=True, default=_get_pl_no, readonly=True)
|
|
||||||
# pl_name = fields.Char(string='坯料名称', size=64, required=True)
|
|
||||||
# material = fields.Many2one('sf.production.materials', string='材质', required=True)
|
|
||||||
# quantity = fields.Float(string='数量', required=True)
|
|
||||||
# length = fields.Float(string='长度', required=True)
|
|
||||||
# width = fields.Float(string='宽度', required=True)
|
|
||||||
# thickness = fields.Float(string='厚度', required=True)
|
|
||||||
# diameter = fields.Float(string='直径', required=True)
|
|
||||||
# plan_start_time = fields.Datetime(string='计划开始时间')
|
|
||||||
# plan_end_time = fields.Datetime(string='计划结束时间')
|
|
||||||
# state = fields.Selection([
|
|
||||||
# ('draft', '待排程'),
|
|
||||||
# ('produce', '已排程'),
|
|
||||||
# ('done', '已产出'),
|
|
||||||
# ], string='状态', copy=False, index=True, default='draft')
|
|
||||||
# customer_name = fields.Char(string='客户名称', size=64)
|
|
||||||
# order_no = fields.Char(string='订单号', size=64)
|
|
||||||
# line_no = fields.Char(string='行号', size=64)
|
|
||||||
# delivery_length = fields.Float(string='交货长度')
|
|
||||||
# delivery_width = fields.Float(string='交货宽度')
|
|
||||||
# delivery_thickness = fields.Float(string='交货厚度')
|
|
||||||
# delivery_diameter = fields.Float(string='交货直径')
|
|
||||||
# delivery_quantity = fields.Float(string='交货数量')
|
|
||||||
# delivery_date = fields.Datetime(string='交货日期', related='plan_end_time', readonly=False, store=True)
|
|
||||||
|
|
||||||
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
|
|
||||||
# def do_production_schedule(self):
|
|
||||||
# """
|
|
||||||
# 排程方法
|
|
||||||
# """
|
|
||||||
# if not self.production_line_id:
|
|
||||||
# raise ValidationError("未选择生产线")
|
|
||||||
# else:
|
|
||||||
# aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)])
|
|
||||||
# workorder_time = 0
|
|
||||||
# workorder_id_list = self.production_id.workorder_ids.ids
|
|
||||||
# print(workorder_id_list)
|
|
||||||
# print(type(self.production_id.workorder_ids))
|
|
||||||
# if self.production_id.workorder_ids:
|
|
||||||
# for item in self.production_id.workorder_ids:
|
|
||||||
# if item.name == 'CNC加工':
|
|
||||||
# item.date_planned_start = self.date_planned_start
|
|
||||||
# item.date_planned_finished = item.date_planned_start + timedelta(
|
|
||||||
# minutes=self.env['mrp.routing.workcenter'].sudo().search(
|
|
||||||
# [('name', '=', 'CNC加工')]).time_cycle)
|
|
||||||
# item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
|
||||||
# [('name', '=', 'CNC加工')]).time_cycle
|
|
||||||
# # print(item.id)
|
|
||||||
# sequence = workorder_id_list.index(item.id) - 1
|
|
||||||
# # print('sequence', sequence)
|
|
||||||
# # print('total', len(workorder_id_list))
|
|
||||||
# # 计算CNC加工之前工单的开始结束时间
|
|
||||||
# for i in range(sequence):
|
|
||||||
# current_workorder_id = (item.id - (i + 1))
|
|
||||||
# current_workorder_obj = self.env['mrp.workorder'].sudo().search(
|
|
||||||
# [('id', '=', current_workorder_id)])
|
|
||||||
# old_workorder_obj = self.env['mrp.workorder'].sudo().search(
|
|
||||||
# [('id', '=', (current_workorder_id + 1))])
|
|
||||||
# work_order = self.env['mrp.workorder'].sudo().search(
|
|
||||||
# [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)])
|
|
||||||
# work_order.date_planned_finished = old_workorder_obj.date_planned_start
|
|
||||||
# work_order.date_planned_start = old_workorder_obj.date_planned_start - timedelta(
|
|
||||||
# minutes=self.env['mrp.routing.workcenter'].sudo().search(
|
|
||||||
# [('name', '=', current_workorder_obj.name)]).time_cycle)
|
|
||||||
# work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
|
||||||
# [('name', '=', current_workorder_obj.name)]).time_cycle
|
|
||||||
# # 计算CNC加工之后工单的开始结束时间
|
|
||||||
# for j in range(len(workorder_id_list) - sequence - 2):
|
|
||||||
# current_workorder_id = (item.id + (j + 1))
|
|
||||||
# current_workorder_obj = self.env['mrp.workorder'].sudo().search(
|
|
||||||
# [('id', '=', current_workorder_id)])
|
|
||||||
# old_workorder_obj = self.env['mrp.workorder'].sudo().search(
|
|
||||||
# [('id', '=', (current_workorder_id - 1))])
|
|
||||||
# work_order = self.env['mrp.workorder'].sudo().search(
|
|
||||||
# [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)])
|
|
||||||
# try:
|
|
||||||
# work_order.date_planned_start = old_workorder_obj.date_planned_finished
|
|
||||||
# print('work_order.data_start', work_order.date_planned_start)
|
|
||||||
# work_order.date_planned_finished = old_workorder_obj.date_planned_finished + timedelta(
|
|
||||||
# minutes=self.env['mrp.routing.workcenter'].sudo().search(
|
|
||||||
# [('name', '=', current_workorder_obj.name)]).time_cycle)
|
|
||||||
# work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
|
||||||
# [('name', '=', current_workorder_obj.name)]).time_cycle
|
|
||||||
# except ValueError as e:
|
|
||||||
# print('时间设置失败,请检查是否为工序分配工作中心,%s' % e)
|
|
||||||
#
|
|
||||||
# current_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', item.id)])
|
|
||||||
# workorder_time += current_workorder.duration_expected
|
|
||||||
# print('workorder_time', workorder_time)
|
|
||||||
# self.date_planned_finished = self.date_planned_start + timedelta(minutes=workorder_time)
|
|
||||||
# self.state = 'done'
|
|
||||||
# self.production_id.schedule_state = '已排'
|
|
||||||
# # self.production_id.date_planned_start = self.date_planned_start
|
|
||||||
# # self.production_id.date_planned_finished = self.date_planned_finished
|
|
||||||
# else:
|
|
||||||
# raise ValidationError("未找到工单")
|
|
||||||
# # self.date_planned_finished = self.date_planned_start + timedelta(days=3)
|
|
||||||
# # self.state = 'done'
|
|
||||||
# return {
|
|
||||||
# 'name': '排程甘特图',
|
|
||||||
# 'type': 'ir.actions.act_window',
|
|
||||||
# 'res_model': 'sf.production.plan', # 要跳转的模型名称
|
|
||||||
# 'view_mode': 'gantt,tree,form', # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
|
|
||||||
# 'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
|
|
||||||
# }
|
|
||||||
|
|
||||||
def do_production_schedule(self):
|
def do_production_schedule(self):
|
||||||
"""
|
"""
|
||||||
排程方法
|
排程方法
|
||||||
@@ -262,7 +147,8 @@ class sf_production_plan(models.Model):
|
|||||||
[('name', '=', 'CNC加工')]).time_cycle
|
[('name', '=', 'CNC加工')]).time_cycle
|
||||||
self.calculate_plan_time_before(item, workorder_id_list)
|
self.calculate_plan_time_before(item, workorder_id_list)
|
||||||
self.calculate_plan_time_after(item, workorder_id_list)
|
self.calculate_plan_time_after(item, workorder_id_list)
|
||||||
self.date_planned_start, self.date_planned_finished = item.date_planned_start, item.date_planned_finished
|
self.date_planned_start, self.date_planned_finished = \
|
||||||
|
item.date_planned_start, item.date_planned_finished
|
||||||
self.state = 'done'
|
self.state = 'done'
|
||||||
self.production_id.schedule_state = '已排'
|
self.production_id.schedule_state = '已排'
|
||||||
# self.production_id.date_planned_start = self.date_planned_start
|
# self.production_id.date_planned_start = self.date_planned_start
|
||||||
@@ -275,7 +161,8 @@ class sf_production_plan(models.Model):
|
|||||||
'name': '排程甘特图',
|
'name': '排程甘特图',
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
'res_model': 'sf.production.plan', # 要跳转的模型名称
|
'res_model': 'sf.production.plan', # 要跳转的模型名称
|
||||||
'view_mode': 'gantt,tree,form', # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
|
# 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
|
||||||
|
'view_mode': 'gantt,tree,form',
|
||||||
'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
|
'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +236,6 @@ class sf_production_plan(models.Model):
|
|||||||
'bfm_process_order_list': []}
|
'bfm_process_order_list': []}
|
||||||
aa = self.env['ir.attachment'].search([('id', '=', 631)])
|
aa = self.env['ir.attachment'].search([('id', '=', 631)])
|
||||||
temp = self.env['product.template'].search([('id', '=', 47)])
|
temp = self.env['product.template'].search([('id', '=', 47)])
|
||||||
item = aa.datas.decode('utf-8')
|
|
||||||
val = {
|
val = {
|
||||||
'model_long': 3,
|
'model_long': 3,
|
||||||
'model_width': 1,
|
'model_width': 1,
|
||||||
|
|||||||
@@ -24,10 +24,9 @@
|
|||||||
|
|
||||||
'web.assets_qweb': [
|
'web.assets_qweb': [
|
||||||
],
|
],
|
||||||
'web.assets_backend':[
|
'web.assets_backend': [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ class SfQualityPoint(models.Model):
|
|||||||
|
|
||||||
product_ids = fields.Many2many(
|
product_ids = fields.Many2many(
|
||||||
'product.product', string='适用产品',
|
'product.product', string='适用产品',
|
||||||
domain="[('type', 'in', ('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]",
|
domain="[('type', 'in', "
|
||||||
help="Quality Point will apply to every selected Products.")
|
"('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]", help=
|
||||||
|
"Quality Point will apply to every selected Products.")
|
||||||
# picking_type_ids = fields.Many2many(
|
# picking_type_ids = fields.Many2many(
|
||||||
# 'stock.picking.type', string='执行节点', required=True, check_company=True)
|
# 'stock.picking.type', string='执行节点', required=True, check_company=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ class AutoQuatotion(models.Model):
|
|||||||
def get_process_time_db_path(self):
|
def get_process_time_db_path(self):
|
||||||
return get_resource_path('sf_sale', 'models', 'process_time.db')
|
return get_resource_path('sf_sale', 'models', 'process_time.db')
|
||||||
|
|
||||||
# def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code):
|
def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code):
|
||||||
# '''
|
'''
|
||||||
# 通过打包好的.so库,
|
通过打包好的.so库,
|
||||||
# 以调用autoQuatotion库中Quatotion类,
|
以调用autoQuatotion库中Quatotion类,
|
||||||
# 初始化后调用类的analyseShape方法对模型文件进行价格预测
|
初始化后调用类的analyseShape方法对模型文件进行价格预测
|
||||||
# '''
|
'''
|
||||||
# # 初始化自动报价类(输入特征数据库和加工时间数据库)
|
# 初始化自动报价类(输入特征数据库和加工时间数据库)
|
||||||
# reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path)
|
reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path)
|
||||||
# # 获取价格、加工时间、尺寸、XYZ、翻面次数
|
# 获取价格、加工时间、尺寸、XYZ、翻面次数
|
||||||
# feature_info = reader.analyseShape(stp_url, InfoJson={})
|
feature_info = reader.analyseShape(stp_url, InfoJson={})
|
||||||
# return feature_info
|
return feature_info
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
from . import base
|
from . import base
|
||||||
from . import tool_material_search
|
from . import tool_material_search
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ class SfToolMaterialSearch(models.Model):
|
|||||||
mrs_cutting_tool_material_name = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料名称',
|
mrs_cutting_tool_material_name = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料名称',
|
||||||
store=True)
|
store=True)
|
||||||
cutting_tool_type = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料类型', store=True)
|
cutting_tool_type = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料类型', store=True)
|
||||||
mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True, domain="[('tag_ids.name', 'ilike', '刀具')]")
|
mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True,
|
||||||
|
domain="[('tag_ids.name', 'ilike', '刀具')]")
|
||||||
# 关联刀具型号
|
# 关联刀具型号
|
||||||
# mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号')
|
# mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号')
|
||||||
|
|
||||||
# 关联刀具物料模型
|
# 关联刀具物料模型
|
||||||
mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
|
mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
|
||||||
group_expand='_read_group_mrs_cutting_tool_material_ids', required=True)
|
group_expand='_read_group_mrs_cutting_tool_material_ids',
|
||||||
|
required=True)
|
||||||
cutting_tool_material_name = fields.Char(string='物料名称', invisible=True)
|
cutting_tool_material_name = fields.Char(string='物料名称', invisible=True)
|
||||||
|
|
||||||
@api.onchange('mrs_cutting_tool_material_id')
|
@api.onchange('mrs_cutting_tool_material_id')
|
||||||
@@ -91,15 +93,15 @@ class SfToolMaterialSearch(models.Model):
|
|||||||
# integral_blade_material = fields.Selection([('碳素钢', '碳素钢'), ('硬质合金', '硬质合金')], '整体式刀具刀具材质')
|
# integral_blade_material = fields.Selection([('碳素钢', '碳素钢'), ('硬质合金', '硬质合金')], '整体式刀具刀具材质')
|
||||||
integral_hardness = fields.Integer('整体式刀具硬度(HRC)')
|
integral_hardness = fields.Integer('整体式刀具硬度(HRC)')
|
||||||
integral_coating_material = fields.Char('整体式刀具涂层材质')
|
integral_coating_material = fields.Char('整体式刀具涂层材质')
|
||||||
integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6,1))
|
integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6, 1))
|
||||||
integral_run_out_accuracy_min = fields.Float('整体式刀具端跳精度min', digits=(6, 1))
|
integral_run_out_accuracy_min = fields.Float('整体式刀具端跳精度min', digits=(6, 1))
|
||||||
|
|
||||||
suitable_machining_method_ids = fields.Many2many('maintenance.equipment.image',
|
suitable_machining_method_ids = fields.Many2many('maintenance.equipment.image',
|
||||||
'rel_machining_product_template_material_search', '适合加工方式',
|
'rel_machining_product_template_material_search', '适合加工方式',
|
||||||
domain=[('type', '=', '加工能力')])
|
domain=[('type', '=', '加工能力')])
|
||||||
blade_tip_characteristics_id = fields.Many2many('maintenance.equipment.image',
|
blade_tip_characteristics_id = fields.Many2many('maintenance.equipment.image',
|
||||||
'rel_blade_tip_product_template_material_search', '刀尖特征',
|
'rel_blade_tip_product_template_material_search', '刀尖特征',
|
||||||
domain=[('type', '=', '刀尖特征')])
|
domain=[('type', '=', '刀尖特征')])
|
||||||
handle_type_ids = fields.Many2many('maintenance.equipment.image',
|
handle_type_ids = fields.Many2many('maintenance.equipment.image',
|
||||||
'rel_handle_product_template_material_search', '柄部类型',
|
'rel_handle_product_template_material_search', '柄部类型',
|
||||||
domain=[('type', '=', '柄部类型')])
|
domain=[('type', '=', '柄部类型')])
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
'web.assets_qweb': [
|
'web.assets_qweb': [
|
||||||
],
|
],
|
||||||
|
|
||||||
'web.assets_backend':[
|
'web.assets_backend': [
|
||||||
# 'sf_warehouse/static/src/js/vanilla-masker.min.js',
|
# 'sf_warehouse/static/src/js/vanilla-masker.min.js',
|
||||||
'sf_warehouse/static/src/css/kanban_color_change.scss',
|
'sf_warehouse/static/src/css/kanban_color_change.scss',
|
||||||
'sf_warehouse/static/src/js/custom_kanban_controller.js',
|
'sf_warehouse/static/src/js/custom_kanban_controller.js',
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
from . import model
|
from . import model
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,8 @@ class SfLocation(models.Model):
|
|||||||
# def generate_barcode(self, i, j):
|
# def generate_barcode(self, i, j):
|
||||||
# # 这里是你生成barcode的代码
|
# # 这里是你生成barcode的代码
|
||||||
# area_type_barcode = self.location_id.barcode
|
# area_type_barcode = self.location_id.barcode
|
||||||
# return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + str(i + 1) + '-' + str(j + 1)
|
# return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + str(i + 1) + '-'
|
||||||
|
# + str(j + 1)
|
||||||
|
|
||||||
|
|
||||||
class SfProcurementGroup(models.Model):
|
class SfProcurementGroup(models.Model):
|
||||||
@@ -223,7 +224,8 @@ class SfProcurementGroup(models.Model):
|
|||||||
res_list = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]),
|
res_list = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]),
|
||||||
order='route_sequence, sequence')
|
order='route_sequence, sequence')
|
||||||
for res1 in res_list:
|
for res1 in res_list:
|
||||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type:
|
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \
|
||||||
|
res1.location_src_id.product_type:
|
||||||
res = res1
|
res = res1
|
||||||
if not res:
|
if not res:
|
||||||
res = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]),
|
res = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]),
|
||||||
@@ -235,7 +237,8 @@ class SfProcurementGroup(models.Model):
|
|||||||
res_list = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]),
|
res_list = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]),
|
||||||
order='route_sequence, sequence')
|
order='route_sequence, sequence')
|
||||||
for res1 in res_list:
|
for res1 in res_list:
|
||||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type:
|
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \
|
||||||
|
res1.location_src_id.product_type:
|
||||||
res = res1
|
res = res1
|
||||||
if not res:
|
if not res:
|
||||||
res = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]),
|
res = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]),
|
||||||
@@ -246,7 +249,8 @@ class SfProcurementGroup(models.Model):
|
|||||||
res_list = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]),
|
res_list = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]),
|
||||||
order='route_sequence, sequence')
|
order='route_sequence, sequence')
|
||||||
for res1 in res_list:
|
for res1 in res_list:
|
||||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type:
|
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \
|
||||||
|
res1.location_src_id.product_type:
|
||||||
res = res1
|
res = res1
|
||||||
if not res:
|
if not res:
|
||||||
res = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]),
|
res = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]),
|
||||||
@@ -257,7 +261,8 @@ class SfProcurementGroup(models.Model):
|
|||||||
res_list = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]),
|
res_list = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]),
|
||||||
order='route_sequence, sequence')
|
order='route_sequence, sequence')
|
||||||
for res1 in res_list:
|
for res1 in res_list:
|
||||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type:
|
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \
|
||||||
|
res1.location_src_id.product_type:
|
||||||
res = res1
|
res = res1
|
||||||
if not res:
|
if not res:
|
||||||
res = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]),
|
res = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]),
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ from odoo.http import request
|
|||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -44,9 +42,3 @@ class WxWorkApproval(models.Model):
|
|||||||
# ], string='请假类型')
|
# ], string='请假类型')
|
||||||
# leave_days = fields.Float(string='Leave Days')
|
# leave_days = fields.Float(string='Leave Days')
|
||||||
# overtime_hours = fields.Float(string='Overtime Hours')
|
# overtime_hours = fields.Float(string='Overtime Hours')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ class WxSettings(models.Model):
|
|||||||
# 'control_type': child_data.get('property', {}).get('control', None),
|
# 'control_type': child_data.get('property', {}).get('control', None),
|
||||||
# 'unique_control_id': child_data.get('property', {}).get('id', None),
|
# 'unique_control_id': child_data.get('property', {}).get('id', None),
|
||||||
# 'title': child_data.get('property', {}).get('title', [{}])[0].get('text', None),
|
# 'title': child_data.get('property', {}).get('title', [{}])[0].get('text', None),
|
||||||
# 'placeholder': child_data.get('property', {}).get('placeholder', [{}])[0].get('text', None),
|
# 'placeholder': child_data.get('property', {}).get('placeholder', [{}])[0].
|
||||||
|
# get('text', None),
|
||||||
# 'require': child_data.get('property', {}).get('require', None),
|
# 'require': child_data.get('property', {}).get('require', None),
|
||||||
# 'un_print': child_data.get('property', {}).get('un_print', None),
|
# 'un_print': child_data.get('property', {}).get('un_print', None),
|
||||||
# 'un_replace': child_data.get('property', {}).get('un_replace', None),
|
# 'un_replace': child_data.get('property', {}).get('un_replace', None),
|
||||||
@@ -99,7 +100,8 @@ class WxSettings(models.Model):
|
|||||||
# 例如:
|
# 例如:
|
||||||
config_id_data = {
|
config_id_data = {
|
||||||
'date_type': [(0, 0, {'date_type': child_data.get('config', {}).get('date', {}).get('type',
|
'date_type': [(0, 0, {'date_type': child_data.get('config', {}).get('date', {}).get('type',
|
||||||
None)})] if 'date' in child_data.get(
|
None)})]
|
||||||
|
if 'date' in child_data.get(
|
||||||
'config', {}) else [],
|
'config', {}) else [],
|
||||||
'selector_type': [(0, 0, {
|
'selector_type': [(0, 0, {
|
||||||
'selector_type': 'single',
|
'selector_type': 'single',
|
||||||
@@ -108,26 +110,14 @@ class WxSettings(models.Model):
|
|||||||
'contact_type': [
|
'contact_type': [
|
||||||
(0, 0, {'contact_type': config_data.get('contact', {}).get('type', None),
|
(0, 0, {'contact_type': config_data.get('contact', {}).get('type', None),
|
||||||
'contact_mode': config_data.get('contact', {}).get('mode',
|
'contact_mode': config_data.get('contact', {}).get('mode',
|
||||||
None)})] if 'contact' in child_data.get(
|
None)})] if 'contact' in
|
||||||
|
child_data.get(
|
||||||
'config', {}).get('contact', {}) else [],
|
'config', {}).get('contact', {}) else [],
|
||||||
'file_type': [
|
'file_type': [
|
||||||
(0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo',
|
(0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo',
|
||||||
None)})] if 'file' in child_data.get(
|
None)})] if 'file' in
|
||||||
|
child_data.get(
|
||||||
'config', {}).get('file', {}) else [],
|
'config', {}).get('file', {}) else [],
|
||||||
# 'table_type': [(0, 0, {
|
|
||||||
# 'table_children': [
|
|
||||||
# (0, 0, {'control_type': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('control', None),
|
|
||||||
# 'unique_control_id': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('id', None),
|
|
||||||
# 'title': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('title', None)[0].get('text', None),
|
|
||||||
# 'placeholder': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('placeholder', None)[0].get('text', None),
|
|
||||||
# 'require': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('require', None),
|
|
||||||
# 'un_print': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('un_print', None),
|
|
||||||
# 'un_replace': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('un_replace', None),
|
|
||||||
# 'display': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('display', None),
|
|
||||||
# })],
|
|
||||||
# })] if 'table' in config_data else [],
|
|
||||||
# 'attendance_type': [(0, 0, {'attendance_type': '1',
|
|
||||||
# 'attendance_date_range_type': 'hour'})] if 'attendance' in config_data else [],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 将config_id_data添加到property_data中(如果有的话)
|
# 将config_id_data添加到property_data中(如果有的话)
|
||||||
@@ -152,16 +142,9 @@ class WxSettings(models.Model):
|
|||||||
'display': property_data.get('display', None),
|
'display': property_data.get('display', None),
|
||||||
})],
|
})],
|
||||||
'config_id': [(0, 0, {
|
'config_id': [(0, 0, {
|
||||||
'date_type': [(0, 0, {'date_type': config_data.get('date', {}).get('type',
|
'date_type': [(0, 0, {'date_type':
|
||||||
None)})] if 'date' in config_data else [],
|
config_data.get('date', {}).get(
|
||||||
# 'selector_type': [(0, 0, {
|
'type', None)})] if 'date' in config_data else [],
|
||||||
# 'selector_type': config_data['table']['children'][0].get('config', {}).get(
|
|
||||||
# 'selector', {}).get('type', None),
|
|
||||||
# 'options': [
|
|
||||||
# (0, 0, {'key': option['key'], 'text': option['value'][0]['text']})
|
|
||||||
# for option in config_data['table']['children'][0].get('config', {}).get('selector', {}).get('options', [])
|
|
||||||
# ],
|
|
||||||
# })] if 'selector' in config_data else [],
|
|
||||||
'selector_type': [
|
'selector_type': [
|
||||||
(0, 0, {
|
(0, 0, {
|
||||||
'selector_type': child.get('config', {}).get('selector', {}).get('type', None),
|
'selector_type': child.get('config', {}).get('selector', {}).get('type', None),
|
||||||
@@ -177,10 +160,12 @@ class WxSettings(models.Model):
|
|||||||
'contact_type': [
|
'contact_type': [
|
||||||
(0, 0, {'contact_type': config_data.get('contact', {}).get('type', None),
|
(0, 0, {'contact_type': config_data.get('contact', {}).get('type', None),
|
||||||
'contact_mode': config_data.get('contact', {}).get('mode',
|
'contact_mode': config_data.get('contact', {}).get('mode',
|
||||||
None)})] if 'contact' in config_data else [],
|
None)})]
|
||||||
|
if 'contact' in config_data else [],
|
||||||
'file_type': [
|
'file_type': [
|
||||||
(0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo',
|
(0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo',
|
||||||
None)})] if 'file' in config_data else [],
|
None)})]
|
||||||
|
if 'file' in config_data else [],
|
||||||
'table_type': [(0, 0, {
|
'table_type': [(0, 0, {
|
||||||
'table_children': table_children_records,
|
'table_children': table_children_records,
|
||||||
})] if 'table' in config_data else [],
|
})] if 'table' in config_data else [],
|
||||||
@@ -200,7 +185,8 @@ class WxSettings(models.Model):
|
|||||||
# # 'title': '文本框2'})]
|
# # 'title': '文本框2'})]
|
||||||
|
|
||||||
'attendance_type': [(0, 0, {'attendance_type': '1',
|
'attendance_type': [(0, 0, {'attendance_type': '1',
|
||||||
'attendance_date_range_type': 'hour'})] if 'attendance' in config_data else [],
|
'attendance_date_range_type': 'hour'})]
|
||||||
|
if 'attendance' in config_data else [],
|
||||||
})],
|
})],
|
||||||
}),
|
}),
|
||||||
# 在这里添加更多的控件数据
|
# 在这里添加更多的控件数据
|
||||||
|
|||||||
Reference in New Issue
Block a user