From 472220920b4b3a6ca1364ddeaa07d869ef0aa6fe Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Wed, 30 Apr 2025 10:52:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/home.py | 1 + yuthon_contract/__manifest__.py | 1 + yuthon_contract/models/__init__.py | 1 + yuthon_contract/models/inherit_hr_employee.py | 11 +++++++++++ yuthon_contract/views/inherit_hr_employee_viwes.xml | 13 +++++++++++++ yuthon_hr_employee/models/yuthon_hr_employee.py | 11 +---------- .../views/yuthon_hr_employee_views.xml | 4 +--- yuthon_issue/models/issue_library.py | 7 +++++++ yuthon_issue/security/issue_security_group.xml | 5 +++++ yuthon_issue/views/issue_library_views.xml | 8 ++++++++ 10 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 yuthon_contract/models/inherit_hr_employee.py create mode 100644 yuthon_contract/views/inherit_hr_employee_viwes.xml diff --git a/sh_backmate_theme_adv_enterprise/controllers/home.py b/sh_backmate_theme_adv_enterprise/controllers/home.py index 56df6860b..feb37667f 100644 --- a/sh_backmate_theme_adv_enterprise/controllers/home.py +++ b/sh_backmate_theme_adv_enterprise/controllers/home.py @@ -20,6 +20,7 @@ MENU_BADGE_MODEL_FUNC_ENUM = { 'soong_workflow.menu_workflow_approval_request_my': {'model': 'soong.workflow.record', 'func': 'get_no_read_count'}, 'soong_workflow.menu_workflow_approval_request_copy': {'model': 'soong.workflow.record.copy', 'func': 'get_no_read_count'}, 'yuthon_will_task.menu_yuthon_will_task_root': {'model': 'yuthon.will.task', 'func': 'read_number'}, + 'issue_library.yuthon_library_my_menu': {'model': 'issue.library', 'func': 'read_number'}, 'yuthon_property_approval.property_lease_contract_coming_menu': {'model': 'property.lease.contract', 'func': 'read_coming_count'}, 'yuthon_property_approval.property_lease_contract_coming_due_menu': {'model': 'property.lease.contract', 'func': 'read_due_count'}, } diff --git a/yuthon_contract/__manifest__.py b/yuthon_contract/__manifest__.py index b3ef55074..629e3f9f2 100644 --- a/yuthon_contract/__manifest__.py +++ b/yuthon_contract/__manifest__.py @@ -17,6 +17,7 @@ 'data/contract_code_data.xml', 'wizard/yuthon_contract_wizard_views.xml', 'views/inherit_hr_contract_views.xml', + 'views/inherit_hr_employee_viwes.xml', ], 'installable': True, 'application': True, diff --git a/yuthon_contract/models/__init__.py b/yuthon_contract/models/__init__.py index b02a0e56e..57079bb8a 100644 --- a/yuthon_contract/models/__init__.py +++ b/yuthon_contract/models/__init__.py @@ -1 +1,2 @@ from . import inherit_hr_contract +from . import inherit_hr_employee diff --git a/yuthon_contract/models/inherit_hr_employee.py b/yuthon_contract/models/inherit_hr_employee.py new file mode 100644 index 000000000..96c4658f5 --- /dev/null +++ b/yuthon_contract/models/inherit_hr_employee.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models, tools +from odoo.exceptions import ValidationError +from dateutil.relativedelta import relativedelta + + +class InheritHrEmployee(models.Model): + _inherit = 'hr.employee' + _description = 'Employee' + + salary_group_id = fields.Many2one('yuthon.salary.group', string="工资单分组", store=True, related='contract_id.salary_group_id') \ No newline at end of file diff --git a/yuthon_contract/views/inherit_hr_employee_viwes.xml b/yuthon_contract/views/inherit_hr_employee_viwes.xml new file mode 100644 index 000000000..e0687dc6c --- /dev/null +++ b/yuthon_contract/views/inherit_hr_employee_viwes.xml @@ -0,0 +1,13 @@ + + + + hr.employee.inherit.del.form + hr.employee + + + + + + + + \ No newline at end of file diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py index b84129fb2..bcd64c99a 100644 --- a/yuthon_hr_employee/models/yuthon_hr_employee.py +++ b/yuthon_hr_employee/models/yuthon_hr_employee.py @@ -155,7 +155,7 @@ class YuthonHrEmployee(models.Model): pinyin_min = fields.Char(string='拼音缩写', compute='_compute_pinyin', index=True, store=True) # 工资计算分组 - salary_group_id = fields.Many2one('yuthon.salary.group', string="工资单分组", store=True, index=True, compute='_compute_salary_group_id') + salary_group_id = fields.Many2one('yuthon.salary.group', string="工资单分组", store=True) last_year_salary = fields.Float(string="年金基数") social_base_on = fields.Float(string="1-6月社保薪资基数") social_base_off = fields.Float(string="7-12月社保薪资基数") @@ -174,15 +174,6 @@ class YuthonHrEmployee(models.Model): for employee in self: employee.overtime_this_month = employee.normal_overtime_hours + employee.weekend_overtime_hours + employee.holiday_overtime_hours - @api.depends('contract_id') - def _compute_salary_group_id(self): - for employee in self: - contract_id = self.env['hr.contract'].search([('employee_id', '=', employee.id)], limit=1) - if contract_id: - employee.salary_group_id = contract_id.salary_group_id.id - else: - employee.salary_group_id = False - @api.depends('social_base_on', 'social_base_off') def _compute_insurance_bases(self): current_month = datetime.now().month diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index 0587da098..3570699a4 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -131,7 +131,6 @@ - @@ -347,7 +346,6 @@ - @@ -395,7 +393,7 @@ hr.employee.inherit.del.form hr.employee - + diff --git a/yuthon_issue/models/issue_library.py b/yuthon_issue/models/issue_library.py index 677bdf1c4..92db9f96b 100644 --- a/yuthon_issue/models/issue_library.py +++ b/yuthon_issue/models/issue_library.py @@ -41,6 +41,7 @@ class IssueLibrary(models.Model): employee_id = fields.Many2one('hr.employee', string='创建人', default=lambda self: self.env.user.employee_id) department_id = fields.Many2one('hr.department', string='部门', related='employee_id.department_id') users_role_ids = fields.Many2many('soong.user.role', string='角色范围', related='employee_id.user_role_ids') + company_id = fields.Many2one('res.company', string='公司', related='employee_id.company_id', stroe=True) approval_name = fields.Char(string="审批标题") meeting_place = fields.Char(string="会议地点") meeting_name = fields.Char(string="会议名称") @@ -54,6 +55,12 @@ class IssueLibrary(models.Model): name_title = fields.Char(default=_get_default_name_title) + def read_number(self): + return self.search_count([ + ('issue_state', '=', 'draft'), + ('employee_id.user_id', '=', self.env.user.id) + ]) + @api.onchange('issue_library_line_ids') def onchange_approval_decision_sequence(self): for dec in self: diff --git a/yuthon_issue/security/issue_security_group.xml b/yuthon_issue/security/issue_security_group.xml index be21d8912..5d2daa167 100644 --- a/yuthon_issue/security/issue_security_group.xml +++ b/yuthon_issue/security/issue_security_group.xml @@ -18,4 +18,9 @@ [('company_id', 'in', company_ids)] + + 议题多公司 + + [('company_id', 'in', company_ids)] + \ No newline at end of file diff --git a/yuthon_issue/views/issue_library_views.xml b/yuthon_issue/views/issue_library_views.xml index 64d25c0d4..433c01f0d 100644 --- a/yuthon_issue/views/issue_library_views.xml +++ b/yuthon_issue/views/issue_library_views.xml @@ -21,6 +21,7 @@ +