Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修复报废

This commit is contained in:
jinling.yang
2024-08-27 08:53:29 +08:00
18 changed files with 169 additions and 36 deletions

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import controllers
from . import models

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
{
'name': "jikimo_account_process",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "My Company",
'website': "https://www.yourcompany.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base', 'account'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
# 'views/views.xml',
# 'views/templates.xml',
],
# only loaded in demonstration mode
'demo': [
# 'demo/demo.xml',
],
}

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# from odoo import http
# class JikimoAccountProcess(http.Controller):
# @http.route('/jikimo_account_process/jikimo_account_process', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/jikimo_account_process/jikimo_account_process/objects', auth='public')
# def list(self, **kw):
# return http.request.render('jikimo_account_process.listing', {
# 'root': '/jikimo_account_process/jikimo_account_process',
# 'objects': http.request.env['jikimo_account_process.jikimo_account_process'].search([]),
# })
# @http.route('/jikimo_account_process/jikimo_account_process/objects/<model("jikimo_account_process.jikimo_account_process"):obj>', auth='public')
# def object(self, obj, **kw):
# return http.request.render('jikimo_account_process.object', {
# 'object': obj
# })

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import models
from . import account_move

View File

@@ -0,0 +1,15 @@
from odoo import models, fields, api
from odoo.exceptions import ValidationError
class CustomAccountMoveLine(models.Model):
_inherit = 'account.move'
_description = "account move line"
@api.model_create_multi
def create(self, vals):
for val in vals:
val['name'] = self.env['ir.sequence'].next_by_code('account.move') or '/'
# 因为供应商与客户支付创建流程是先创建move line在修改来填充account_payment与move line的关联
return super(CustomAccountMoveLine, self).create(vals)

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# from odoo import models, fields, api
# class jikimo_account_process(models.Model):
# _name = 'jikimo_account_process.jikimo_account_process'
# _description = 'jikimo_account_process.jikimo_account_process'
# name = fields.Char()
# value = fields.Integer()
# value2 = fields.Float(compute="_value_pc", store=True)
# description = fields.Text()
#
# @api.depends('value')
# def _value_pc(self):
# for record in self:
# record.value2 = float(record.value) / 100

View File

@@ -324,4 +324,4 @@ def unlink(self):
BaseModel._create = _create
BaseModel.unlink = unlink
# BaseModel.unlink = unlink

View File

@@ -96,7 +96,7 @@ class MrsProductionProcess(models.Model):
# workcenter_ids = fields.Many2many('mrp.workcenter', 'rel_workcenter_process', required=True)
processing_day = fields.Float('加工天数/d')
travel_day = fields.Float('路途天数/d')
sequence = fields.Integer('排序')
# class MrsProcessingTechnology(models.Model):
# _name = 'sf.processing.technology'
@@ -148,6 +148,7 @@ class MrsProductionProcessParameter(models.Model):
processing_day = fields.Float('加工天数/d')
travel_day = fields.Float('路途天数/d')
active = fields.Boolean('有效', default=True)
processing_mm = fields.Char('加工厚度/mm')
def name_get(self):
result = []

View File

@@ -16,7 +16,7 @@
<record model="ir.ui.view" id="mrs_production_process_parameter_form">
<field name="model">sf.production.process.parameter</field>
<field name="arch" type="xml">
<form string="表面工艺可选参数" create="0" delete="0">
<form string="表面工艺可选参数" create="0" delete="0" >
<sheet>
<div class="oe_title">
<h1>
@@ -33,11 +33,12 @@
<group>
<field name="processing_day" readonly="1"/>
<field name="travel_day" readonly="1"/>
<field name="processing_mm" readonly="1"/>
</group>
</group>
<notebook>
<page string="适用材料">
<field name="materials_model_ids"></field>
<field name="materials_model_ids" readonly="1"></field>
</page>
</notebook>
</sheet>
@@ -52,7 +53,7 @@
<search>
<filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>
<field name="name" string="名称" filter_domain="[('name','ilike',self)]"/>
<field name="code" string="编码" filter_domain="[('codeNum','ilike',self)]"/>
<field name="code" string="编码" filter_domain="[('code','ilike',self)]"/>
<searchpanel class="account_root">
<field name="process_id" icon="fa-filter"/>
</searchpanel>
@@ -140,7 +141,7 @@
<field name="model">sf.production.process.category</field>
<field name="arch" type="xml">
<tree string="表面工艺类别" default_order="sequence, id" create="0" edit="0" delete="1">
<field name="sequence" widget="handle" string="序号"/>
<field name="sequence" widget="handle" string="序号" readonly="1"/>
<field name="code"/>
<field name="name" string="名称"/>
</tree>
@@ -163,7 +164,8 @@
<record model="ir.ui.view" id="sf_production_process_tree">
<field name="model">sf.production.process</field>
<field name="arch" type="xml">
<tree string="表面工艺" create="0" edit="0" delete="1">
<tree string="表面工艺" create="0" edit="0" delete="0">
<field name="sequence" widget="handle" string="序号" readonly="1"/>
<field name="code"/>
<field name="name" string="名称"/>
<field name="remark"/>
@@ -174,7 +176,7 @@
<record model="ir.ui.view" id="sf_production_process_form">
<field name="model">sf.production.process</field>
<field name="arch" type="xml">
<form string="表面工艺" create="0" edit="1" delete="1">
<form string="表面工艺" create="0" delete="0">
<sheet>
<div class="oe_title">
<h1>
@@ -192,11 +194,11 @@
</group>
</group>
<notebook>
<page string="可选参数">
<field name="parameter_ids">
<tree force_save="1">
<page string="可选参数" >
<field name="parameter_ids" >
<tree force_save="1" create="0">
<field name="code" readonly="1" force_save="1"/>
<field name="name"/>
<field name="name" readonly="1"/>
<field name="gain_way"/>
<field name='process_id' default="default"/>
</tree>

