Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
# Conflicts: # quality_control/security/ir.model.access.csv # quality_control/wizard/quality_check_wizard.py # sf_quality/__manifest__.py # sf_quality/models/__init__.py # sf_quality/models/stock.py
This commit is contained in:
@@ -1574,7 +1574,7 @@ class MrpProduction(models.Model):
|
||||
vals['picking_type_id'] = picking_type_id
|
||||
vals['name'] = self.env['stock.picking.type'].browse(picking_type_id).sequence_id.next_by_id()
|
||||
product_id = self.env['product.product'].browse(vals['product_id'])
|
||||
is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工'
|
||||
is_self_process = product_id.materials_type_id.gain_way if product_id.materials_type_id else None
|
||||
is_customer_provided = product_id.is_customer_provided
|
||||
key = f"{is_self_process}_{is_customer_provided}"
|
||||
if not is_custemer_group_id.get(key):
|
||||
|
||||
@@ -1198,11 +1198,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'cmm_ids': production.workorder_ids.filtered(lambda t: t.routing_type == 'CNC加工').cmm_ids,
|
||||
}]
|
||||
return workorders_values_str
|
||||
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state',
|
||||
'production_id.tool_state', 'production_id.schedule_state', 'sequence',
|
||||
'production_id.programming_state')
|
||||
def _compute_state(self):
|
||||
def _process_compute_state(self):
|
||||
for workorder in self:
|
||||
# 如果工单的工序没有进行排序则跳出循环
|
||||
if workorder.production_id.workorder_ids.filtered(lambda wk: wk.sequence == 0):
|
||||
@@ -1289,7 +1285,20 @@ class ResMrpWorkOrder(models.Model):
|
||||
mo.get_move_line(workorder.production_id, workorder))
|
||||
else:
|
||||
workorder.state = 'waiting'
|
||||
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state',
|
||||
'production_id.tool_state', 'production_id.schedule_state', 'sequence',
|
||||
'production_id.programming_state')
|
||||
def _compute_state(self):
|
||||
self._process_compute_state()
|
||||
for workorder in self:
|
||||
if workorder.state == 'waiting' or workorder.state == 'pending':
|
||||
for check_id in workorder.check_ids:
|
||||
if not check_id.is_inspect:
|
||||
check_id.quality_state = 'waiting'
|
||||
if workorder.state == 'ready':
|
||||
for check_id in workorder.check_ids:
|
||||
if not check_id.is_inspect:
|
||||
check_id.quality_state = 'none'
|
||||
# 重写工单开始按钮方法
|
||||
def button_start(self):
|
||||
# 判断工单状态是否为等待组件
|
||||
@@ -1510,8 +1519,12 @@ class ResMrpWorkOrder(models.Model):
|
||||
for workorder in record.production_id.workorder_ids:
|
||||
if workorder.processing_panel == record.processing_panel:
|
||||
rfid_code = workorder.rfid_code
|
||||
workorder.write({'rfid_code_old': rfid_code,
|
||||
'rfid_code': False})
|
||||
if record.is_rework is not True:
|
||||
workorder.write({'rfid_code_old': rfid_code, 'rfid_code': False})
|
||||
elif workorder.routing_type != '装夹预调' and workorder.state != 'rework':
|
||||
workorder.write({'rfid_code_old': False, 'rfid_code': False})
|
||||
elif workorder.routing_type == '装夹预调' and workorder.state != 'rework':
|
||||
workorder.write({'rfid_code_old': rfid_code, 'rfid_code': False})
|
||||
self.env['stock.lot'].sudo().search([('rfid', '=', rfid_code)]).write(
|
||||
{'tool_material_status': '可用'})
|
||||
if workorder.rfid_code:
|
||||
@@ -1928,7 +1941,8 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
self.write(val)
|
||||
workorder_rfid = self.env['mrp.workorder'].search(
|
||||
[('production_id', '=', workorder.production_id.id),
|
||||
('processing_panel', '=', workorder.processing_panel)])
|
||||
('processing_panel', '=', workorder.processing_panel),
|
||||
('state', '!=', 'rework')])
|
||||
if workorder_rfid:
|
||||
for item in workorder_rfid:
|
||||
item.write({'rfid_code': barcode})
|
||||
|
||||
@@ -4,6 +4,7 @@ import requests
|
||||
import base64
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
from odoo.modules import get_resource_path
|
||||
@@ -776,10 +777,33 @@ class ResProductMo(models.Model):
|
||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||
machining_drawings = fields.Binary('2D加工图纸', readonly=True)
|
||||
quality_standard = fields.Binary('质检标准', readonly=True)
|
||||
part_name = fields.Char(string='零件名称', readonly=True)
|
||||
part_number = fields.Char(string='零件图号', readonly=True)
|
||||
part_name = fields.Char(string='零件名称', compute='_compute_related_product', readonly=True, store=True)
|
||||
part_number = fields.Char(string='零件图号', compute='_compute_related_product', readonly=True, store=True)
|
||||
machining_drawings_name = fields.Char(string='零件图号名称', readonly=True)
|
||||
machining_drawings_mimetype = fields.Char(string='零件图号类型', readonly=True)
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_related_product(self):
|
||||
for record in self:
|
||||
if record.categ_id.name == '坯料':
|
||||
product_name = ''
|
||||
match = re.search(r'(S\d{5}-\d)', record.name)
|
||||
# 如果匹配成功,提取结果
|
||||
if match:
|
||||
product_name = match.group(0)
|
||||
sale_order_name = ''
|
||||
match_sale = re.search(r'S(\d+)', record.name)
|
||||
if match_sale:
|
||||
sale_order_name = match_sale.group(0)
|
||||
sale_order = self.env['sale.order'].sudo().search(
|
||||
[('name', '=', sale_order_name)])
|
||||
if sale_order:
|
||||
filtered_order_line = sale_order.order_line.filtered(
|
||||
lambda order_line: re.search(f'{product_name}$', order_line.product_id.name)
|
||||
)
|
||||
record.part_number = filtered_order_line.product_id.part_number if filtered_order_line else None
|
||||
record.part_name = filtered_order_line.product_id.part_name if filtered_order_line else None
|
||||
|
||||
@api.constrains('tool_length')
|
||||
def _check_tool_length_size(self):
|
||||
if self.tool_length > 1000000:
|
||||
|
||||
@@ -117,6 +117,8 @@ class PurchaseOrderLine(models.Model):
|
||||
@api.depends('product_id')
|
||||
def _compute_related_product(self):
|
||||
for record in self:
|
||||
if record.part_number or record.part_name:
|
||||
continue
|
||||
if record.product_id.categ_id.name == '坯料':
|
||||
product_name = ''
|
||||
match = re.search(r'(S\d{5}-\d)', record.product_id.name)
|
||||
|
||||
@@ -1032,6 +1032,8 @@ class ReStockMove(models.Model):
|
||||
productions = self.env['mrp.production'].search(
|
||||
[('origin', '=', production.origin), ('product_id', '=', production.product_id.id)])
|
||||
res['origin'] = ','.join(productions.mapped('name'))
|
||||
if self.picking_type_id.name == '客供料入库':
|
||||
self.picking_id.sudo().write({'origin': res['origin'] if res.get('origin') else self[0].picking_id.origin})
|
||||
return res
|
||||
|
||||
def _get_new_picking_values(self):
|
||||
|
||||
@@ -67,6 +67,16 @@
|
||||
<filter string="追溯参考" name="retrospect" domain="[]"
|
||||
context="{'group_by': 'retrospect_ref'}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='picking_type_id']" position="after">
|
||||
<field name="product_id"
|
||||
string="零件图号"
|
||||
filter_domain="[('product_id.part_number', 'ilike', self)]"
|
||||
/>
|
||||
<field name="product_id"
|
||||
string="零件名称"
|
||||
filter_domain="[('product_id.part_name', 'ilike', self)]"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -46,8 +46,12 @@ class ProductionWizard(models.TransientModel):
|
||||
mrp_workorder_list = self.mrp_production_id.workorder_ids.filtered(lambda kw: kw.rfid_code)
|
||||
for workorder in mrp_workorder_list:
|
||||
rfid_code = workorder.rfid_code
|
||||
workorder.write({'rfid_code_old': rfid_code,
|
||||
'rfid_code': False})
|
||||
workorder.filtered(lambda wo: wo.routing_type == '装夹预调' and wo.rfid_code is not False).write(
|
||||
{'rfid_code_old': rfid_code, 'rfid_code': False})
|
||||
workorder.filtered(lambda wo: (wo.routing_type != '装夹预调' and
|
||||
(wo.rfid_code_old is not False or wo.rfid_code is not False))).write(
|
||||
{'rfid_code_old': False, 'rfid_code': False})
|
||||
|
||||
if self.is_remanufacture is True:
|
||||
ret = {'programming_list': [], 'is_reprogramming': self.is_reprogramming}
|
||||
if self.is_reprogramming is True:
|
||||
|
||||
@@ -140,7 +140,7 @@ class ReworkWizard(models.TransientModel):
|
||||
and item.process_parameters_id == work.surface_technics_parameters_id) or
|
||||
(item.route_id.name == work.name and item.panel
|
||||
and item.panel == work.processing_panel) or
|
||||
(item.route_id == work.routing_workcenter_id
|
||||
(item.route_id == work.routing_work_center_id
|
||||
and not work.processing_panel
|
||||
and not work.surface_technics_parameters_id))
|
||||
if route:
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<field name="display_message" readonly="1" nolabel="1"/>
|
||||
</div>
|
||||
<field name="related_docs">
|
||||
<tree string="下游单据" create="false" edit="false" delete="false">
|
||||
<field name="related_docs" >
|
||||
<tree string="下游单据" create="false" edit="false" delete="false" attrs="{'merge_fields': 'category,doc_name,operation_type,doc_number,doc_state, cancel_reason', 'merge_key': 'doc_number'}">
|
||||
<!-- <field name="sequence" string="序号"/> -->
|
||||
<field name="category" string="大类"/>
|
||||
<field name="doc_name" string="单据名称"/>
|
||||
<field name="operation_type" string="作业类型"/>
|
||||
<field name="doc_number" string="单据编号"/>
|
||||
<field name="doc_state" string="单据状态"/>
|
||||
<field name="cancel_reason" string="禁止取消原因"/>
|
||||
<field name="line_number" string="行号"/>
|
||||
<field name="product_name" string="产品名称"/>
|
||||
<field name="quantity_str" string="数量"/>
|
||||
<field name="doc_state" string="单据状态"/>
|
||||
<field name="cancel_reason" string="禁止取消原因"/>
|
||||
</tree>
|
||||
</field>
|
||||
<footer>
|
||||
|
||||
Reference in New Issue
Block a user