1、新增功能刀具列表模型自动计算功能刀具在刀具房数量功能;2、优化功能刀具安全库存模型相同功能刀具的检索条件;3、修改功能刀具组装单组装的初始位置为Production,修改功能刀具序列号的生成规则
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from odoo import fields, models, api
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class ModelType(models.Model):
|
class ModelType(models.Model):
|
||||||
|
|||||||
@@ -10,12 +10,10 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['sf_base', 'sf_manufacturing'],
|
'depends': ['sf_manufacturing'],
|
||||||
'data': [
|
'data': [
|
||||||
# 'security/group_security.xml',
|
# 'security/group_security.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
# 'views/tool_base_views.xml',
|
|
||||||
# # 'views/menu_view.xml',
|
|
||||||
'wizard/wizard_view.xml',
|
'wizard/wizard_view.xml',
|
||||||
'views/tool_base_views.xml',
|
'views/tool_base_views.xml',
|
||||||
'views/menu_view.xml',
|
'views/menu_view.xml',
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
tool_loading_length = fields.Float(string='装刀长(mm)', readonly=True)
|
tool_loading_length = fields.Float(string='装刀长(mm)', readonly=True)
|
||||||
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True)
|
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True)
|
||||||
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
||||||
tool_room_num = fields.Integer(string='刀具房数量', readonly=True, )
|
tool_room_num = fields.Integer(string='刀具房数量', readonly=True, compute='_compute_location_num')
|
||||||
line_edge_knife_library_num = fields.Integer(string='线边刀库数量', readonly=True)
|
line_edge_knife_library_num = fields.Integer(string='线边刀库数量', readonly=True)
|
||||||
machine_knife_library_num = fields.Integer(string='机内刀库数量', readonly=True)
|
machine_knife_library_num = fields.Integer(string='机内刀库数量', readonly=True)
|
||||||
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
|
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
|
||||||
@@ -241,7 +241,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
record = self.env['sf.real.time.distribution.of.functional.tools'].search(
|
record = self.env['sf.real.time.distribution.of.functional.tools'].search(
|
||||||
[('name', '=', vals['name']), ('sf_cutting_tool_type_id', '=', vals['sf_cutting_tool_type_id']),
|
[('name', '=', vals['name']), ('sf_cutting_tool_type_id', '=', vals['sf_cutting_tool_type_id']),
|
||||||
('diameter', '=', vals['diameter']), ('knife_tip_r_angle', '=', vals['knife_tip_r_angle']),
|
('diameter', '=', vals['diameter']), ('knife_tip_r_angle', '=', vals['knife_tip_r_angle']),
|
||||||
('knife_tip_r_angle', '=', vals['knife_tip_r_angle'])])
|
('coarse_middle_thin', '=', vals['coarse_middle_thin'])])
|
||||||
print(record)
|
print(record)
|
||||||
if len(record) > 0:
|
if len(record) > 0:
|
||||||
for obj in record:
|
for obj in record:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from odoo import fields, models, api, SUPERUSER_ID
|
from odoo import fields, models, api, SUPERUSER_ID
|
||||||
from odoo.exceptions import ValidationError
|
# from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
# 刀具物料搜索
|
# 刀具物料搜索
|
||||||
|
|||||||
@@ -284,6 +284,7 @@
|
|||||||
<field name="sf_cutting_tool_type_id" invisible="True"/>
|
<field name="sf_cutting_tool_type_id" invisible="True"/>
|
||||||
<field name="diameter"/>
|
<field name="diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
|
<field name="coarse_middle_thin"/>
|
||||||
<field name="tool_stock_num"/>
|
<field name="tool_stock_num"/>
|
||||||
<field name="side_shelf_num"/>
|
<field name="side_shelf_num"/>
|
||||||
<field name="on_tool_stock_num"/>
|
<field name="on_tool_stock_num"/>
|
||||||
|
|||||||
@@ -438,45 +438,13 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
|
|
||||||
return stock_lot
|
return stock_lot
|
||||||
|
|
||||||
# def tool_material_out_of_store(self, tool_material_serial_id):
|
|
||||||
# """
|
|
||||||
# 刀具物料出库
|
|
||||||
# """
|
|
||||||
# # 获取位置
|
|
||||||
# location_id = self.env['stock.location'].search([('name', '=', 'Stock')])
|
|
||||||
# location_dest_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
|
||||||
# print("已运行2222")
|
|
||||||
# # 创建库存移动
|
|
||||||
# stock_move_id = self.env['stock.move'].create({
|
|
||||||
# 'name': '刀具物料出库',
|
|
||||||
# 'lot_id': tool_material_serial_id.id,
|
|
||||||
# 'product_id': tool_material_serial_id.product_id.id,
|
|
||||||
# 'location_id': location_id.id,
|
|
||||||
# 'location_dest_id': location_dest_id.id,
|
|
||||||
# 'product_uom_qty': 1.00,
|
|
||||||
# 'state': 'done'
|
|
||||||
# })
|
|
||||||
# print("已运行3333")
|
|
||||||
# print(stock_move_id)
|
|
||||||
# # 创建移动历史
|
|
||||||
# stock_move_line_id = self.env['stock.move.line'].create({
|
|
||||||
# 'product_id': tool_material_serial_id.product_id.id,
|
|
||||||
# 'lot_id': tool_material_serial_id.id,
|
|
||||||
# 'move_id': stock_move_id.id,
|
|
||||||
# 'install_tool_time': fields.Datetime.now(),
|
|
||||||
# 'qty_done': 1.0,
|
|
||||||
# 'state': 'done'
|
|
||||||
# })
|
|
||||||
#
|
|
||||||
# return stock_move_id, stock_move_line_id
|
|
||||||
|
|
||||||
def create_stock_quant(self, product_id, stock_lot, functional_tool_assembly):
|
def create_stock_quant(self, product_id, stock_lot, functional_tool_assembly):
|
||||||
"""
|
"""
|
||||||
创建功能刀具该批次/序列号 库存移动和移动历史
|
创建功能刀具该批次/序列号 库存移动和移动历史
|
||||||
"""
|
"""
|
||||||
# 获取位置对象
|
# 获取位置对象
|
||||||
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
|
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
|
||||||
location_inventory_id = self.env['stock.location'].search([('name', '=', 'Inventory adjustment')])
|
location_inventory_id = self.env['stock.location'].search([('name', '=', 'Production')])
|
||||||
|
|
||||||
# 创建库存移动
|
# 创建库存移动
|
||||||
stock_move_id = self.env['stock.move'].create({
|
stock_move_id = self.env['stock.move'].create({
|
||||||
@@ -504,7 +472,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
"""
|
"""
|
||||||
生成功能刀具序列号
|
生成功能刀具序列号
|
||||||
"""
|
"""
|
||||||
code = 'JKM-T-' + str(self.functional_tool_type_id.code) + '-' + str(self.functional_tool_diameter) + '-'
|
code = 'JKM-T-' + str(self.functional_tool_type_id.code) + '-' + str(
|
||||||
|
self.after_assembly_functional_tool_diameter) + '-'
|
||||||
new_time = fields.Date.today()
|
new_time = fields.Date.today()
|
||||||
code += str(new_time) + '-'
|
code += str(new_time) + '-'
|
||||||
stock_lot_id = self.env['stock.lot'].sudo().search(
|
stock_lot_id = self.env['stock.lot'].sudo().search(
|
||||||
|
|||||||
Reference in New Issue
Block a user