View File

@@ -31,7 +31,7 @@ class StatusChange(models.Model):
res = super(StatusChange, self).action_confirm()
# 原有方法执行后进行额外的操作如调用外部API
process_start_time = str(datetime.now())
process_start_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
config = self.env['res.config.settings'].get_values()
json1 = {
'params': {

View File

@@ -163,6 +163,7 @@ class Sf_Dashboard_Connect(http.Controller):
# 停机时间:关机时间 - 运行时间
# 停机时长:关机时间 - 初次上线时间
'img': f'data:image/png;base64,{machine_data.machine_tool_picture.decode("utf-8")}',
'equipment_type': machine_data.category_id.name,
})
return json.dumps(res)

View File

@@ -1154,7 +1154,7 @@ class ResMrpWorkOrder(models.Model):
def button_finish(self):
for record in self:
if record.routing_type == '装夹预调':
if not record.material_center_point and record.X_deviation_angle > 0:
if not record.material_center_point or record.X_deviation_angle <= 0:
raise UserError("请对前置三元检测定位参数进行计算定位")
if not record.rfid_code and record.is_rework is False:
raise UserError("请扫RFID码进行绑定")
@@ -1257,15 +1257,14 @@ class ResMrpWorkOrder(models.Model):
# 解绑托盘
def unbind_tray(self):
self.write({
self.production_id.workorder_ids.write({
'rfid_code': False,
'tray_serial_number': False,
'tray_product_id': False,
'tray_brand_id': False,
'tray_type_id': False,
'tray_model_id': False,
'is_trayed': False
})
'is_trayed': False})
# 将FTP的检测报告文件下载到临时目录
def download_reportfile_tmp(self, workorder, reportpath):

View File

@@ -3,13 +3,34 @@ $(document).off('keydown')
$(document).on('keydown', 'body.o_web_client', function (e) {
setTimeout(() => {
RFID = ''
}, 200)
}, 200)
if(e.key == 'Enter' && e.keyCode == 13 || e.key == 'Tab' && e.keyCode == 9){
let fieldValue1 = $('[name="routing_type"]');
console.log('字段值:', fieldValue1.text());
console.log(RFID)
if(!RFID || RFID.length <= 3) return;
$('[name="button_start"]').trigger('click')
RFID = ''
let fieldValue2 = $('[name="rfid_code"]');
console.log('字段值2:', fieldValue2.text());
// if(!RFID || RFID.length <= 3) return;
// $('[name="button_start"]').trigger('click')
// setTimeout(() => {
// $('.o_dialog .modal-footer .btn-primary').trigger('click')
// }, 50)
// RFID = ''
// return;
// fieldValue2.val() === '')
// 检查字段值是否等于“装夹预调”
if (fieldValue1.text() === '装夹预调') {
if (!RFID || RFID.length <= 3) return;
$('[name="button_start"]').trigger('click');
setTimeout(() => {
$('.o_dialog .modal-footer .btn-primary').trigger('click');
}, 100);
}
RFID = '';
return;
}
RFID += e.key

View File

@@ -195,7 +195,7 @@
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('state','!=','progress'),('is_rework','=',True)]}"/>
<button name="unbind_tray" type="object" string="解绑托盘"
class="btn-primary"
attrs="{'invisible': ['|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False)]}"/>
attrs="{'invisible': ['|', '|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False), ('state', 'in', ('done'))]}"/>
<button name="print_method" type="object" string="打印二维码" class="btn-primary"
attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/>
</xpath>

