Accept Merge Request #1851: (feature/制造功能优化 -> develop)

Merge Request: 坯料自加工的切割工序状态也判断了编程状态

Created By: @马广威
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1851
This commit is contained in:
马广威
2025-02-26 09:11:10 +08:00
committed by Coding
3 changed files with 25 additions and 4 deletions

View File

@@ -265,6 +265,23 @@ class MrpProduction(models.Model):
part_name = fields.Char(string='零件名称', related='product_id.part_name', readonly=True)
# 判断制造的产品类型
production_product_type = fields.Selection([
('成品', '成品'),
('坯料', '坯料'),
('其他', '其他')
], string='产品类型', default='成品')
@api.onchange('product_id')
def onchange_product_id(self):
for record in self:
if record.product_id.categ_id.type == '成品':
record.production_product_type = '成品'
elif record.product_id.categ_id.type == '坯料':
record.production_product_type = '坯料'
else:
record.production_product_type = '其他'
@api.depends('product_id.manual_quotation')
def _compute_manual_quotation(self):
for item in self:

View File

@@ -1217,6 +1217,7 @@ class ResMrpWorkOrder(models.Model):
# ================= 如果制造订单制造类型为【人工线下加工】==========================
if (workorder.production_id.production_type == '人工线下加工'
and workorder.production_id.schedule_state == '已排'
and workorder.routing_type == '人工线下加工'
and len(workorder.production_id.picking_ids.filtered(
lambda w: w.state not in ['done', 'cancel'])) == 0
and workorder.production_id.programming_state == '已编程'):

View File

@@ -116,12 +116,13 @@
</xpath>
<xpath expr="//sheet//group//group//div[3]" position="after">
<field name="production_type" readonly="1"/>
<field name="production_product_type" readonly="1" invisible="1"/>
<field name="manual_quotation" readonly="1"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"/>
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"/>
<field name="programming_no" readonly="1"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"/>
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"/>
<field name="programming_state" readonly="1"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"
decoration-success="programming_state == '已编程'"
decoration-warning="programming_state =='编程中'"
decoration-danger="programming_state =='已编程未下发'"/>
@@ -416,7 +417,9 @@
<span class="o_stat_text">子MO</span>
</xpath>
<xpath expr="//sheet//notebook//page[last()]" position="after">
<page string="编程记录">
<page string="编程记录" attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}">
<field name="production_type" invisible="1"/>
<field name="production_product_type" invisible="1"/>
<field name="programming_record_ids" widget="one2many" attrs="{'readonly': [('id', '!=', False)]}">
<tree>
<field name="number"/>