1,修复制造订单状态:第一张装夹工单未就绪是,状态需为:待加工;所有工单完成后,状态需为:完成;2.修复多个产品确认制造订单未生产多个编程单问题3.优化工单页面:去掉非必要的字段
This commit is contained in:
@@ -5,10 +5,10 @@
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//header" position="inside">-->
|
||||
<button string="程序下载" name="cnc_file_download" type="object" class="oe_highlight" attrs='{"invisible": ["|",
|
||||
("user_permissions","=",False),("routing_type","!=","CNC加工")]}'/>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//header" position="inside">–>-->
|
||||
<!-- <button string="程序下载" name="cnc_file_download" type="object" class="oe_highlight" attrs='{"invisible": ["|",-->
|
||||
<!-- ("user_permissions","=",False),("routing_type","!=","CNC加工")]}'/>-->
|
||||
<!-- </xpath>-->
|
||||
<xpath expr="//page//field[@name='cnc_ids']" position="before">
|
||||
<group>
|
||||
<group>
|
||||
@@ -17,8 +17,8 @@
|
||||
</group>
|
||||
<div>
|
||||
<div>
|
||||
<field name="button_compensation_state" attrs='{"invisible": ["|",
|
||||
("state","!=","progress"),("user_permissions","=",False)]}'/>
|
||||
<!-- <field name="button_compensation_state" attrs='{"invisible": ["|",-->
|
||||
<!-- ("state","!=","progress"),("user_permissions","=",False)]}'/>-->
|
||||
<!-- <span> </span>-->
|
||||
<!-- <button name="button_send_program_again" type="object" string="重新下发NC程序"-->
|
||||
<!-- class="btn-primary"-->
|
||||
|
||||
@@ -102,7 +102,7 @@ class MrpProduction(models.Model):
|
||||
elif not production.workorder_ids and float_compare(production.qty_producing, production.product_qty,
|
||||
precision_rounding=production.product_uom_id.rounding) >= 0:
|
||||
production.state = 'to_close'
|
||||
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
||||
elif any(wo_state in ('progress') for wo_state in production.workorder_ids.mapped('state')):
|
||||
production.state = 'progress'
|
||||
elif production.product_uom_id and not float_is_zero(production.qty_producing,
|
||||
precision_rounding=production.product_uom_id.rounding):
|
||||
@@ -119,6 +119,10 @@ class MrpProduction(models.Model):
|
||||
production.state = 'confirmed'
|
||||
# if production.schedule_state == '已完成':
|
||||
# production.state = 'completed'
|
||||
elif production.workorder_ids and production.workorder_ids[0].state == 'ready':
|
||||
production.state = 'confirmed'
|
||||
elif all(wo_state in ('done') for wo_state in production.workorder_ids.mapped('state')):
|
||||
production.state = 'done'
|
||||
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
||||
production.state = 'progress'
|
||||
elif production.product_uom_id and not float_is_zero(production.qty_producing,
|
||||
@@ -128,9 +132,6 @@ class MrpProduction(models.Model):
|
||||
precision_rounding=move.product_uom.rounding or move.product_id.uom_id.rounding)
|
||||
for move in production.move_raw_ids):
|
||||
production.state = 'progress'
|
||||
|
||||
|
||||
|
||||
# if production.state == 'progress' and production.schedule_state == '已排' and production.process_state == '待装夹':
|
||||
# # production.state = 'pending_processing'
|
||||
# production.state = 'pending_cam'
|
||||
|
||||
@@ -136,11 +136,6 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
supplier_id = fields.Many2one('res.partner', string='外协供应商')
|
||||
equipment_id = fields.Many2one('maintenance.equipment', string='加工设备', tracking=True)
|
||||
is_ok = fields.Boolean(string='是否合格')
|
||||
# 加工人
|
||||
processing_user_id = fields.Many2one('res.users', string='加工人')
|
||||
# 检测人
|
||||
inspection_user_id = fields.Many2one('res.users', string='检测人')
|
||||
# 保存名称
|
||||
save_name = fields.Char(string='检测文件保存名称', compute='_compute_save_name')
|
||||
# 获取数据状态
|
||||
@@ -234,16 +229,6 @@ class ResMrpWorkOrder(models.Model):
|
||||
ids = [t[0] for t in self.env.cr.fetchall()]
|
||||
return [('id', 'in', ids)]
|
||||
|
||||
@api.onchange('is_ok')
|
||||
def _onchange_inspection_user_id(self):
|
||||
"""
|
||||
检测is_ok(是否合格)被修改的话,就将当前用户赋值给inspection_user_id
|
||||
"""
|
||||
if not self.inspection_user_id:
|
||||
self.inspection_user_id = self.env.user.id
|
||||
else:
|
||||
self.inspection_user_id = False
|
||||
|
||||
@api.onchange('functional_fixture_id')
|
||||
def _onchange_functional_fixture_id(self):
|
||||
if self.functional_fixture_id:
|
||||
@@ -1036,7 +1021,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
if raw_move:
|
||||
raw_move.write({'state': 'done'})
|
||||
record.production_id.button_mark_done1()
|
||||
record.production_id.state = 'done'
|
||||
# record.production_id.state = 'done'
|
||||
|
||||
# 将FTP的检测报告文件下载到临时目录
|
||||
def download_reportfile_tmp(self, workorder, reportpath):
|
||||
|
||||
@@ -261,13 +261,14 @@ class StockRule(models.Model):
|
||||
'product_id': production.product_id.id,
|
||||
'state': 'draft',
|
||||
})
|
||||
grouped_product_ids = {k: list(g) for k, g in groupby(productions, key=lambda x: x.product_id.id)}
|
||||
all_production = productions
|
||||
grouped_product_ids = {k: list(g) for k, g in groupby(all_production, key=lambda x: x.product_id.id)}
|
||||
# 初始化一个字典来存储每个product_id对应的生产订单名称列表
|
||||
product_id_to_production_names = {}
|
||||
# 对于每个product_id,获取其所有生产订单的名称
|
||||
for product_id, productions in grouped_product_ids.items():
|
||||
for product_id, all_production in grouped_product_ids.items():
|
||||
# 为同一个product_id创建一个生产订单名称列表
|
||||
product_id_to_production_names[product_id] = [production.name for production in productions]
|
||||
product_id_to_production_names[product_id] = [production.name for production in all_production]
|
||||
for production_item in productions:
|
||||
if production_item.product_id.id in product_id_to_production_names:
|
||||
# # 同一个产品多个制造订单对应一个编程单和模型库
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="name">custom.mrp.production.tree</field>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="arch" type="xml">product_uom_category_id
|
||||
<xpath expr="//field[@name='product_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='product_qty']" position="replace"/>
|
||||
<xpath expr="//field[@name='product_uom_id']" position="replace"/>
|
||||
@@ -281,9 +281,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree//button[@name='button_start']" position="replace">
|
||||
<field name="routing_type" invisible="True"/>
|
||||
<button name="button_start" type="object" string="开始" class="btn-success"
|
||||
<button name="button_start" type="object" string="开始" class="btn-success" confirm="是否确认开始?"
|
||||
attrs="{'invisible': ['|', '|', '|','|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False), ('routing_type', '=', 'CNC加工')]}"
|
||||
groups="sf_base.group_sf_mrp_user" confirm="是否确认开始?"/>
|
||||
groups="sf_base.group_sf_mrp_user"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree//button[@name='button_pending']" position="replace">
|
||||
<button name="button_pending" type="object" string="Pause" class="btn-warning"
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//label[1]" position="before">
|
||||
<field name='routing_type'/>
|
||||
<field name='routing_type' readonly="1"/>
|
||||
<field name='process_state' attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||
</xpath>
|
||||
<xpath expr="//label[1]" position="attributes">
|
||||
@@ -575,9 +575,6 @@
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//form//sheet//group//group//div[3]" position="after">
|
||||
<field name="is_ok" attrs='{"invisible": [("routing_type","=","装夹预调")]}'/>
|
||||
<field name="processing_user_id" attrs='{"invisible": [("routing_type","=","装夹预调")]}'/>
|
||||
<field name="inspection_user_id" attrs='{"invisible": [("routing_type","=","装夹预调")]}'/>
|
||||
<field name="save_name" widget="CopyClipboardChar"
|
||||
attrs="{'invisible':[('routing_type','!=','装夹预调')]}"/>
|
||||
<label for="material_length" string="物料尺寸"/>
|
||||
|
||||
Reference in New Issue
Block a user