91 lines
2.8 KiB
Python
91 lines
2.8 KiB
Python
from odoo import models, fields, api
|
|
|
|
|
|
class YuthonCareSetting(models.Model):
|
|
_name = 'yuthon.care.setting'
|
|
_description = '关怀类型配置'
|
|
|
|
name = fields.Char(string='名称')
|
|
documents_ids = fields.Many2many('ir.attachment', string="附件")
|
|
|
|
class YuthonInformationCategories(models.Model):
|
|
_name = 'yuthon.information.categories'
|
|
_description = '业务类型'
|
|
|
|
name = fields.Char(string='名称')
|
|
|
|
|
|
class YuthonWorkSetting(models.Model):
|
|
_name = 'yuthon.work.setting'
|
|
_description = '节日类型配置'
|
|
|
|
name = fields.Char(string='名称')
|
|
|
|
|
|
class SealsTypeSetting(models.Model):
|
|
_name = 'seals.type.setting'
|
|
_description = '用章类型'
|
|
|
|
name = fields.Char(string='名称')
|
|
scope_setting_id = fields.Many2one('seals.scope.setting', string="用章范围")
|
|
department_id = fields.Many2one('hr.department', string="部门")
|
|
user_ids = fields.Many2many('res.users', string="保管人")
|
|
start_date = fields.Date(string="生效日期", copy=False, default=fields.Date.today())
|
|
end_date = fields.Date(string="失效日期")
|
|
is_effect = fields.Boolean(string="是否生效", compute="_compute_is_effect")
|
|
scope_setting_ids = fields.Many2many('seals.scope.setting', string="用章范围")
|
|
|
|
def _compute_display_name(self):
|
|
for record in self:
|
|
scope_name = record.scope_setting_id.name if record.scope_setting_id else "无"
|
|
record.display_name = f"{scope_name}{record.name}"
|
|
|
|
|
|
@api.depends('start_date', 'end_date')
|
|
def _compute_is_effect(self):
|
|
today = fields.Date.today()
|
|
for record in self:
|
|
if not record.start_date:
|
|
record.is_effect = False
|
|
elif not record.end_date:
|
|
record.is_effect = record.start_date <= today
|
|
else:
|
|
record.is_effect = record.start_date <= today <= record.end_date
|
|
|
|
class SoongWorkflowLog(models.Model):
|
|
_inherit = 'soong.workflow.log'
|
|
stamp_id = fields.Many2one('seals.type.setting', string='用章')
|
|
|
|
|
|
class SealsScopeSetting(models.Model):
|
|
_name = 'seals.scope.setting'
|
|
_description = '用章范围'
|
|
|
|
name = fields.Char(string='名称')
|
|
|
|
|
|
class SendingUnitSetting(models.Model):
|
|
_name = 'sending.unit.setting'
|
|
_description = '发送单位'
|
|
|
|
name = fields.Char(string='名称')
|
|
|
|
|
|
class ProjectClassifySetting(models.Model):
|
|
_name = 'project.classify.setting'
|
|
_description = '项目分类'
|
|
|
|
name = fields.Char(string='名称')
|
|
|
|
|
|
class ProjectFundingSetting(models.Model):
|
|
_name = 'project.funding.setting'
|
|
_description = '资金来源'
|
|
|
|
name = fields.Char(string='名称')
|
|
|
|
class YuthonMutualType(models.Model):
|
|
_name = 'yuthon.mutual.type'
|
|
_description = '疾病种类'
|
|
|
|
name = fields.Char(string='名称') |