diff --git a/room/security/ir_rule.xml b/room/security/ir_rule.xml
index 7dd5ed968..c20ade81a 100644
--- a/room/security/ir_rule.xml
+++ b/room/security/ir_rule.xml
@@ -6,9 +6,9 @@
-
- 预定会议多公司
-
+
+ 会议室多公司
+
[('company_id', 'in', company_ids)]
diff --git a/soong_workflow/models/soong_user_role.py b/soong_workflow/models/soong_user_role.py
index 763c37fb2..122de7d42 100644
--- a/soong_workflow/models/soong_user_role.py
+++ b/soong_workflow/models/soong_user_role.py
@@ -23,6 +23,23 @@ class YuthonUserRole(models.Model):
company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.company)
pinyin_name = fields.Char(string="拼音名称", compute='_compute_pinyin', index=True)
+ @api.onchange('is_main')
+ def _onchange_is_main(self):
+ for employee in self.personnel_ids:
+ employee_id = self.env['hr.employee'].search([('id', '=', employee.id.origin)])
+ if self.is_main:
+ # 1. 是主角色:替换主角色,清空辅助角色中的当前记录
+ employee_id.user_role_id = self.id.origin
+ if self.id.origin in employee_id.user_role_ids.ids:
+ employee_id.user_role_ids = [(3, self.id.origin)] # 从辅助角色移除
+ else:
+ # 2. 不是主角色:检查辅助角色,没有则添加
+ if self.id.origin not in employee_id.user_role_ids.ids:
+ employee_id.user_role_ids = [(4, self.id.origin)] #
+
+
+
+
@api.depends('department_id')
def _compute_display_name(self):
for record in self:
diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py
index 22b9e08e3..894a55a7b 100644
--- a/soong_workflow/models/soong_workflow_record.py
+++ b/soong_workflow/models/soong_workflow_record.py
@@ -28,7 +28,7 @@ class SoongWorkflowRecord(models.Model):
re.name = res_name
return super(SoongWorkflowRecord, self).read(fields=fields, load=load)
- name = fields.Char(string="名称")
+ name = fields.Text(string="名称")
code = fields.Char(string="流水号")
write_date2 = fields.Datetime(string="最后更新日期", readoly="1")
res_model = fields.Char(string="Res Model", required=True)
diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py
index e4ddc8e4d..d2a2080ae 100644
--- a/soong_workflow/wizard/soong_workflow_comment_wizard.py
+++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py
@@ -57,7 +57,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
@api.onchange('employee_ids1')
def _onchange_employee_ids1(self):
if len(self.employee_ids1) == 1:
- self.employee_ids = self.employee_ids
+ self.employee_ids = self.employee_ids1
@api.constrains('employee_ids')
def _check_employee_ids(self):
diff --git a/yuthon_hr_employee_approval/models/yuthon_service_approval.py b/yuthon_hr_employee_approval/models/yuthon_service_approval.py
index 1cfd872f9..f30ad68aa 100644
--- a/yuthon_hr_employee_approval/models/yuthon_service_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_service_approval.py
@@ -49,5 +49,12 @@ class YuthonServiceApproval(models.Model):
@api.onchange('service_type')
def _onchange_service_type(self):
- if self.service_type:
- self.name = self.users_id.name + '-' + self.service_type.name
+ if self.service_type and self.users_id.name:
+ # 创建一个映射表,将技术值映射到显示文本
+ service_type_map = {
+ 'done': '在职证明',
+ 'leaving': '离职证明',
+ 'income': '收入证明'
+ }
+ service_display = service_type_map.get(self.service_type, self.service_type)
+ self.name = f"{self.users_id.name}的{service_display}"
\ No newline at end of file
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 89de97c0d..2869ee6d8 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -299,6 +299,11 @@ class YuthonProperty(models.Model):
}
}
+ @api.depends('precinct_id', 'admin_id')
+ def _compute_display_name(self):
+ for record in self:
+ if record.precinct_id and record.admin_id:
+ record.display_name = record.precinct_id.name + record.admin_id.name
def put_assessment_approval(self):
for record in self:
diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml
index 240fe6d56..367d086b8 100644
--- a/yuthon_property/views/yuthon_property_views.xml
+++ b/yuthon_property/views/yuthon_property_views.xml
@@ -283,7 +283,7 @@
-
+
diff --git a/yuthon_trade/data/sale_renting_code_data.xml b/yuthon_trade/data/sale_renting_code_data.xml
index 4374e865d..8fbdcf940 100644
--- a/yuthon_trade/data/sale_renting_code_data.xml
+++ b/yuthon_trade/data/sale_renting_code_data.xml
@@ -42,6 +42,13 @@
3
+
+ 缴保编号
+ yuthon_trade_premium_code
+ JB%(y)s%(month)s%(day)s
+ 3
+
+
个人慰问编号
property_personal_condolences_code
diff --git a/yuthon_trade/models/yuthon_mutual_approval.py b/yuthon_trade/models/yuthon_mutual_approval.py
index b9aa87571..20b255444 100644
--- a/yuthon_trade/models/yuthon_mutual_approval.py
+++ b/yuthon_trade/models/yuthon_mutual_approval.py
@@ -9,7 +9,7 @@ class YuthonMutualApproval(models.Model):
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_leaving_approval_code'))
- users_id = fields.Many2one('res.users', string="经办人", default=lambda self: self.env.user.id)
+ users_id = fields.Many2one('res.users', string="姓名 ", default=lambda self: self.env.user.id)
text = fields.Text(string='正文')
name = fields.Char(string="标题")
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
@@ -19,12 +19,21 @@ class YuthonMutualApproval(models.Model):
work_end = fields.Boolean(string="结束")
active = fields.Boolean('Active', default=True, tracking=True)
+ @api.onchange('users_id', 'insurance_ids')
+ def _onchange_set_employee_id(self):
+ """当用户或保单明细变化时,自动设置employee_id"""
+ employee = self.env['hr.employee'].search(
+ [('user_id', '=', self.users_id.id)], limit=1
+ )
+ for line in self.insurance_ids:
+ if not line.employee_id:
+ line.employee_id = employee.id
def _get_default_name_title(self):
return self._description if self._description else self._name
name_title = fields.Char(default=_get_default_name_title)
- mutual_type = fields.Char(string="患病疾病种类")
+ mutual_type_id = fields.Many2one('yuthon.mutual.type', string="疾病种类")
hospital = fields.Char(string="治疗医院")
hospital_start_time = fields.Date(string="开始时间")
hospital_end_time = fields.Date(string="结束时间")
@@ -36,7 +45,6 @@ class YuthonMutualLine(models.Model):
mutual_id = fields.Many2one('yuthon.mutual.approval', string="关联缴保申请单")
insurance_id = fields.Many2one('yuthon.insurance.policy', string="保单名称")
+ employee_id = fields.Many2one('hr.employee')
code = fields.Char(related='insurance_id.code', string="编号")
- start_date = fields.Date(related='insurance_id.start_date', string="开始日期")
- end_date = fields.Date(related='insurance_id.end_date', string="结束日期")
- employee_ids = fields.Many2many(related='insurance_id.employee_ids', string="参保人员")
\ No newline at end of file
+ fee = fields.Float(string="保费")
diff --git a/yuthon_trade/models/yuthon_task_approval.py b/yuthon_trade/models/yuthon_task_approval.py
index 8c390989e..169fd3962 100644
--- a/yuthon_trade/models/yuthon_task_approval.py
+++ b/yuthon_trade/models/yuthon_task_approval.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
+from datetime import datetime, timedelta, time
from odoo import models, fields, api, exceptions, _
class YuthonTaskApproval(models.Model):
@@ -11,7 +11,7 @@ class YuthonTaskApproval(models.Model):
name = fields.Char(string='标题')
code = fields.Char(string="作业编号",
- default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_task_approval_code_sequence'))
+ default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_task_approval_code'))
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
document_ids = fields.Many2many('ir.attachment', string="附件")
@@ -19,8 +19,8 @@ class YuthonTaskApproval(models.Model):
employee_ids = fields.Many2many('hr.employee', string="作业人员")
task_id = fields.Many2one('yuthon.task.setting', string="作业项目")
stack_position_ids = fields.Many2many('yuthon.stack.position', string="作业堆位")
- task_start_time = fields.Datetime(string="作业开始时间", default=fields.Datetime.now())
- task_end_time = fields.Datetime(string="作业结束时间", default=fields.Datetime.now())
+ task_start_time = fields.Datetime(string="作业开始时间", default=lambda self: fields.Datetime.to_string(datetime.now() - timedelta(hours=8)))
+ task_end_time = fields.Datetime(string="作业结束时间", default=lambda self: fields.Datetime.to_string(datetime.combine(datetime.now().date(), time(8, 0))))
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
active = fields.Boolean('Active', default=True, tracking=True)
diff --git a/yuthon_trade/models/yuthon_trade_premium.py b/yuthon_trade/models/yuthon_trade_premium.py
index 62f644a61..c77e05781 100644
--- a/yuthon_trade/models/yuthon_trade_premium.py
+++ b/yuthon_trade/models/yuthon_trade_premium.py
@@ -12,15 +12,17 @@ class YuthonTradePremium(models.Model):
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code(
- 'property_personal_condolences_code_sequence'))
- employee_id = fields.Many2one('hr.employee', string='参保名单', required=True)
- fee = fields.Float(string='费用')
- text = fields.Text(string='正文')
- trade_date = fields.Date(string='保期')
+ 'yuthon_trade_premium_code'))
+ employee_ids = fields.Many2many(related="insurance_id.employee_ids", string='参保名单')
+ number = fields.Integer(string="人数", compute='_compute_employee_ids', store=True)
+ fee = fields.Float(string='个人保费')
+ total = fields.Float(string='总保费', compute='_compute_total', store=True)
+ text = fields.Text(string='申请事由')
+ start_date = fields.Date(string='开始时间')
+ end_date = fields.Date(string='结束时间')
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
documents_ids = fields.Many2many('ir.attachment', string="附件")
- insurance_ids = fields.One2many('yuthon.trade.line', 'trade_id', string="保单列表明细")
work_end = fields.Boolean(string="结束")
active = fields.Boolean('Active', default=True, tracking=True)
@@ -29,17 +31,21 @@ class YuthonTradePremium(models.Model):
name_title = fields.Char(default=_get_default_name_title)
+ @api.depends('employee_ids')
+ def _compute_employee_ids(self):
+ for record in self:
+ if record.employee_ids:
+ record.number = len(record.employee_ids)
+
+ @api.depends('number', 'fee')
+ def _compute_total(self):
+ for record in self:
+ record.total = record.number * record.fee
class YuthonTradeLine(models.Model):
_name = 'yuthon.trade.line'
- _description = '保单明细'
-
- trade_id = fields.Many2one('yuthon.trade.premium', string="关联缴保申请单")
- insurance_id = fields.Many2one('yuthon.insurance.policy', string="保单名称")
- code = fields.Char(related='insurance_id.code', string="编号")
- start_date = fields.Date(related='insurance_id.start_date', string="开始日期")
- end_date = fields.Date(related='insurance_id.end_date', string="结束日期")
- employee_ids = fields.Many2many(related='insurance_id.employee_ids', string="参保人员")
+
+
diff --git a/yuthon_trade/models/yuthon_trade_setting.py b/yuthon_trade/models/yuthon_trade_setting.py
index 726df3234..93ca5a66d 100644
--- a/yuthon_trade/models/yuthon_trade_setting.py
+++ b/yuthon_trade/models/yuthon_trade_setting.py
@@ -48,3 +48,9 @@ class ProjectFundingSetting(models.Model):
_description = '资金来源'
name = fields.Char(string='名称')
+
+class YuthonMutualType(models.Model):
+ _name = 'yuthon.mutual.type'
+ _description = '疾病种类'
+
+ name = fields.Char(string='名称')
\ No newline at end of file
diff --git a/yuthon_trade/security/ir.model.access.csv b/yuthon_trade/security/ir.model.access.csv
index ac03a64b4..0b4cb45b5 100644
--- a/yuthon_trade/security/ir.model.access.csv
+++ b/yuthon_trade/security/ir.model.access.csv
@@ -21,7 +21,6 @@ access_yuthon_message_approval,yuthon_message_approval,model_yuthon_message_appr
access_yuthon_publish_type,yuthon_publish_type,model_yuthon_publish_type,base.group_user,1,1,1,1
access_yuthon_mutual_approval,yuthon_mutual_approval,model_yuthon_mutual_approval,base.group_user,1,1,1,1
access_yuthon_insurance_policy,yuthon_insurance_policy,model_yuthon_insurance_policy,base.group_user,1,1,1,1
-access_yuthon_trade_line,yuthon_trade_line,model_yuthon_trade_line,base.group_user,1,1,1,1
access_yuthon_mutual_line,yuthon_mutual_line,model_yuthon_mutual_line,base.group_user,1,1,1,1
access_yuthon_task_approval,yuthon_task_approval,model_yuthon_task_approval,base.group_user,1,1,1,1
access_yuthon_task_setting,yuthon_task_setting,model_yuthon_task_setting,base.group_user,1,1,1,1
@@ -33,6 +32,7 @@ access_seals_scope_setting,seals_scope_setting,model_seals_scope_setting,base.gr
access_sending_unit_setting,sending_unit_setting,model_sending_unit_setting,base.group_user,1,1,1,1
access_trade_project_approval,trade_project_approval,model_trade_project_approval,base.group_user,1,1,1,1
access_project_funding_setting,project_funding_setting,model_project_funding_setting,base.group_user,1,1,1,1
+access_yuthon_mutual_type,yuthon_mutual_type,model_yuthon_mutual_type,base.group_user,1,1,1,1
access_project_classify_setting,project_classify_setting,model_project_classify_setting,base.group_user,1,1,1,1
diff --git a/yuthon_trade/views/yuthon_mutual_approval_views.xml b/yuthon_trade/views/yuthon_mutual_approval_views.xml
index fef946663..04f38a6e7 100644
--- a/yuthon_trade/views/yuthon_mutual_approval_views.xml
+++ b/yuthon_trade/views/yuthon_mutual_approval_views.xml
@@ -44,25 +44,31 @@
-
-
-
-
-
+
+
+
+
+ 至
+
+
+
+
+
+
-
-
-
-
-
+
+
+
diff --git a/yuthon_trade/views/yuthon_trade_menu.xml b/yuthon_trade/views/yuthon_trade_menu.xml
index dca6d6bc5..018148969 100644
--- a/yuthon_trade/views/yuthon_trade_menu.xml
+++ b/yuthon_trade/views/yuthon_trade_menu.xml
@@ -168,4 +168,9 @@
parent="executive_trade_setting"
action="view_yuthon_insurance_policy_action"
sequence="95"/>
+
\ No newline at end of file
diff --git a/yuthon_trade/views/yuthon_trade_premium.xml b/yuthon_trade/views/yuthon_trade_premium.xml
index f0eaff273..2069d712e 100644
--- a/yuthon_trade/views/yuthon_trade_premium.xml
+++ b/yuthon_trade/views/yuthon_trade_premium.xml
@@ -40,30 +40,20 @@
-
-
+
-
+
+
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/yuthon_trade/views/yuthon_trade_setting_views.xml b/yuthon_trade/views/yuthon_trade_setting_views.xml
index 23aa3561d..27710584c 100644
--- a/yuthon_trade/views/yuthon_trade_setting_views.xml
+++ b/yuthon_trade/views/yuthon_trade_setting_views.xml
@@ -98,4 +98,18 @@
project.funding.setting
tree
+
+ 疾病种类
+ yuthon.mutual.type
+
+
+
+
+
+
+
+ 疾病种类
+ yuthon.mutual.type
+ tree
+
\ No newline at end of file