From e4dda69f1ce82a684ccf7cbe6e5556ced094ef82 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Mon, 10 Mar 2025 11:40:13 +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 --- .../models/property_management.py | 27 ++++++++++++++++--- .../views/property_management.xml | 16 ++++++++--- .../views/inherit_hr_payslip_views.xml | 9 +++++++ yuthon_salary/wizard/salary_compute_wizard.py | 10 +++++++ 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/yuthon_property_approval/models/property_management.py b/yuthon_property_approval/models/property_management.py index 1a9b074de..3fbd39011 100644 --- a/yuthon_property_approval/models/property_management.py +++ b/yuthon_property_approval/models/property_management.py @@ -6,7 +6,7 @@ from odoo import models, fields, api, exceptions, _ class PropertyManagement(models.Model): _name = 'property.management' - _description = '物业管理变更申请表' + _description = '物业分配申请表' _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] _rec_name = 'name' @@ -19,11 +19,29 @@ class PropertyManagement(models.Model): new_property_ids = fields.One2many('property.information.detail.lines', 'new_property_id', string="新物业信息") urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度', default='normal') + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") active = fields.Boolean('Active', default=True, tracking=True) def _get_default_name_title(self): return self._description if self._description else self._name name_title = fields.Char(default=_get_default_name_title) + document_ids = fields.Many2many('ir.attachment', string="附件") + + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) class PropertyInformationDetailLines(models.Model): @@ -31,10 +49,11 @@ class PropertyInformationDetailLines(models.Model): _description = '新物业信息' new_property_id = fields.Many2one('property.management', string="新物业信息") - new_company = fields.Char(string="新公司") + company_id = fields.Many2one('yuthon.property.company', string="所属公司") new_admin = fields.Char(string="新管理员") - new_precincts = fields.Char(string="新片区") - new_management_type = fields.Char(string="新权属类型") + admin_id = fields.Many2one('res.users', string="管理员") + new_precincts = fields.Many2one('yuthon.precinct.message', string="新片区") + tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型') diff --git a/yuthon_property_approval/views/property_management.xml b/yuthon_property_approval/views/property_management.xml index f6b6b18a7..8534ed884 100644 --- a/yuthon_property_approval/views/property_management.xml +++ b/yuthon_property_approval/views/property_management.xml @@ -30,6 +30,13 @@ + + + + + + +

@@ -45,28 +52,29 @@ + - + + - - + - + diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index 6c3dcf481..3e480174f 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -8,6 +8,15 @@ custom_salary_button + + 1 + + + 1 + + + 1 + diff --git a/yuthon_salary/wizard/salary_compute_wizard.py b/yuthon_salary/wizard/salary_compute_wizard.py index db67ad679..b06c3621a 100644 --- a/yuthon_salary/wizard/salary_compute_wizard.py +++ b/yuthon_salary/wizard/salary_compute_wizard.py @@ -45,12 +45,22 @@ class SalaryComputeWizard(models.Model): def confirm(self): for employee in self.employee_ids: contract_id = self.env['hr.contract'].search([('employee_id', '=', employee.id)], limit=1) + payslip_run_id = self.env['hr.payslip.run'].search([('name', '=', '2025年-3月')]) + if not payslip_run_id: + payslip_run_id = self.env['hr.payslip.run'].create({ + 'name': '2025年-3月', + 'date_start': '2025-03-01', + 'date_end': '2025-03-31', + 'state': 'draft', + 'payslip_count':0 + }) struct_id = contract_id.structure_type_id.default_struct_id payslip = self.env['hr.payslip'].create({ 'name': employee.name, 'employee_id': employee.id, 'contract_id': contract_id.id, 'struct_id': struct_id.id, + 'payslip_run_id':payslip_run_id.id, 'state':'draft', }) payslip.compute_sheet()