1、新增刀具管理模块安装时根据已有机床设备存在的刀位创建机台换刀申请记录
This commit is contained in:
@@ -2,19 +2,18 @@
|
|||||||
from . import models
|
from . import models
|
||||||
from . import wizard
|
from . import wizard
|
||||||
|
|
||||||
# from odoo import api, SUPERUSER_ID
|
from odoo import api, SUPERUSER_ID
|
||||||
# import logging
|
import logging
|
||||||
# _logger = logging.getLogger(__name__)
|
|
||||||
#
|
_logger = logging.getLogger(__name__)
|
||||||
#
|
|
||||||
# def _sf_tool_management_post_install(cr, registry):
|
|
||||||
# # 这里执行你想要在安装模块时执行的操作,包括调用和执行模型的方法
|
def _post_install(cr, registry):
|
||||||
# env = api.Environment(cr, SUPERUSER_ID, {})
|
# 这里执行你想要在安装模块时执行的操作,包括调用和执行模型的方法
|
||||||
#
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
# # 获取需要执行方法的模型
|
|
||||||
# model_obj = env['sf.machine.table.tool.changing.apply']
|
# 获取需要执行方法的模型
|
||||||
# logging.info('post_install方法执行了')
|
model_obj = env['sf.machine.table.tool.changing.apply']
|
||||||
# print('post_install方法执行了')
|
|
||||||
#
|
# 调用模型方法
|
||||||
# # 调用模型方法
|
model_obj.create_tool_change_application()
|
||||||
# model_obj.create_tool_change_application()
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
],
|
],
|
||||||
|
'post_init_hook': '_post_install',
|
||||||
'assets': {
|
'assets': {
|
||||||
|
|
||||||
'web.assets_qweb': [
|
'web.assets_qweb': [
|
||||||
|
|||||||
@@ -477,7 +477,17 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
[('name', '=', self.name.id)]).write({'status': '0'})
|
[('name', '=', self.name.id)]).write({'status': '0'})
|
||||||
|
|
||||||
def create_tool_change_application(self):
|
def create_tool_change_application(self):
|
||||||
print("调用了create_tool_change_application()")
|
maintenance_equipment_ids = self.env['maintenance.equipment'].sudo().search(
|
||||||
|
[('product_template_ids', '!=', False)])
|
||||||
|
tool_changing_apply = self.env['sf.machine.table.tool.changing.apply']
|
||||||
|
if maintenance_equipment_ids:
|
||||||
|
for maintenance_equipment_id in maintenance_equipment_ids:
|
||||||
|
if maintenance_equipment_id.product_template_ids:
|
||||||
|
for product_template_id in maintenance_equipment_id.product_template_ids:
|
||||||
|
tool_changing_apply.sudo().create({
|
||||||
|
'maintenance_equipment_id': product_template_id.equipment_id.id,
|
||||||
|
'cutter_spacing_code_id': product_template_id.id
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class CAMWorkOrderProgramKnifePlan(models.Model):
|
class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||||
|
|||||||
Reference in New Issue
Block a user