diff --git a/sf_tool_management/__init__.py b/sf_tool_management/__init__.py index 041ffad6..c081ee06 100644 --- a/sf_tool_management/__init__.py +++ b/sf_tool_management/__init__.py @@ -1,2 +1,2 @@ # -*-coding:utf-8-*- -from . import models \ No newline at end of file +from . import models diff --git a/sf_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py index 29eb4eb3..8368f528 100644 --- a/sf_tool_management/__manifest__.py +++ b/sf_tool_management/__manifest__.py @@ -12,10 +12,9 @@ 'website': 'https://www.sf.jikimo.com', 'depends': ['account', 'sf_base', 'mrp'], 'data': [ + 'security/group_security.xml', 'security/ir.model.access.csv', - - 'views/functional_tool_real_time_distribution_view.xml', - 'views/function_tool_entry_exit_records_view.xml', + 'views/tool_base_views.xml', 'views/menu_view.xml', ], diff --git a/sf_tool_management/models/__init__.py b/sf_tool_management/models/__init__.py index 6ba6e9ad..c1c7e803 100644 --- a/sf_tool_management/models/__init__.py +++ b/sf_tool_management/models/__init__.py @@ -1,4 +1,2 @@ from . import base -from . import functional_tool_real_time_distribution -from . import function_tool_entry_exit_records diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index faaaf799..af915884 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -1,3 +1,76 @@ # -*- coding: utf-8 -*- +from odoo import fields, models, api +class FunctionalCuttingToolEntity(models.Model): + _name = 'sf.functional.cutting.tool.entity' + _inherit = 'sf.functional.cutting.tool' + _description = '功能刀具管理' + + order = fields.Char(string='序') + + # 功能刀具预警 特有字段 + install_tool_time = fields.Char("装刀时间") + outbound_time = fields.Char('出库时间') + on_board_time = fields.Char('上机时间') + machine_tool_code = fields.Char('机台号') + cutting_tool_code = fields.Char('刀位号') + idle_time = fields.Char('闲置时长') + alarm_value = fields.Char('报警值') + used_value = fields.Char('已使用值') + alarm_type = fields.Char('报警类型') + alarm_time = fields.Char('报警时间') + dispose_user = fields.Char('处理人') + dispose_time = fields.Char('处理时间') + dispose_func = fields.Char('处理方法/措施') + remark = fields.Char('备注') + + # 功能刀具出入库记录 特有字段 + thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '细')], string='粗/中/细') + max_life_span = fields.Char(string='最大寿命值') + # alarm_value = fields.Char(string='报警值') + # used_value = fields.Char(string='已使用值') + current_state = fields.Char(string='当前状态') + current_store_area = fields.Char(string='当前库区') + current_store_place = fields.Char(string='当前库位') + number = fields.Integer(string='数量') + reason_application = fields.Char(string='申请原因') + applicant = fields.Char(string='申请人') + return_staff = fields.Char(string='归还人') + return_time = fields.Date(string='归还入库时间') + tool_state = fields.Char(string="刀具状态") + tool_install_staff = fields.Char(string='装刀人') + tool_install_time = fields.Datetime(string='装刀时间') + receive_equipment = fields.Char(string='领用机台') + receive_staff = fields.Char(string='领用人') + receive_time = fields.Char(string='领用出库时间') + # remark = fields.Text(string='备注/说明') + + # 功能刀具实时分布 + tool_stock_num = fields.Text(string='刀具房库存数量') + side_shelf_num = fields.Text(string='线边货架货架数量') + on_tool_stock_num = fields.Text(string='机内刀库库存数量') + tool_stock_total = fields.Text(string='合计') + return_reuse_num_re = fields.Text(string='归还再用数量(精)') + return_reuse_num_co = fields.Text(string='归还再用数量(粗)') + return_processing_num = fields.Text(string='归还需磨削数量') + return_total = fields.Text(string='合计') + total = fields.Text(string='总计') + # remark = fields.Text(string='备注/说明') + + @api.model + def create(self, vals): + + if not vals.get('order'): + vals['order'] = self._generate_code() + return super(FunctionalCuttingToolEntity, self).create(vals) + + @api.model + def _generate_code(self): + last_tool = self.search([], order='id desc', limit=1) + if last_tool: + last_code = int(last_tool.code.split('-')[-1]) + new_code = '{:03d}'.format(last_code + 1) + else: + new_code = '001' + return new_code diff --git a/sf_tool_management/models/function_tool_entry_exit_records.py b/sf_tool_management/models/function_tool_entry_exit_records.py deleted file mode 100644 index d40c7478..00000000 --- a/sf_tool_management/models/function_tool_entry_exit_records.py +++ /dev/null @@ -1,47 +0,0 @@ -from odoo import models,fields,api - - -class FunctionToolEntryExitRecords(models.Model): - _name = 'sf.function.tool.entry.exit.records' - _description = '功能刀具出入库记录' - _inherit = 'sf.functional.cutting.tool' - - order = fields.Char(string='序') - - thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '细')], string='粗/中/细') - max_life_span = fields.Char(string='最大寿命值') - alarm_value = fields.Char(string='报警值') - used_value = fields.Char(string='已使用值') - current_state = fields.Char(string='当前状态') - current_store_area = fields.Char(string='当前库区') - current_store_place = fields.Char(string='当前库位') - number = fields.Integer(string='数量') - reason_application = fields.Char(string='申请原因') - applicant = fields.Char(string='申请人') - return_staff = fields.Char(string='归还人') - return_time = fields.Date(string='归还入库时间') - tool_state = fields.Char(string="刀具状态") - tool_install_staff = fields.Char(string='装刀人') - tool_install_time = fields.Datetime(string='装刀时间') - receive_equipment = fields.Char(string='领用机台') - receive_staff = fields.Char(string='领用人') - receive_time = fields.Char(string='领用出库时间') - - remark = fields.Text(string='备注/说明') - - @api.model - def create(self, vals): - - if not vals.get('order'): - vals['order'] = self._generate_code() - return super(FunctionToolEntryExitRecords, self).create(vals) - - @api.model - def _generate_code(self): - last_tool = self.search([], order='id desc', limit=1) - if last_tool: - last_code = int(last_tool.code.split('-')[-1]) - new_code = '{:03d}'.format(last_code + 1) - else: - new_code = '001' - return new_code \ No newline at end of file diff --git a/sf_tool_management/models/functional_tool_real_time_distribution.py b/sf_tool_management/models/functional_tool_real_time_distribution.py deleted file mode 100644 index 7e7fbca8..00000000 --- a/sf_tool_management/models/functional_tool_real_time_distribution.py +++ /dev/null @@ -1,38 +0,0 @@ -from odoo import fields, models,api - - -class FunctionalToolRealTimeDistribution(models.Model): - _name = 'sf.functional.tool.real.time.distribution' - _description = "功能刀具实时分布" - _inherit = 'sf.functional.cutting.tool' - - order = fields.Char(string='序') - - tool_stock_num = fields.Text(string='刀具房库存数量') - side_shelf_num = fields.Text(string='线边货架货架数量') - on_tool_stock_num = fields.Text(string='机内刀库库存数量') - tool_stock_total = fields.Text(string='合计') - - return_reuse_num_re = fields.Text(string='归还再用数量(精)') - return_reuse_num_co = fields.Text(string='归还再用数量(粗)') - return_processing_num = fields.Text(string='归还需磨削数量') - return_total = fields.Text(string='合计') - total = fields.Text(string='总计') - remark = fields.Text(string='备注/说明') - - @api.model - def create(self, vals): - - if not vals.get('order'): - vals['order'] = self._generate_code() - return super(FunctionalToolRealTimeDistribution, self).create(vals) - - @api.model - def _generate_code(self): - last_tool = self.search([], order='id desc', limit=1) - if last_tool: - last_code = int(last_tool.code.split('-')[-1]) - new_code = '{:03d}'.format(last_code + 1) - else: - new_code = '001' - return new_code \ No newline at end of file diff --git a/sf_tool_management/security/group_security.xml b/sf_tool_management/security/group_security.xml new file mode 100644 index 00000000..b8668782 --- /dev/null +++ b/sf_tool_management/security/group_security.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv index b902d4e5..3156f716 100644 --- a/sf_tool_management/security/ir.model.access.csv +++ b/sf_tool_management/security/ir.model.access.csv @@ -1,3 +1,7 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_sf_functional_tool_real_time_distribution,sf.functional.tool.real.time.distribution,model_sf_functional_tool_real_time_distribution,base.group_user,1,1,1,1 -access_sf_function_tool_entry_exit_records,sf.function.tool.entry.exit.records,model_sf_function_tool_entry_exit_records,base.group_user,1,1,1,1 +access_sf_functional_cutting_tool_entity,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,base.group_user,1,1,1,1 + + + + + diff --git a/sf_tool_management/views/function_tool_entry_exit_records_view.xml b/sf_tool_management/views/function_tool_entry_exit_records_view.xml deleted file mode 100644 index b82dce71..00000000 --- a/sf_tool_management/views/function_tool_entry_exit_records_view.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - 功能刀具出入库记录 - sf.function.tool.entry.exit.records - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 功能刀具出入库记录 - sf.function.tool.entry.exit.records - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - 功能刀具出入库记录 - ir.actions.act_window - sf.function.tool.entry.exit.records - tree,form - -
\ No newline at end of file diff --git a/sf_tool_management/views/functional_tool_real_time_distribution_view.xml b/sf_tool_management/views/functional_tool_real_time_distribution_view.xml deleted file mode 100644 index 4133bf1f..00000000 --- a/sf_tool_management/views/functional_tool_real_time_distribution_view.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - 功能刀具实时分布 - sf.functional.tool.real.time.distribution - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 功能刀具实时分布 - sf.functional.tool.real.time.distribution - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - - 功能刀具实时分布 - ir.actions.act_window - sf.functional.tool.real.time.distribution - tree,form - -
\ No newline at end of file diff --git a/sf_tool_management/views/menu_view.xml b/sf_tool_management/views/menu_view.xml index 841f368c..2abf6a11 100644 --- a/sf_tool_management/views/menu_view.xml +++ b/sf_tool_management/views/menu_view.xml @@ -1,18 +1,37 @@ - + + + 功能刀具预警 + ir.actions.act_window + sf.functional.cutting.tool.entity + tree + + + + + name="功能刀具列表" + sequence="3" + action="sf_base.action_sf_functional_cutting_tool" + /> + + + + /> + /> \ No newline at end of file diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml new file mode 100644 index 00000000..8bf5a904 --- /dev/null +++ b/sf_tool_management/views/tool_base_views.xml @@ -0,0 +1,146 @@ + + + + + + sf.functional.cutting.tool.entity.tree + sf.functional.cutting.tool.entity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 功能刀具出入库记录 + sf.functional.cutting.tool.entity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 功能刀具出入库记录 + ir.actions.act_window + sf.functional.cutting.tool.entity + tree + + + + + + + 功能刀具实时分布 + sf.functional.cutting.tool.entity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 功能刀具实时分布 + ir.actions.act_window + sf.functional.cutting.tool.entity + tree + + + + +