Accept Merge Request #1770: (feature/customer_supply -> develop)

Merge Request: 修改采购单非询价状态只读

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1770
This commit is contained in:
廖丹龙
2025-01-16 12:42:28 +08:00
committed by Coding
2 changed files with 13 additions and 6 deletions

View File

@@ -1526,15 +1526,16 @@ class MrpProduction(models.Model):
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_customer_provided = product_id.is_customer_provided
if not is_custemer_group_id.get(is_customer_provided) and is_self_process:
is_custemer_group_id[is_customer_provided] = self.env["procurement.group"].create({'name': vals.get('name')}).id
key = f"{is_self_process}_{is_customer_provided}"
if not is_custemer_group_id.get(key):
is_custemer_group_id[key] = self.env["procurement.group"].create({'name': vals.get('name')}).id
# if not (is_first_customer or is_first_not_customer) and is_self_process:
# is_first = True
# group_id = self.env["procurement.group"].create({'name': vals.get('name')}).id
if not vals.get('procurement_group_id'):
if product_id.product_tmpl_id.single_manufacturing:
if product_id.categ_id.name == '成品' and is_self_process:
vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided]
if product_id.categ_id.name == '成品':
vals['procurement_group_id'] = is_custemer_group_id[key]
continue
if product_id.id not in product_group_id.keys():
procurement_group_vals = self._prepare_procurement_group_vals(vals)
@@ -1544,7 +1545,7 @@ class MrpProduction(models.Model):
else:
vals['procurement_group_id'] = product_group_id[product_id.id]
else:
vals['procurement_group_id'] = is_custemer_group_id[is_customer_provided]
vals['procurement_group_id'] = is_custemer_group_id[key]
return super(MrpProduction, self).create(vals_list)
@api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id',

View File

@@ -4,8 +4,14 @@
<record model="ir.ui.view" id="view_purchase_order_line_form_inherit_sf1">
<field name="name">purchase.order.form.inherit.sf</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="inherit_id" ref="purchase_order_approved.purchase_order_form"/>
<field name="arch" type="xml">
<field name="order_line" position="attributes">
<attribute
name="attrs"
>{'readonly': [('state', '!=', 'draft')]}
</attribute>
</field>
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="after">
<field name="related_product" optional="show"/>
<field name="part_number" optional="show"/>