1、关闭产品、采购单中关联字段的创建功能;2、优化采购入库验证条件;

This commit is contained in:
yuxianghui
2024-05-14 14:09:42 +08:00
parent 48782cb62b
commit eff6ce9f1b
5 changed files with 17 additions and 7 deletions

View File

@@ -32,6 +32,7 @@
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"
placeholder="请选择"/>
<field name="cutting_tool_model_id" placeholder="请选择" class="custom_required"
options="{'no_create': True}"
domain="[('cutting_tool_material_id','=',cutting_tool_material_id)]"
context="{'default_cutting_tool_material_id': cutting_tool_material_id}"
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}">
@@ -39,6 +40,7 @@
<!-- <button name="%(sf_base.action_sf_cutting_tool_standard_library)d" string="新建" type="action"-->
<!-- context="{'default_cutting_tool_material_id': cutting_tool_material_id}"/>-->
<field name="specification_id" placeholder="请选择" class="custom_required"
options="{'no_create': True}"
context="{'default_cutting_tool_type': cutting_tool_type,'default_standard_library_id':cutting_tool_model_id}"
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"
domain="[('standard_library_id','=',cutting_tool_model_id)]"/>
@@ -436,7 +438,7 @@
<field name="cutting_speed_ids" string="" widget="one2many"
attrs="{'readonly': [('id', '!=', False)]}" class="fixTableCss">
<tree editable="bottom">
<field name="execution_standard_id"/>
<field name="execution_standard_id" options="{'no_create': True}"/>
<field name="material_code"/>
<field name="material_grade"/>
<field name="tensile_strength"/>
@@ -453,7 +455,7 @@
<tree editable="bottom">
<!-- <field name="cutting_speed"-->
<!-- attrs="{'readonly': [('materials_type_id','!=',False)]}"/>-->
<field name="materials_type_id" placeholder="请选择"/>
<field name="materials_type_id" options="{'no_create': True}" placeholder="请选择"/>
<field name="blade_diameter"/>
<field name="feed_per_tooth"/>
</tree>
@@ -464,8 +466,8 @@
<page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}">
<group>
<group>
<field name="brand_id" placeholder="请选择"/>
<field name="multi_mounting_type_id" placeholder="请选择"
<field name="brand_id" placeholder="请选择" options="{'no_create': True}"/>
<field name="multi_mounting_type_id" placeholder="请选择" options="{'no_create': True}"
attrs="{'required': [('categ_type', '=', '夹具')]}"/>
<field name="length" string="长度(mm)"/>
<field name="width" string="宽度(mm)"/>
@@ -553,14 +555,16 @@
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
<field name="materials_model_id" placeholder="请选择"/>
<field name="materials_model_id" placeholder="请选择" options="{'no_create': True}"/>
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
options="{'no_create': True}"
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
options="{'no_create': True}"
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
</group>

View File

@@ -83,6 +83,9 @@
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
<attribute name="options">{'no_create': True}</attribute>
</xpath>
<field name="partner_ref" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
</attribute>

View File

@@ -119,7 +119,7 @@
string="模型文件" attrs="{'readonly': [('state', 'in', ['draft'])]}"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="attributes">
<attribute name="options">{'no_create': True}</attribute>
<attribute name="options">{'no_create': True, 'no_quick_create': True}</attribute>
<attribute name="context">{'is_sale_order_line': True }</attribute>
</xpath>
<xpath expr="//field[@name='order_line']" position="attributes">

View File

@@ -1,3 +1,5 @@
import logging
from datetime import timedelta, datetime
from odoo import fields, models, api
@@ -807,6 +809,7 @@ class ProductProduct(models.Model):
"""
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
logging.info("product_id: %s" % product_id)
stock_lot = self.env['stock.lot'].create({
'name': self.get_stock_lot_name(tool_assembly_order_id),
'product_id': product_id.id,

View File

@@ -880,7 +880,7 @@ class SfStockPicking(models.Model):
line.compute_destination_location_id()
else:
# 对除刀柄之外的刀具物料进行 目标货位必填校验
if self.location_dest_id.name == '刀具房' and line.product_id.cutting_tool_material_id not in (
if self.location_dest_id.name == '刀具房' and line.product_id.cutting_tool_material_id.name not in (
'刀柄', False):
raise ValidationError('请选择【%s】产品的目标货位!' % line.product_id.name)
if line.current_location_id: