Accept Merge Request #1013: (feature/优化产品 -> develop)

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

Created By: @禹翔辉
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1013
This commit is contained in:
禹翔辉
2024-05-14 14:20:09 +08:00
committed by Coding
7 changed files with 23 additions and 9 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

@@ -1040,6 +1040,7 @@ class CNCprocessing(models.Model):
# 将FTP的nc文件下载到临时目录
def download_file_tmp(self, production_no, processing_panel):
remotepath = os.path.join('/NC', production_no, 'return', processing_panel)
serverdir = os.path.join('/tmp', production_no, 'return', processing_panel)
ftp_resconfig = self.env['res.config.settings'].get_values()
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
ftp_resconfig['ftp_password'])

View File

@@ -65,8 +65,11 @@ class Sf_Mrs_Connect(http.Controller):
if cnc_program and cnc_processing_arr:
logging.info('cnc_processing_arr:%s' % cnc_processing_arr)
cnc_program.write({'programming_state': '已编程', 'work_state': '已编程'})
cnc_program.workorder_ids.filtered(lambda b: b.routing_type == 'CNC加工').write(
{'cnc_ids': cnc_processing_arr})
# cnc_program.workorder_ids.filtered(lambda b: b.routing_type == 'CNC加工').write(
# {'cnc_ids': cnc_processing_arr})
for cnc_item in cnc_program.workorder_ids.filtered(lambda b: b.routing_type == 'CNC加工'):
logging.info('cnc_item:%s' % cnc_item.production_id.name)
cnc_item.write({'cnc_ids': cnc_processing_arr})
cnc_program_ids = [item.id for item in cnc_program]
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
[('production_id', 'in', cnc_program_ids)])

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: