设备维保
This commit is contained in:
28
sf_maintenance/models/sf_equipment_maintenance_standards.py
Normal file
28
sf_maintenance/models/sf_equipment_maintenance_standards.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*-coding:utf-8-*-
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
class SfEquipmentSaintenanceStandards(models.Model):
|
||||
_name = 'equipment.maintenance.standards'
|
||||
_description = '设备维保标准'
|
||||
|
||||
def get_no(self):
|
||||
partner = self.env['equipment.maintenance.standards'].sudo().search(
|
||||
[('code', '!=', '')],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not partner:
|
||||
num = "%04d" % 1
|
||||
|
||||
else:
|
||||
m = int(partner.code) + 1
|
||||
num = "%04d" % m
|
||||
return num
|
||||
code = fields.Char(string='编码', default=get_no)
|
||||
maintenance_type = fields.Selection([('保养', '保养'), ("检修", "检修")], string='类型', default='保养')
|
||||
name = fields.Char(string='名称')
|
||||
created_user_id = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||
maintenance_equipment_category_id = fields.Many2one('maintenance.equipment.category', string='设备类别')
|
||||
maintenance_equipment_ids = fields.Many2many('maintenance.equipment', 'equipment_maintenance_standards_ids', string='设备')
|
||||
maintenance_projects = fields.Char('维保项目')
|
||||
maintenance_standards = fields.Char('维保标准')
|
||||
Reference in New Issue
Block a user