开发sf制造模块权限角色

This commit is contained in:
qihao.gong@jikimo.com
2023-11-21 17:42:36 +08:00
parent 580f95f338
commit e6bb5db0e1
13 changed files with 162 additions and 52 deletions

View File

@@ -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):
@@ -64,7 +65,8 @@ class SfMaintenanceEquipment(models.Model):
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):
@@ -278,7 +280,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 +307,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('机器人环境湿度')
@@ -433,7 +438,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 +451,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 +482,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 +495,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 +586,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):