From 718e24936aeea65a0024ae73a8a658f8b6df4fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Tue, 23 Dec 2025 19:46:28 +0800 Subject: [PATCH 01/71] =?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 --- .../models/__init__.py | 3 ++- .../models/yuthon_employee_setting.py | 9 +++++++ .../models/yuthon_service_approval.py | 27 ++++++++++--------- .../security/ir.model.access.csv | 1 + .../views/yuthon_service_approval_views.xml | 8 +++--- 5 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 yuthon_hr_employee_approval/models/yuthon_employee_setting.py diff --git a/yuthon_hr_employee_approval/models/__init__.py b/yuthon_hr_employee_approval/models/__init__.py index de509b22a..900eecc9f 100644 --- a/yuthon_hr_employee_approval/models/__init__.py +++ b/yuthon_hr_employee_approval/models/__init__.py @@ -27,4 +27,5 @@ from . import yuthon_department_change from . import yuthon_renewal_approval from . import contract_review_approval from . import yuthon_employee_add -from . import yuthon_pre_examination \ No newline at end of file +from . import yuthon_pre_examination +from . import yuthon_employee_setting \ No newline at end of file diff --git a/yuthon_hr_employee_approval/models/yuthon_employee_setting.py b/yuthon_hr_employee_approval/models/yuthon_employee_setting.py new file mode 100644 index 000000000..591a681c8 --- /dev/null +++ b/yuthon_hr_employee_approval/models/yuthon_employee_setting.py @@ -0,0 +1,9 @@ +from odoo import models, fields, api +from dateutil.relativedelta import relativedelta + + +class YuthonServiceType(models.Model): + _name = 'yuthon.service.type' + _description = '服务类型' + + name = fields.Char(string="名称") diff --git a/yuthon_hr_employee_approval/models/yuthon_service_approval.py b/yuthon_hr_employee_approval/models/yuthon_service_approval.py index 5efac9fc1..6ee4a26bb 100644 --- a/yuthon_hr_employee_approval/models/yuthon_service_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_service_approval.py @@ -10,20 +10,22 @@ class YuthonServiceApproval(models.Model): name = fields.Char(string='标题') code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_service_approval_code')) - service_type = fields.Selection([('done', '在职证明'), ('leaving', '离职证明'), ('income', '收入证明')], string="服务类型") + service_type_id = fields.Many2one('yuthon.service.type', string="服务类型") users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) documents_ids = fields.Many2many('ir.attachment', string="附件") department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门", store=True) - employee_id = fields.Many2one('hr.employee', string="员工姓名") + employee_id = fields.Many2one('hr.employee', string="员工姓名", default=lambda self: self.env.user.employee_id.id) company_id = fields.Many2one(related="users_id.employee_id.company_id", string="公司", store=True) tenant_user_card = fields.Many2one('ir.attachment', string="身份证") - onboarding_time = fields.Date(related='employee_id.open_start_time', string="入职时间") + onboarding_time = fields.Date(related='employee_id.open_start_time', string="入职日期") job_id = fields.Many2one(related='employee_id.job_id', string="岗位") + is_turnover = fields.Boolean() reason_issuance = fields.Char(string="开证原因") is_issues = fields.Boolean(string='是否上会') issues_result = fields.Html(string="会议结果") related_issues_id = fields.Many2one('issue.library', string="关联议题") + separation_date = fields.Date(string="离职日期") urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度', default='normal') active = fields.Boolean('Active', default=True, tracking=True) @@ -50,14 +52,13 @@ class YuthonServiceApproval(models.Model): 'approval_date': fields.Datetime.now(), }) - @api.onchange('service_type') + @api.onchange('service_type_id') def _onchange_service_type(self): - 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 + if self.service_type_id and self.users_id.name: + self.name = f"{self.users_id.name}的{self.service_type_id.name}" + + if self.service_type_id.name == '离职证明': + self.is_turnover = True + else: + self.is_turnover = False + diff --git a/yuthon_hr_employee_approval/security/ir.model.access.csv b/yuthon_hr_employee_approval/security/ir.model.access.csv index 9bea8f0e7..c22a515ef 100644 --- a/yuthon_hr_employee_approval/security/ir.model.access.csv +++ b/yuthon_hr_employee_approval/security/ir.model.access.csv @@ -56,3 +56,4 @@ access_contract_review_approval,contract_review_approval,model_contract_review_a access_awards_line, awards_line,model_awards_line,base.group_user,1,1,1,1 access_yuthon_employee_add,yuthon_employee_add,model_yuthon_employee_add,base.group_user,1,1,1,1 access_yuthon_pre_examination,yuthon_pre_examination,model_yuthon_pre_examination,base.group_user,1,1,1,1 +access_yuthon_service_type,yuthon_service_type,model_yuthon_service_type,base.group_user,1,1,1,1 diff --git a/yuthon_hr_employee_approval/views/yuthon_service_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_service_approval_views.xml index 10aa4fb62..a63fd49b8 100644 --- a/yuthon_hr_employee_approval/views/yuthon_service_approval_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_service_approval_views.xml @@ -52,11 +52,13 @@ - - + + + - + + From 5a52e0e10cf1773757231d7999f89da387977802 Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Wed, 24 Dec 2025 09:42:45 +0800 Subject: [PATCH 02/71] 1 --- .../views/soong_workflow_record.xml | 1 - sun_badge_menu/models/ir_ui_menu.py | 7 +- yuthon_will_task/controllers/main.py | 68 ++++++++++++++++--- yuthon_will_task/models/yuthon_will_task.py | 12 +++- .../views/yuthon_will_task_views.xml | 21 +++--- 5 files changed, 79 insertions(+), 30 deletions(-) diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml index 61edd8feb..d37f3a354 100644 --- a/soong_workflow/views/soong_workflow_record.xml +++ b/soong_workflow/views/soong_workflow_record.xml @@ -206,7 +206,6 @@ ir.actions.act_window soong.workflow.record tree,kanban,search - {'header_search_default_approve_state': 1, 'header_search_default_to_do':1, 'check_employee': 1} [('users_ids', 'in', uid), ('reclaim_state', '=', False), ('soong_state', '=', 'to_do')] diff --git a/sun_badge_menu/models/ir_ui_menu.py b/sun_badge_menu/models/ir_ui_menu.py index 49975e359..54ef083e7 100644 --- a/sun_badge_menu/models/ir_ui_menu.py +++ b/sun_badge_menu/models/ir_ui_menu.py @@ -31,7 +31,7 @@ def compute_badge_count_recursive(web_menus, menu_id): class IrUiMenu(models.Model): _inherit = "ir.ui.menu" - show_badge_count = fields.Boolean(string="显示菜单角标",default=True) + show_badge_count = fields.Boolean(string="显示菜单角标", default=True) is_phone = fields.Boolean(string="手机菜单",default=False) is_pc = fields.Boolean(string="PC菜单",default=True) @@ -134,7 +134,6 @@ class IrUiMenu(models.Model): web_menus = {} for menu in menus.values(): if not menu['id']: - # special root menu case web_menus['root'] = { "id": 'root', "name": menu['name'], @@ -151,14 +150,11 @@ class IrUiMenu(models.Model): } else: action = menu['action'] - if menu['id'] == menu['app_id']: - # if it's an app take action of first (sub)child having one defined child = menu while child and not action: action = child['action'] child = menus[child['children'][0]] if child['children'] else False - action_model, action_id = action.split(',') if action else (False, False) action_id = int(action_id) if action_id else False badge_count = 0 @@ -166,7 +162,6 @@ class IrUiMenu(models.Model): # 增加 show_badge_count 限制是否显示"角标". if action_model and action_id and menu['show_badge_count']: action_record = self.env[action_model].browse(action_id).sudo() - if action_model == 'ir.actions.act_window' and action_record.view_mode != 'form': # 不仅仅是 form 表单,获取 model res_model = action_record.res_model diff --git a/yuthon_will_task/controllers/main.py b/yuthon_will_task/controllers/main.py index 853e24822..6007f1115 100644 --- a/yuthon_will_task/controllers/main.py +++ b/yuthon_will_task/controllers/main.py @@ -1,9 +1,8 @@ import base64 import json - from odoo import http, fields from odoo.http import request -from odoo.tools import float_is_zero,float_round +from urllib.parse import quote class YuthonWillTask(http.Controller): @@ -56,19 +55,68 @@ class YuthonWillTask(http.Controller): 'message':'success' }) - @http.route('/will/taks/list', methods=['POST'], type='http', auth='none', csrf=False) - def task_list(self, **kwargs): - employee_id = kwargs.get('id') - data = request.env['yuthon.will.task'].sudo().search([]) + @http.route('/will/task/list', methods=['POST'], type='http', auth='public', csrf=False) + def will_task_list(self, **kwargs): + employee_id = kwargs.get('employee_id') + request_hour_selection = request.env['yuthon.will.task'].sudo().fields_get(allfields=['request_hour_from'])['request_hour_from']['selection'] result_list = [] - for emp in data: + # for task in request.env['yuthon.will.task'].sudo().search(['|', ('employee_ids', 'in', [employee_id]), ('employee_id.id', '=', employee_id)]): + for task in request.env['yuthon.will.task'].sudo().search([]): + weekday_str = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"][task.start_date.weekday()] result = { - 'name': emp.name, - 'code': emp.code, - } + 'id': task.id, + 'name': task.name, + 'employee_id': task.employee_id.name, + 'employee_ids': ', '.join(task.employee_ids.mapped('name')), + 'employee_num': len(task.employee_ids), + 'start_date': fields.Date.to_string(task.start_date), + 'weekday': weekday_str, + 'request_hour_from': '', + 'request_hour_to': '', + } + hour_dict = dict(request_hour_selection) + result['request_hour_from'] = hour_dict.get(task.request_hour_from) + result['request_hour_to'] = hour_dict.get(task.request_hour_to) result_list.append(result) return json.dumps({ 'data': result_list, 'code': 200, 'message': 'success' }) + + @http.route('/will/task/record', methods=['POST'], type='http', auth='public', csrf=False) + def will_task_record(self, **kwargs): + task_id = kwargs.get('id') + task = request.env['yuthon.will.task'].sudo().search([('id', '=', task_id)]) + request_hour_selection = request.env['yuthon.will.task'].sudo().fields_get(allfields=['request_hour_from'])['request_hour_from'][ + 'selection'] + file_list = [] + for attach in task.document_ids: + attach_id = request.env['ir.attachment'].sudo().search([('id', '=', attach.id)]) + if attach_id: + file_url = 'http://view.officeapps.live.com/op/view.aspx?src=' + quote( + 'https://oa.thtzjt.com' + '/web/content/office_preview/' + str(attach_id.id)) + file_list.append({'file_url': file_url, 'file_name': attach_id.display_name}) + weekday_str = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"][task.start_date.weekday()] + result = { + 'id': task.id, + 'name': task.name, + 'employee_id': task.employee_id.name, + 'employee_ids': ', '.join(task.employee_ids.mapped('name')), + 'employee_num': len(task.employee_ids), + 'start_date': fields.Date.to_string(task.start_date), + 'weekday': weekday_str, + 'request_hour_from': '', + 'request_hour_to': '', + 'remarks': task.remarks, + 'address': task.address, + 'file_list': file_list, + } + hour_dict = dict(request_hour_selection) + result['request_hour_from'] = hour_dict.get(task.request_hour_from) + result['request_hour_to'] = hour_dict.get(task.request_hour_to) + return json.dumps({ + 'data': result, + 'code': 200, + 'message': 'success' + }) diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py index de03c4bf7..e5f778daa 100644 --- a/yuthon_will_task/models/yuthon_will_task.py +++ b/yuthon_will_task/models/yuthon_will_task.py @@ -68,7 +68,7 @@ class YuthonWillTask(models.Model): priority = fields.Selection([('important', '重要不紧急'), ('urgent', '紧急不重要'), ('very_urgent', '重要且紧急')], string='优先级') code = fields.Char(string="任务编号", default=lambda self: self.env['ir.sequence'].next_by_code('task_code')) - user_id = fields.Many2one('res.users', string="创建人", default=lambda self: self.env.user) + # user_id = fields.Many2one('res.users', string="创建人", default=lambda self: self.env.user) company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.company) name = fields.Text(string='任务内容') remarks = fields.Text(string='备注') @@ -106,6 +106,16 @@ class YuthonWillTask(models.Model): store=True, default=lambda self: [(6, 0, [self.env.user.id])] ) + employee_id = fields.Many2one('hr.employee', string="经办人", default=lambda self: self.env.user.employee_id) + task_week = fields.Char(string="周", readonly=True, compute='_compute_task_week') + + @api.depends('start_date') + def _compute_task_week(self): + weekdays = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"] + for record in self: + if record.start_date: + record.task_week = weekdays[record.start_date.weekday()] + @api.depends('start_date', 'request_hour_from', 'request_hour_to') def _compute_task_time(self): for record in self: diff --git a/yuthon_will_task/views/yuthon_will_task_views.xml b/yuthon_will_task/views/yuthon_will_task_views.xml index fcae0e1e7..23f083a9d 100644 --- a/yuthon_will_task/views/yuthon_will_task_views.xml +++ b/yuthon_will_task/views/yuthon_will_task_views.xml @@ -22,7 +22,7 @@ - + - + - + + - From 8f72f6f8588ff6e9b5dcecc8a27a575767f5e5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 24 Dec 2025 15:59:35 +0800 Subject: [PATCH 09/71] =?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 --- soong_workflow/models/soong_workflow_mixin.py | 31 +++++++++++++------ .../models/issue_approval_decision.py | 2 ++ .../views/issue_approval_decision_views.xml | 4 +++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 28068a7f3..1962fa8e9 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -332,7 +332,7 @@ class SoongWorkflowMixin(models.AbstractModel): index = 20 # 防止死循环 break current_department = self.department_id - if btn_rec.link_id and btn_rec.link_id in current_node.out_link_ids: + if btn_rec.link_id in current_node.out_link_ids and len(current_node.out_link_ids) == 1: matched_link = btn_rec.link_id next_node = matched_link.node_to matched_key = next_node.name @@ -341,14 +341,27 @@ class SoongWorkflowMixin(models.AbstractModel): # 筛选与当前节点部门匹配的后续节点 valid_nodes = [] for link in current_node.out_link_ids: - target_node = link.node_to - # 如果目标节点有部门限制,且与当前节点部门匹配 - if target_node.department_id and any( - dept in current_department or - current_department in self.get_all_sub_departments(dept) - for dept in target_node.department_id - ): - valid_nodes.append((target_node, link)) + if self.name_title == '业务审批': + category_names = self.information_categories_ids.mapped('name') + target_name = link.name.split('->')[-1].strip() + if '工会活动' in category_names: + if target_name == '工会主席': + target_node = link.node_to + valid_nodes.append((target_node, link)) + else: + if target_name == '复核': + target_node = link.node_to + valid_nodes.append((target_node, link)) + + else: + target_node = link.node_to + # 如果目标节点有部门限制,且与当前节点部门匹配 + if target_node.department_id and any( + dept in current_department or + current_department in self.get_all_sub_departments(dept) + for dept in target_node.department_id + ): + valid_nodes.append((target_node, link)) # 尝试父部门匹配 if not valid_nodes and current_department and current_department.parent_id: diff --git a/yuthon_issue/models/issue_approval_decision.py b/yuthon_issue/models/issue_approval_decision.py index 24e0085af..40e941104 100644 --- a/yuthon_issue/models/issue_approval_decision.py +++ b/yuthon_issue/models/issue_approval_decision.py @@ -11,6 +11,8 @@ class IssueApprovalDecision(models.Model): decision_type_on_id = fields.Many2one('issue.approval.decision.type', string='事项类别上级') sequence = fields.Char(string='序号', store=True) specifics = fields.Text(string='具体事项') + by_law = fields.Selection([('yes', '是'), ('no', '否')], string='是否经过法律审核') + is_filing = fields.Selection([('yes', '备'), ('no', '否')], string='是否备案') council_id = fields.Many2one('issue.library.type', string='党总委员会') team_meet_id = fields.Many2one('issue.library.type', string='经营班子会') board_meet_id = fields.Many2one('issue.library.type', string='董事会') diff --git a/yuthon_issue/views/issue_approval_decision_views.xml b/yuthon_issue/views/issue_approval_decision_views.xml index 639c2199f..11f01459e 100644 --- a/yuthon_issue/views/issue_approval_decision_views.xml +++ b/yuthon_issue/views/issue_approval_decision_views.xml @@ -10,12 +10,14 @@ + + @@ -45,6 +47,8 @@ + + From d479916fb3b1d9e904399564e743442a23b727bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 24 Dec 2025 17:13:53 +0800 Subject: [PATCH 10/71] =?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 --- soong_workflow/wizard/soong_workflow_comment_wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index a81a1bab8..f51ac47a9 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -448,7 +448,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): "res_id": self.res_id, "node_id": next_node_id.id, "workflow_id": self.node_btn_id.workflow_id.id, - "done_by": self.employee_ids.user_id.id if self.employee_ids else query_user_id, + "done_by": self.employee_ids.user_ids.ids if self.employee_ids else query_user_id, "node_btn_name": "0", "lase_click_date": fields.Datetime.now(), "approval_state": "1", # 待审批 From f776b9b81bf4fdb0f262237929a1ad944c115ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 24 Dec 2025 17:16:06 +0800 Subject: [PATCH 11/71] =?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 --- soong_workflow/wizard/soong_workflow_comment_wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index f51ac47a9..5d7bfdf3b 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -448,7 +448,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): "res_id": self.res_id, "node_id": next_node_id.id, "workflow_id": self.node_btn_id.workflow_id.id, - "done_by": self.employee_ids.user_ids.ids if self.employee_ids else query_user_id, + "done_by": self.employee_ids.user_id.ids if self.employee_ids else query_user_id, "node_btn_name": "0", "lase_click_date": fields.Datetime.now(), "approval_state": "1", # 待审批 From 5caae93feb947a0ad8c488ed500b886bc6d14c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 24 Dec 2025 17:22:35 +0800 Subject: [PATCH 12/71] =?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 --- soong_workflow/wizard/soong_workflow_comment_wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 5d7bfdf3b..a81a1bab8 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -448,7 +448,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): "res_id": self.res_id, "node_id": next_node_id.id, "workflow_id": self.node_btn_id.workflow_id.id, - "done_by": self.employee_ids.user_id.ids if self.employee_ids else query_user_id, + "done_by": self.employee_ids.user_id.id if self.employee_ids else query_user_id, "node_btn_name": "0", "lase_click_date": fields.Datetime.now(), "approval_state": "1", # 待审批 From 09200574ccedcb12414dfb4ae1171f3f18eb06a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 24 Dec 2025 17:42:44 +0800 Subject: [PATCH 13/71] =?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 --- yuthon_property/__manifest__.py | 1 + .../models/property_bank_statements.py | 51 +++++-------------- .../security/bank_company_rule.xml | 8 +++ .../views/property_bank_statements_views.xml | 10 ++-- yuthon_salary/__manifest__.py | 3 ++ yuthon_salary/security/ir.model.access.csv | 3 +- .../static/src/js/salary_import_button.js | 29 +++++++++++ .../static/src/xml/salary_import_button.xml | 10 ++++ .../views/inherit_hr_payslip_views.xml | 6 +-- yuthon_salary/wizard/__init__.py | 1 + yuthon_salary/wizard/salary_import_wizard.py | 28 ++++++++++ .../wizard/salary_import_wizard_views.xml | 34 +++++++++++++ .../views/yuthon_will_task_views.xml | 28 +++++----- 13 files changed, 152 insertions(+), 60 deletions(-) create mode 100644 yuthon_property/security/bank_company_rule.xml create mode 100644 yuthon_salary/static/src/js/salary_import_button.js create mode 100644 yuthon_salary/static/src/xml/salary_import_button.xml create mode 100644 yuthon_salary/wizard/salary_import_wizard.py create mode 100644 yuthon_salary/wizard/salary_import_wizard_views.xml diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py index 26741f1b2..5fb268817 100644 --- a/yuthon_property/__manifest__.py +++ b/yuthon_property/__manifest__.py @@ -9,6 +9,7 @@ 'license': 'LGPL-3', 'data': [ 'security/ir.model.access.csv', + 'security/bank_company_rule.xml', 'security/yuthon_property_group.xml', 'security/yuthon_accounts_group.xml', 'data/data_yuthon_resource_mgmt_config.xml', diff --git a/yuthon_property/models/property_bank_statements.py b/yuthon_property/models/property_bank_statements.py index b07d7991a..081af1bb7 100644 --- a/yuthon_property/models/property_bank_statements.py +++ b/yuthon_property/models/property_bank_statements.py @@ -39,14 +39,24 @@ class PropertyBankStatements(models.Model): voucher_type = fields.Selection([('electronic_transfer', '电子转账凭证'), ('telegraphic_transfer', '电汇凭证')], string='凭证种类') remake = fields.Text('备注') registered = fields.Float('挂账') - is_reconciliation = fields.Boolean('是否对账') # 无效 + is_reconciliation = fields.Boolean('是否对账') company_select = fields.Selection([('jhtz', '天河投资'), ('thwg', '天河物管'), ('thcj', '天河城建')]) property_ids = fields.Many2many('yuthon.property', string='物业地址') bank_state = fields.Selection([('not_reconciled', '未对账'), ('reconciled', '已对账'), ('registered', '挂账'), ('other', '其他')], string='状态', default='not_reconciled') - is_company = fields.Boolean(compute='_compute_is_company', search='_search_part_of_company', default=True) + company_id1 = fields.Many2one('res.company', string='公司') change_amount = fields.Float(string='修改金额') receivable_modify_ids = fields.One2many('receivable.modify.line', 'bank_id', string='修改应收单') + def update_company_id(self): + records = self.env['property.bank.statements'].search([]) + for record in records: + if record.your_own_unit in ['天河投资', '天投城建']: + record.company_id1 = self.env['res.company'].search([('name', '=', '集团本部')], limit=1) + elif record.your_own_unit in ['天河物管']: + record.company_id1 = self.env['res.company'].search([('name', '=', '天河物管')], limit=1) + elif record.your_own_unit in ['天河粮储']: + record.company_id1 = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1) + def update_record(self): selected_records = self.env["property.bank.statements"].browse( self._context.get('active_ids', self._context.get('active_id')) @@ -112,43 +122,6 @@ class PropertyBankStatements(models.Model): bank_id.change_amount = change_amount bank_id.yes_amount = change_amount - @api.depends_context('uid', 'company') - @api.depends('your_own_account') - def _compute_is_company(self): - user_companies = self.env['res.company'].browse(self.env.companies.ids) - user_company_names = set(user_companies.mapped('name')) - # 预定义账号映射关系 - account_mapping = { - '集团本部': ['天河投资', '天投城建'], - '天河物管': ['天河物管'], - '天河粮储': ['天河粮储'] - } - for record in self: - # 默认不可见 - record.is_company = False - # 检查账号是否符合规则 - for company_name, allowed_accounts in account_mapping.items(): - if company_name in user_company_names: - if record.your_own_unit in allowed_accounts: - record.is_company = True - break - - - def _search_part_of_company(self, operator, value): - if operator not in ('=', '!=') or not isinstance(value, bool): - raise UserError(_('操作不支持')) - user_companies = self.env['res.company'].browse(self.env.companies.ids) - company_names = user_companies.mapped('name') - visible_accounts = [] - if "集团本部" in company_names: - visible_accounts.extend(['天河投资', '天投城建']) - if "天河物管" in company_names: - visible_accounts.append('天河物管') - if not value: - operator = '!=' if operator == '=' else '=' - domain = [('your_own_unit', 'in', visible_accounts)] if operator == '=' and visible_accounts else [] - return domain or [('id', '=', 0)] - def other(self): bank_ids = self.env["property.bank.statements"].browse( self._context.get('active_ids', self._context.get('active_id'))) diff --git a/yuthon_property/security/bank_company_rule.xml b/yuthon_property/security/bank_company_rule.xml new file mode 100644 index 000000000..6f2542c87 --- /dev/null +++ b/yuthon_property/security/bank_company_rule.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/yuthon_property/views/property_bank_statements_views.xml b/yuthon_property/views/property_bank_statements_views.xml index 32dac9d64..38357a6dc 100644 --- a/yuthon_property/views/property_bank_statements_views.xml +++ b/yuthon_property/views/property_bank_statements_views.xml @@ -16,7 +16,6 @@ - @@ -45,7 +44,6 @@ - @@ -107,9 +105,15 @@ 银行流水 property.bank.statements tree,form,search - {'group_by': 'bank_state'} + + 更新公司 + + + code + action = model.update_company_id() + \ No newline at end of file diff --git a/yuthon_salary/__manifest__.py b/yuthon_salary/__manifest__.py index 49be4f687..a2511b537 100644 --- a/yuthon_salary/__manifest__.py +++ b/yuthon_salary/__manifest__.py @@ -35,6 +35,7 @@ 'wizard/yuthon_salary_wizard_views.xml', 'wizard/salary_party_wizard_views.xml', 'wizard/temporary_payslip_wizard_views.xml', + 'wizard/salary_import_wizard_views.xml', 'wizard/yuthon_payroll_wizard_views.xml', 'wizard/basic_pension_wizard_views.xml', 'wizard/payroll_labor_wizard_views.xml', @@ -61,8 +62,10 @@ 'yuthon_salary/static/src/js/salary_retired_button.js', 'yuthon_salary/static/src/js/salary_validation_button.js', 'yuthon_salary/static/src/js/salary_year_button.js', + 'yuthon_salary/static/src/js/salary_import_button.js', 'yuthon_salary/static/src/xml/salary_create_button.xml', 'yuthon_salary/static/src/xml/salary_labor_button.xml', + 'yuthon_salary/static/src/xml/salary_import_button.xml', 'yuthon_salary/static/src/xml/salary_retired_button.xml', 'yuthon_salary/static/src/xml/salary_payslip_button.xml', 'yuthon_salary/static/src/xml/salary_documents_button.xml', diff --git a/yuthon_salary/security/ir.model.access.csv b/yuthon_salary/security/ir.model.access.csv index b6690aef6..bfa5c3a25 100644 --- a/yuthon_salary/security/ir.model.access.csv +++ b/yuthon_salary/security/ir.model.access.csv @@ -36,4 +36,5 @@ access_rank_log_line,access_rank_log_line,model_rank_log_line,base.group_user,1, access_rank_log_wizard,access_rank_log_wizard,model_rank_log_wizard,base.group_user,1,1,1,1 access_basic_pension_wizard,access_basic_pension_wizard,model_basic_pension_wizard,base.group_user,1,1,1,1 access_yuthon_salary_party,access_yuthon_salary_party,model_yuthon_salary_party,base.group_user,1,1,1,1 -access_salary_party_wizard,access_salary_party_wizard,model_salary_party_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_salary_party_wizard,access_salary_party_wizard,model_salary_party_wizard,base.group_user,1,1,1,1 +access_salary_import_wizard,access_salary_import_wizard,model_salary_import_wizard,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_salary/static/src/js/salary_import_button.js b/yuthon_salary/static/src/js/salary_import_button.js new file mode 100644 index 000000000..b3407e9c0 --- /dev/null +++ b/yuthon_salary/static/src/js/salary_import_button.js @@ -0,0 +1,29 @@ +/** @odoo-module */ +import { ListController } from "@web/views/list/list_controller"; +import { registry } from '@web/core/registry'; +import { listView } from '@web/views/list/list_view'; + +export class CustomSalaryImportController extends ListController { + setup() { + super.setup(); + } + + openSalaryImportWizard() { + this.actionService.doAction({ + type: 'ir.actions.act_window', + res_model: 'salary.import.wizard', + name: '薪资导入', + view_mode: 'form', + view_type: 'form', + views: [[false, 'form']], + target: 'new', // 以弹窗形式打开 + context: {}, + }); + } +} + +registry.category("views").add("custom_salary_import_button", { + ...listView, + Controller: CustomSalaryImportController, + buttonTemplate: "salary_import_module.ListView.Buttons", +}); \ No newline at end of file diff --git a/yuthon_salary/static/src/xml/salary_import_button.xml b/yuthon_salary/static/src/xml/salary_import_button.xml new file mode 100644 index 000000000..aade38590 --- /dev/null +++ b/yuthon_salary/static/src/xml/salary_import_button.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index 878747f4c..b0d7e4399 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -242,7 +242,7 @@ hr.payslip.tree.validation.jtbb hr.payslip - +
+ + + + + + + + + +
+
+ +
+ + diff --git a/yuthon_will_task/views/yuthon_will_task_views.xml b/yuthon_will_task/views/yuthon_will_task_views.xml index 33f38eb73..45c1c8152 100644 --- a/yuthon_will_task/views/yuthon_will_task_views.xml +++ b/yuthon_will_task/views/yuthon_will_task_views.xml @@ -15,15 +15,15 @@ - - - + + + - - - - + + + +