1、优化产初始化生成功能刀具,解决作业类型无法选择功能刀具的问题;2、优化取消功能刀具组装功能;3、新增功能刀具组装确定后生成功能刀具序列号,生成刀具组装入库单
This commit is contained in:
@@ -35,10 +35,8 @@
|
||||
<field name="type">功能刀具</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="product_functional_tool_sf" model="product.product">
|
||||
<field name="name">功能刀具模板</field>
|
||||
<field name="active" eval="False"/>
|
||||
<field name="name">功能刀具</field>
|
||||
<field name="categ_id" ref="product_category_functional_tool_sf"/>
|
||||
<field name="route_ids"
|
||||
eval="[ref('stock.route_warehouse0_mto')]"/>
|
||||
@@ -49,9 +47,8 @@
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="single_manufacturing">true</field>
|
||||
<field name="single_manufacturing">false</field>
|
||||
<field name="tracking">serial</field>
|
||||
<field name="is_bfm">false</field>
|
||||
</record>
|
||||
|
||||
<record id="product_template_sf" model="product.product">
|
||||
|
||||
@@ -59,8 +59,6 @@
|
||||
<field name="name">刀具组装入库</field>
|
||||
<field name="code">internal</field>
|
||||
<field name="active">true</field>
|
||||
<!-- <field name="partner_id" invisible="1"/>-->
|
||||
<!-- <field name="sequence_id" ref="sequence_stock_picking_in"/>-->
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="sequence_code">ZR</field>
|
||||
<field name="default_location_src_id" ref="stock_location_locations_virtual_after_assembly"/>
|
||||
|
||||
@@ -895,27 +895,27 @@ class FunctionalToolAssembly(models.Model):
|
||||
('assemble_status', '=', '1')
|
||||
]).write({
|
||||
'cutting_tool_integral_model_id': None,
|
||||
'integral_code': None,
|
||||
'integral_code_id': None,
|
||||
'integral_name': None,
|
||||
'sf_tool_brand_id_1': None,
|
||||
'cutting_tool_blade_model_id': None,
|
||||
'blade_code': None,
|
||||
'blade_code_id': None,
|
||||
'blade_name': None,
|
||||
'sf_tool_brand_id_2': None,
|
||||
'cutting_tool_cutterbar_model_id': None,
|
||||
'bar_code': None,
|
||||
'bar_code_id': None,
|
||||
'bar_name': None,
|
||||
'sf_tool_brand_id_3': None,
|
||||
'cutting_tool_cutterpad_model_id': None,
|
||||
'pad_code': None,
|
||||
'pad_code_id': None,
|
||||
'pad_name': None,
|
||||
'sf_tool_brand_id_4': None,
|
||||
'cutting_tool_cutterhandle_model_id': None,
|
||||
'handle_code': None,
|
||||
'handle_code_id': None,
|
||||
'handle_name': None,
|
||||
'sf_tool_brand_id_5': None,
|
||||
'cutting_tool_cutterhead_model_id': None,
|
||||
'chuck_code': None,
|
||||
'chuck_code_id': None,
|
||||
'chuck_name': None,
|
||||
'sf_tool_brand_id_6': None,
|
||||
'coarse_middle_thin': None,
|
||||
|
||||
@@ -1127,7 +1127,7 @@
|
||||
</group>
|
||||
<group>
|
||||
<group col="1">
|
||||
<group col="1">
|
||||
<group col="1" attrs="{'invisible': [('handle_code_id', '=', False)]}">
|
||||
<div>
|
||||
<separator string="刀柄:" style="font-size: 13px;"/>
|
||||
</div>
|
||||
@@ -1165,7 +1165,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<group col="1">
|
||||
<group col="1">
|
||||
<group col="1" attrs="{'invisible': [('chuck_code_id', '=', False)]}">
|
||||
<div>
|
||||
<separator string="夹头:" style="font-size: 13px;"/>
|
||||
</div>
|
||||
@@ -1208,35 +1208,6 @@
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<!-- <group>-->
|
||||
<!-- <field name="integral_code_id"/>-->
|
||||
<!-- <field name="cutting_tool_integral_model_id"/>-->
|
||||
<!-- <field name="blade_code_id"/>-->
|
||||
<!-- <field name="cutting_tool_blade_model_id"/>-->
|
||||
<!-- <field name="bar_code_id"/>-->
|
||||
<!-- <field name="cutting_tool_cutterbar_model_id"/>-->
|
||||
<!-- <field name="pad_code_id"/>-->
|
||||
<!-- <field name="cutting_tool_cutterpad_model_id"/>-->
|
||||
<!-- <field name="handle_code_id"/>-->
|
||||
<!-- <field name="cutting_tool_cutterhandle_model_id"/>-->
|
||||
<!-- <field name="chuck_code_id"/>-->
|
||||
<!-- <field name="cutting_tool_cutterhead_model_id"/>-->
|
||||
<!-- </group>-->
|
||||
<!-- <group>-->
|
||||
<!-- <field name="integral_name"/>-->
|
||||
<!-- <field name="sf_tool_brand_id_1"/>-->
|
||||
<!-- <field name="blade_name"/>-->
|
||||
<!-- <field name="sf_tool_brand_id_2"/>-->
|
||||
<!-- <field name="bar_name"/>-->
|
||||
<!-- <field name="sf_tool_brand_id_3"/>-->
|
||||
<!-- <field name="pad_name"/>-->
|
||||
<!-- <field name="sf_tool_brand_id_4"/>-->
|
||||
<!-- <field name="handle_name"/>-->
|
||||
<!-- <field name="sf_tool_brand_id_5"/>-->
|
||||
<!-- <field name="chuck_name"/>-->
|
||||
<!-- <field name="sf_tool_brand_id_6"/>-->
|
||||
<!-- </group>-->
|
||||
</group>
|
||||
</page>
|
||||
<page string="申请信息">
|
||||
|
||||
@@ -392,9 +392,71 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
self.env['sf.functional.cutting.tool.entity'].search([('code', '=', self.code)]).write(desc_2)
|
||||
# 修改功能刀具组装信息
|
||||
functional_tool_assembly.write(desc_1)
|
||||
|
||||
# 创建组装入库单
|
||||
# 创建功能刀具批次/序列号记录
|
||||
stock_lot = self.create_assemble_warehouse_receipt()
|
||||
# 创建刀具组装入库单
|
||||
self.create_stocking_picking(stock_lot)
|
||||
|
||||
# 关闭弹出窗口
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def create_stocking_picking(self, stock_lot):
|
||||
"""
|
||||
创建刀具组装入库单
|
||||
"""
|
||||
# 获取名称为刀具组装入库的作业类型
|
||||
picking_type_id = self.env['stock.picking.type'].sudo().search([('name', '=', '刀具组装入库')])
|
||||
# 创建刀具组装入库单
|
||||
picking_id = self.env['stock.picking'].create({
|
||||
'picking_type_id': picking_type_id.id
|
||||
})
|
||||
# 创建作业详情对象记录,并绑定到刀具组装入库单
|
||||
self.env['stock.move.line'].create({
|
||||
'picking_id': picking_id.id,
|
||||
'product_id': stock_lot.product_id.id,
|
||||
'lot_id': stock_lot.id
|
||||
})
|
||||
# 将刀具组装入库单的状态更改为就绪
|
||||
picking_id.action_confirm()
|
||||
|
||||
def create_assemble_warehouse_receipt(self):
|
||||
"""
|
||||
创建功能刀具批次/序列号记录
|
||||
"""
|
||||
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
|
||||
|
||||
stock_lot = self.env['stock.lot'].create({
|
||||
'name': self.get_stock_lot_name(),
|
||||
'product_id': product_id.id,
|
||||
'product_qty': 1.00,
|
||||
'company_id': self.env.company.id
|
||||
})
|
||||
|
||||
return stock_lot
|
||||
|
||||
def get_stock_lot_name(self):
|
||||
"""
|
||||
生成功能刀具序列号
|
||||
"""
|
||||
code = 'JKM-T-' + str(self.code) + '-' + str(self.functional_tool_diameter) + '-'
|
||||
new_time = fields.Date.today()
|
||||
code += str(new_time) + '-'
|
||||
stock_lot_id = self.env['stock.lot'].sudo().search(
|
||||
[('name', 'like', new_time), ('product_id.name', '=', '功能刀具')],
|
||||
limit=1,
|
||||
order="id desc"
|
||||
)
|
||||
print(stock_lot_id)
|
||||
if not stock_lot_id:
|
||||
num = "%03d" % 1
|
||||
else:
|
||||
m = int(stock_lot_id.name[-3:]) + 1
|
||||
num = "%03d" % m
|
||||
print(num)
|
||||
return code + str(num)
|
||||
|
||||
|
||||
class DeliveryOfCargoFromStorage(models.TransientModel):
|
||||
_name = 'sf.delivery.of.cargo.from.storage'
|
||||
|
||||
Reference in New Issue
Block a user