diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index 1fb1daa6..da6919a4 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['account', 'base', 'mrp_workorder', 'sale', 'purchase'], + 'depends': ['account', 'base', 'mrp_workorder', 'sale', 'purchase', 'sales_team'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', diff --git a/sf_base/commons/__init__.py b/sf_base/commons/__init__.py index d89945c1..e4193cf0 100644 --- a/sf_base/commons/__init__.py +++ b/sf_base/commons/__init__.py @@ -1 +1 @@ -from. import common +from . import common diff --git a/sf_base/commons/common.py b/sf_base/commons/common.py index a1aed3c2..05a2143f 100644 --- a/sf_base/commons/common.py +++ b/sf_base/commons/common.py @@ -8,7 +8,7 @@ class Common(models.Model): _name = 'sf.sync.common' _description = u'公用类' - def get_headers(self,token, secret_key): + def get_headers(self, token, secret_key): ''' 获取requests中的heardes参数 ''' @@ -19,5 +19,3 @@ class Common(models.Model): 'TIMESTAMP': str(timestamp), 'checkstr': check_sf_str} return headers - - diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py index 93961162..31dfcf95 100644 --- a/sf_base/models/__init__.py +++ b/sf_base/models/__init__.py @@ -4,9 +4,3 @@ from . import tool_base_new from . import fixture from . import functional_fixture from . import tool_other_features - - - - - - diff --git a/sf_base/models/common.py b/sf_base/models/common.py index 7ec20654..f6e6771a 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -17,29 +17,7 @@ class MrsProductionMaterials(models.Model): remark = fields.Text("备注") active = fields.Boolean('有效', default=True) - # def open_url_action(self): - # base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') - # # url = 'http://192.168.50.202:8080/api' - # url = 'https://bfw.jikimo.com/' - # # data = { - # # 'key' : 'value' - # # } - # - # response = requests.get(url) - # response.raise_for_status() - # return { - # 'type': 'ir.actions.act_url', - # 'url': response.url, - # 'target': 'new' - # } - - - def open_url_action(self): - # sf_sync_config = self.env['res.config.settings'].get_values() - # token = sf_sync_config['token'] - # sf_secret_key = sf_sync_config['sf_secret_key'] - # headers = Common.get_headers(self, token, sf_secret_key) url = 'http://192.168.50.127:8081' params = { 'user_id': self._uid @@ -82,7 +60,6 @@ class MrsMaterialModel(models.Model): active = fields.Boolean('有效', default=True) - class MrsProductionProcessCategory(models.Model): _name = 'sf.production.process.category' _description = '表面工艺类别' @@ -131,6 +108,7 @@ class MrsProcessingOrder(models.Model): index=True, string='加工工艺') production_process_id = fields.Many2one('sf.production.process', string="表面工艺") + class SupplierSort(models.Model): _name = 'sf.supplier.sort' _description = '供应商排序' diff --git a/sf_base/models/functional_fixture.py b/sf_base/models/functional_fixture.py index b0659da9..a3677947 100644 --- a/sf_base/models/functional_fixture.py +++ b/sf_base/models/functional_fixture.py @@ -1,5 +1,5 @@ -import requests import json +import requests from odoo import models, fields, api from odoo.addons.sf_base.commons.common import Common from odoo.exceptions import ValidationError diff --git a/sf_base/security/group_security.xml b/sf_base/security/group_security.xml index cfe816dd..4d57bc43 100644 --- a/sf_base/security/group_security.xml +++ b/sf_base/security/group_security.xml @@ -1,21 +1,58 @@ + + 制造普通用户 + + + + + + + + + + + + + + + 机床操作岗 + + + + + 刀具组装岗 + + + + + 工件装夹岗 + + + + + + 生产总监 + + + + + 计划 20 - + 销售经理 - - - - - - + + 销售总监 + + + 计划调度岗 diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 37daa2b3..1a550d41 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -40,3 +40,5 @@ access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance + + diff --git a/sf_bf_connect/controllers/__init__.py b/sf_bf_connect/controllers/__init__.py index b2809a39..e046e49f 100644 --- a/sf_bf_connect/controllers/__init__.py +++ b/sf_bf_connect/controllers/__init__.py @@ -1,3 +1 @@ -from .import controllers - - +from . import controllers diff --git a/sf_bf_connect/models/__init__.py b/sf_bf_connect/models/__init__.py index 21f9d732..84f8bf3a 100644 --- a/sf_bf_connect/models/__init__.py +++ b/sf_bf_connect/models/__init__.py @@ -2,4 +2,3 @@ from . import http from . import models from . import process_status from . import jd_eclp - diff --git a/sf_bf_connect/models/models.py b/sf_bf_connect/models/models.py index 5aba960a..07393353 100644 --- a/sf_bf_connect/models/models.py +++ b/sf_bf_connect/models/models.py @@ -4,7 +4,6 @@ import uuid import string import random - from odoo import fields, models __author__ = 'jinling.yang' @@ -25,4 +24,4 @@ class ResPartner(models.Model): return ran_str sf_token = fields.Char(u'Token', default=get_token) - sf_secret_key = fields.Char(u'密钥', default=get_secret) \ No newline at end of file + sf_secret_key = fields.Char(u'密钥', default=get_secret) diff --git a/sf_dlm/__init__.py b/sf_dlm/__init__.py index 899bcc97..0650744f 100644 --- a/sf_dlm/__init__.py +++ b/sf_dlm/__init__.py @@ -1,2 +1 @@ from . import models - diff --git a/sf_dlm/data/product_data.xml b/sf_dlm/data/product_data.xml index 3cc92912..9b562fbb 100644 --- a/sf_dlm/data/product_data.xml +++ b/sf_dlm/data/product_data.xml @@ -35,6 +35,11 @@ 功能刀具 + + 业务平台 + + + 功能刀具 diff --git a/sf_dlm_management/__manifest__.py b/sf_dlm_management/__manifest__.py index b10fa76d..a32ecf81 100644 --- a/sf_dlm_management/__manifest__.py +++ b/sf_dlm_management/__manifest__.py @@ -9,7 +9,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['sf_sale', 'sf_dlm','sf_manufacturing'], + 'depends': ['sf_sale', 'sf_dlm', 'sf_manufacturing'], 'data': [ 'views/product_template_management_view.xml', ], diff --git a/sf_dlm_management/models/__init__.py b/sf_dlm_management/models/__init__.py index a4da1521..8c38257e 100644 --- a/sf_dlm_management/models/__init__.py +++ b/sf_dlm_management/models/__init__.py @@ -1,7 +1,2 @@ -#from . import product_template -#from . import product_supplierinfo - - - - -# \ No newline at end of file +# from . import product_template +# from . import product_supplierinfo diff --git a/sf_maintenance/__manifest__.py b/sf_maintenance/__manifest__.py index 7bfe057d..9c3c978a 100644 --- a/sf_maintenance/__manifest__.py +++ b/sf_maintenance/__manifest__.py @@ -6,7 +6,7 @@ 'category': '工厂设备', 'description': """ """, - 'depends': ['maintenance', 'sf_base'], + 'depends': ['hr_maintenance', 'sf_base'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', diff --git a/sf_maintenance/models/sf_equipment_maintenance_standards.py b/sf_maintenance/models/sf_equipment_maintenance_standards.py index 80ec2ba3..2892cac4 100644 --- a/sf_maintenance/models/sf_equipment_maintenance_standards.py +++ b/sf_maintenance/models/sf_equipment_maintenance_standards.py @@ -2,6 +2,7 @@ from odoo import api, fields, models, SUPERUSER_ID, _ from odoo.exceptions import UserError + class SfEquipmentSaintenanceStandards(models.Model): _name = 'equipment.maintenance.standards' _description = '设备维保标准' @@ -18,6 +19,7 @@ class SfEquipmentSaintenanceStandards(models.Model): m = int(partner.code[-4:]) + 1 num = "%04d" % m return num + code = fields.Char(string='编码') remark = fields.Char('备注') maintenance_type = fields.Selection([('保养', '保养'), ("检修", "检修")], string='类型', default='保养') @@ -69,6 +71,7 @@ class SfEquipmentSaintenanceStandards(models.Model): # work.sequence = current_sequence # current_sequence += 1 + class SfSaintenanceStandards(models.Model): _name = 'maintenance.standards' _description = '维保项目' @@ -92,7 +95,3 @@ class MaintenanceStandardImage(models.Model): image = fields.Binary(string='维保图片') standard_id = fields.Many2one('maintenance.standards', string='Standard') - - - - diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index bf58c8f2..8078913a 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -12,7 +12,8 @@ class SfMaintenanceEquipmentCategory(models.Model): _inherit = 'maintenance.equipment.category' _description = '设备类别' - equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'), ('检测设备', '检测设备')], string='类型', default='机床') + equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'), + ('检测设备', '检测设备')], string='类型', default='机床') class SfMaintenanceEquipment(models.Model): @@ -62,9 +63,10 @@ class SfMaintenanceEquipment(models.Model): else: record.equipment_maintenance_standards_ids = False - MTcode = fields.Char("编码", default=get_no) + MTcode = fields.Char("机台编码", default=get_no) created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user) - equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'), ('检测设备', '检测设备')], compute='_compute_category_id') + equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'), ('检测设备', '检测设备')] + , compute='_compute_category_id') @api.depends('category_id') def _compute_category_id(self): @@ -72,8 +74,8 @@ class SfMaintenanceEquipment(models.Model): if record: record.equipment_type = record.category_id.equipment_type - code = fields.Char('机台号') - name = fields.Char('名称') + code = fields.Char('行业编码') + name = fields.Char('机台号') knife_type = fields.Selection( [("BT40", "BT40"), ("BT30", "BT30"), ("BT50", "BT50")], default="", string="刀把类型") @@ -152,6 +154,18 @@ class SfMaintenanceEquipment(models.Model): result.append((parameter.id, name)) return result + @api.model + def create(self, vals): + # 在创建设备之前执行一些自定义逻辑 + + equipment = super(SfMaintenanceEquipment, self).create(vals) + equipment.name = equipment.MTcode + '#' + equipment.category_id.name + + # 在创建设备之后执行一些自定义逻辑 + # ... + + return equipment + # @api.constrains('rotate_speed') # def _check_rotate_speed(self): # if self.rotate_speed <= 0: @@ -278,7 +292,8 @@ class SfMaintenanceEquipment(models.Model): detect_y_axis = fields.Char('检测Y轴') detect_z_axis = fields.Char('检测Z轴') detect_precision = fields.Char('测量精度') - detect_measurement_mode = fields.Selection([('光栅尺', '光栅尺'), ('容栅', '容栅'), ('磁栅', '磁栅'), ('激光干涉仪', '激光干涉仪')], string='测量方式') + detect_measurement_mode = fields.Selection([('光栅尺', '光栅尺'), ('容栅', '容栅'), ('磁栅', '磁栅'), + ('激光干涉仪', '激光干涉仪')], string='测量方式') detect_resolution = fields.Char('分辨率') detect_load_weight_max = fields.Char('最大负载重量') detect_weight = fields.Char('本体总重量') @@ -304,13 +319,15 @@ class SfMaintenanceEquipment(models.Model): robot_load_weight_max = fields.Char('最大负载重量') robot_weight = fields.Char('本体总重量') robot_repeatable_positioning_accuracy = fields.Char('重复定位精度') - robot_axis_num = fields.Selection([('2轴', '2轴'), ('3轴', '3轴'), ('4轴', '4轴'), ('5轴', '5轴'), ('6轴', '6轴'), ('7轴', '7轴'), ('8轴', '8轴')], string='轴数') + robot_axis_num = fields.Selection([('2轴', '2轴'), ('3轴', '3轴'), ('4轴', '4轴'), ('5轴', '5轴'), ('6轴', '6轴'), + ('7轴', '7轴'), ('8轴', '8轴')], string='轴数') axis_ids = fields.One2many('sf.robot.axis.num', 'equipment_id', string='动作范围') robot_track_dimensions_L = fields.Char('轨道尺寸(长)') robot_track_dimensions_W = fields.Char('轨道尺寸(宽)') robot_track_dimensions_H = fields.Char('轨道尺寸(高)') robot_drive_mode = fields.Char('驱动方式') - robot_installation_method = fields.Selection([('置地式', '置地式'), ('壁挂式', '壁挂式'), ('倒挂式', '倒挂式')], string='安装方式') + robot_installation_method = fields.Selection([('置地式', '置地式'), ('壁挂式', '壁挂式'), ('倒挂式', '倒挂式')], + string='安装方式') robot_operating_temperature = fields.Char('机器人环境温度') robot_operating_humidity = fields.Char('机器人环境湿度') @@ -347,7 +364,7 @@ class SfMaintenanceEquipment(models.Model): images_ids_names = [] for a in self.env['maintenance.equipment.image'].search([('id', 'in', item.image_id.ids)]): images_ids_names.append(a.name) - if item.machine_tool_picture != False: + if item.machine_tool_picture: image = base64.b64encode(item.machine_tool_picture).decode('utf-8') else: image = False @@ -433,7 +450,8 @@ class SfMaintenanceEquipment(models.Model): if next_maintenance_todo and last_maintenance_done: next_date = next_maintenance_todo.request_date date_gap = next_maintenance_todo.request_date - last_maintenance_done.close_date - # If the gap between the last_maintenance_done and the next_maintenance_todo one is bigger than 2 times the period and next request is in the future + # If the gap between the last_maintenance_done and the next_maintenance_todo one is bigger than + # 2 times the period and next request is in the future # We use 2 times the period to avoid creation too closed request from a manually one created if date_gap > timedelta(0) and date_gap > timedelta( days=equipment.period) * 2 and next_maintenance_todo.request_date > date_now: @@ -445,7 +463,8 @@ class SfMaintenanceEquipment(models.Model): elif next_maintenance_todo: next_date = next_maintenance_todo.request_date date_gap = next_maintenance_todo.request_date - date_now - # If next maintenance to do is in the future, and in more than 2 times the period, we insert an new request + # If next maintenance to do is in the future, and in more than 2 times the period, we insert + # an new request # We use 2 times the period to avoid creation too closed request from a manually one created if date_gap > timedelta(0) and date_gap > timedelta(days=equipment.period) * 2: next_date = date_now + timedelta(days=equipment.period) @@ -475,7 +494,8 @@ class SfMaintenanceEquipment(models.Model): if next_maintenance_todo and last_maintenance_done: next_date = next_maintenance_todo.request_date date_gap = next_maintenance_todo.request_date - last_maintenance_done.close_date - # If the gap between the last_maintenance_done and the next_maintenance_todo one is bigger than 2 times the period and next request is in the future + # If the gap between the last_maintenance_done and the next_maintenance_todo one is bigger than 2 + # times the period and next request is in the future # We use 2 times the period to avoid creation too closed request from a manually one created if date_gap > timedelta(0) and date_gap > timedelta( days=equipment.overhaul_period) * 2 and next_maintenance_todo.request_date > date_now: @@ -487,7 +507,8 @@ class SfMaintenanceEquipment(models.Model): elif next_maintenance_todo: next_date = next_maintenance_todo.request_date date_gap = next_maintenance_todo.request_date - date_now - # If next maintenance to do is in the future, and in more than 2 times the period, we insert an new request + # If next maintenance to do is in the future, and in more than 2 times the period, we insert + # an new request # We use 2 times the period to avoid creation too closed request from a manually one created if date_gap > timedelta(0) and date_gap > timedelta(days=equipment.overhaul_period) * 2: next_date = date_now + timedelta(days=equipment.overhaul_period) @@ -577,7 +598,8 @@ class SfMaintenanceEquipment(models.Model): if not next_requests: equipment._create_new_request1(equipment.overhaul_date) - image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id', string='加工能力', domain="[('type', '=', '加工能力')]") + image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id', string='加工能力', + domain="[('type', '=', '加工能力')]") class SfRobotAxisNum(models.Model): diff --git a/sf_maintenance/models/sf_maintenance_logs.py b/sf_maintenance/models/sf_maintenance_logs.py index 9adf5be7..5c798754 100644 --- a/sf_maintenance/models/sf_maintenance_logs.py +++ b/sf_maintenance/models/sf_maintenance_logs.py @@ -1,6 +1,7 @@ # -*-coding:utf-8-*- from odoo import fields, models + class SfMaintenanceLogs(models.Model): _name = 'sf.maintenance.logs' _description = '设备故障日志' @@ -11,16 +12,17 @@ class SfMaintenanceLogs(models.Model): brand = fields.Many2one('sf.machine.brand', related='maintenance_equipment_id.brand_id', string='品牌') maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='设备') code_location = fields.Char(string='编码位置') - fault_type = fields.Selection([('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='故障类型') + fault_type = fields.Selection( + [('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='故障类型') fault_code = fields.Char(string='故障代码') fault_alarm_info = fields.Char(string='故障报警信息') - alarm_level = fields.Selection([('一级', '一级(严重)'), ('二级', '二级(中等)'), ('三级', '三级(轻微)')], string='报警级别') + alarm_level = fields.Selection([('一级', '一级(严重)'), ('二级', '二级(中等)'), ('三级', '三级(轻微)')], + string='报警级别') alarm_time = fields.Datetime(string='报警时间') - alarm_way = fields.Selection([('文本提示报警', '文本提示报警'), ('声光报警', '声光报警'), ('图文报警', '图文报警')], string='报警方式') + alarm_way = fields.Selection([('文本提示报警', '文本提示报警'), ('声光报警', '声光报警'), ('图文报警', '图文报警')], + string='报警方式') fault_process = fields.Text(string='故障处理方法') operator = fields.Many2one('res.users', string='处理人') recovery_time = fields.Datetime(string='复原时间') fault_duration = fields.Float(string='故障时长') note = fields.Text(string='备注') - - diff --git a/sf_maintenance/models/sf_maintenance_requests.py b/sf_maintenance/models/sf_maintenance_requests.py index 330c1ece..4c9e8fde 100644 --- a/sf_maintenance/models/sf_maintenance_requests.py +++ b/sf_maintenance/models/sf_maintenance_requests.py @@ -12,7 +12,7 @@ class SfMaintenanceEquipmentCategory(models.Model): sf_maintenance_type = fields.Selection([('保养', '保养'), ('检修', '检修')], string='维保类别', default='保养') equipment_maintenance_id = fields.Many2one('equipment.maintenance.standards', string='设备维保标准', - domain="[('maintenance_type','=',sf_maintenance_type)]") + domain="[('maintenance_type','=',sf_maintenance_type)]") @api.onchange('sf_maintenance_type') def _compute_equipment_maintenance_request_id(self): @@ -38,8 +38,3 @@ class SfMaintenanceEquipmentCategory(models.Model): def confirm_maintenance_done(self): self.write({'stage_id': 3}) - - - - - diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 435e291c..ff0b6e73 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -52,11 +52,13 @@ -

@@ -416,136 +424,43 @@ 功能刀具出入库记录 - sf.inbound.and.outbound.records.of.functional.tools + stock.move.line - - - - - - - - - - - - - + + + + + + + + + + + - - 功能刀具出入库记录 - sf.inbound.and.outbound.records.of.functional.tools - -
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
功能刀具出入库记录 - sf.inbound.and.outbound.records.of.functional.tools + stock.move.line - + + - - - - - - - - - - - + + + + + + + + - + @@ -554,62 +469,13 @@ 功能刀具出入库记录 ir.actions.act_window - sf.inbound.and.outbound.records.of.functional.tools - tree,form,search - - - - - - 出入库记录 - sf.inbound.and.outbound.records - - - - - - - - - - - - - - - - - 出入库记录 - sf.inbound.and.outbound.records - -
- - - - - - - - - - - - - - - - - - -
-
-
- - - 出入库记录 - ir.actions.act_window - sf.inbound.and.outbound.records - tree,form + stock.move.line + tree,search + + + [('functional_tool_name_id', '!=', False)] @@ -624,7 +490,7 @@ - + @@ -639,9 +505,8 @@ - - +