View File

@@ -329,6 +329,7 @@ class sfProductionProcess(models.Model):
production_process.processing_day = item['processing_day']
production_process.travel_day = item['travel_day']
production_process.active = item['active']
production_process.sequence = item['sequence']
else:
self.create({
"name": item['name'],
@@ -338,6 +339,7 @@ class sfProductionProcess(models.Model):
"processing_day": item['processing_day'],
"travel_day": item['travel_day'],
"active": item['active'],
"sequence": item['sequence']
})
else:
raise ValidationError("表面工艺认证未通过")
@@ -365,6 +367,7 @@ class sfProductionProcess(models.Model):
"processing_day": item['processing_day'],
"travel_day": item['travel_day'],
"active": item['active'],
"sequence": item['sequence']
})
else:
production_process.name = item['name']
@@ -373,6 +376,7 @@ class sfProductionProcess(models.Model):
production_process.processing_day = item['processing_day']
production_process.travel_day = item['travel_day']
production_process.active = item['active']
production_process.sequence = item['sequence']
else:
raise ValidationError("表面工艺认证未通过")
@@ -1088,6 +1092,7 @@ class sfProductionProcessParameter(models.Model):
production_process_parameter.process_id = process.id
production_process_parameter.materials_model_ids = self.env['sf.materials.model'].search(
[('materials_no', 'in', item['materials_model_ids_codes'])])
production_process_parameter.processing_mm = item['processing_mm']
else:
self.create({
"name": item['name'],
@@ -1099,6 +1104,7 @@ class sfProductionProcessParameter(models.Model):
"process_id": process.id,
"materials_model_ids": self.env['sf.materials.model'].search(
[('materials_no', 'in', item['materials_model_ids_codes'])]),
"processing_mm": item['processing_mm']
})
else:
raise ValidationError("表面工艺可选参数认证未通过") # 定时同步表面工艺
@@ -1129,6 +1135,7 @@ class sfProductionProcessParameter(models.Model):
"process_id": process.id,
'materials_model_ids': self.env['sf.materials.model'].search(
[('materials_no', 'in', item['materials_model_ids_codes'])]),
'processing_mm': item['processing_mm']
})
else:
production_process_parameter.name = item['name']
@@ -1139,6 +1146,7 @@ class sfProductionProcessParameter(models.Model):
production_process_parameter.materials_model_ids = self.env['sf.materials.model'].search(
[('materials_no', 'in', item['materials_model_ids_codes'])])
production_process_parameter.active = item['active']
production_process_parameter.processing_mm = item['processing_mm']
else:
raise ValidationError("表面工艺可选参数认证未通过")

View File

@@ -50,6 +50,7 @@
('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&amp;','&amp;',('check_status',
'=', 'approved'),('state', 'in', ['sale','cancel']),('delivery_status', '!=', False)]}
</attribute>
<attribute name="string">拒绝接单</attribute>
</xpath>
<xpath expr="//form/header/button[@name='action_draft']" position="attributes">
<attribute name="invisible">1</attribute>

View File

@@ -842,21 +842,21 @@
<group string="刀柄" attrs="{'invisible': [('handle_product_id', '=', False)]}"
col="1">
<group attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])]}">
<group col="3">
<group>
<field name="scrap_boolean" string="是否报废"/>
</group>
<group></group>
<group>
<button string="报废" name="tool_scrap" type="object"
class="btn-primary" confirm="是否确认报废刀柄"
attrs="{'invisible': [('scrap_boolean', '=', True)]}"/>
<button string="取消" name="tool_no_scrap" type="object"
class="btn-primary" confirm="是否取消报废刀柄"
attrs="{'invisible': [('scrap_boolean', '=', False)]}"/>
<group></group>
</group>
<!-- <group col="3">-->
<group>
<field name="scrap_boolean" string="是否报废" readonly="0"/>
</group>
<!-- <group></group>-->
<!-- <group>-->
<!-- <button string="报废" name="tool_scrap" type="object"-->
<!-- class="btn-primary" confirm="是否确认报废刀柄"-->
<!-- attrs="{'invisible': [('scrap_boolean', '=', True)]}"/>-->
<!-- <button string="取消" name="tool_no_scrap" type="object"-->
<!-- class="btn-primary" confirm="是否取消报废刀柄"-->
<!-- attrs="{'invisible': [('scrap_boolean', '=', False)]}"/>-->
<!-- <group></group>-->
<!-- </group>-->
<!-- </group>-->
</group>
<group>
<field name="handle_rfid" string="Rfid"/>