Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
# Conflicts: # sf_tool_management/__init__.py # sf_tool_management/models/base.py
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
# -*-coding:utf-8-*-
|
||||
from . import models
|
||||
from . import wizard
|
||||
from odoo import api, SUPERUSER_ID
|
||||
import logging
|
||||
|
||||
# from odoo import api, SUPERUSER_ID
|
||||
# import logging
|
||||
# _logger = logging.getLogger(__name__)
|
||||
#
|
||||
#
|
||||
# def _sf_tool_management_post_install(cr, registry):
|
||||
# # 这里执行你想要在安装模块时执行的操作,包括调用和执行模型的方法
|
||||
# env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
#
|
||||
# # 获取需要执行方法的模型
|
||||
# model_obj = env['sf.machine.table.tool.changing.apply']
|
||||
# logging.info('post_install方法执行了')
|
||||
# print('post_install方法执行了')
|
||||
#
|
||||
# # 调用模型方法
|
||||
# model_obj.create_tool_change_application()
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _post_install(cr, registry):
|
||||
# 这里执行你想要在安装模块时执行的操作,包括调用和执行模型的方法
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
|
||||
# 获取需要执行方法的模型
|
||||
model_obj = env['sf.machine.table.tool.changing.apply']
|
||||
|
||||
# 调用模型方法
|
||||
model_obj.create_tool_change_application()
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
'post_init_hook': '_post_install',
|
||||
'assets': {
|
||||
|
||||
'web.assets_qweb': [
|
||||
|
||||
@@ -477,7 +477,17 @@ class MachineTableToolChangingApply(models.Model):
|
||||
[('name', '=', self.name.id)]).write({'status': '0'})
|
||||
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user