diff --git a/soong_workflow/models/soong_user_role.py b/soong_workflow/models/soong_user_role.py index 056a12b9e..74488d41a 100644 --- a/soong_workflow/models/soong_user_role.py +++ b/soong_workflow/models/soong_user_role.py @@ -33,12 +33,6 @@ class YuthonUserRole(models.Model): personnel_id.write({'user_role_id': record.id}) return res - @api.depends('department_id', 'name') - def _compute_display_name(self): - for record in self: - if record.department_id and record.name: - record.display_name = record.department_id.name + ' - ' + record.name - @api.depends('name') def _compute_pinyin(self): for employee in self: diff --git a/soong_workflow/views/soong_user_role_views.xml b/soong_workflow/views/soong_user_role_views.xml index 2923c9301..d0936a21f 100644 --- a/soong_workflow/views/soong_user_role_views.xml +++ b/soong_workflow/views/soong_user_role_views.xml @@ -81,7 +81,7 @@ - + diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 2c556e5d6..fbcd00cb1 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -54,7 +54,7 @@ hr.attendance - + diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index b02a067d2..29386090b 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -354,7 +354,8 @@ - + + @@ -383,8 +384,14 @@ 1 + + hide + - + + + + hide @@ -397,6 +404,9 @@ + + + diff --git a/yuthon_property_approval/data/property_contract_time.xml b/yuthon_property_approval/data/property_contract_time.xml index 678bc6586..18c540f06 100644 --- a/yuthon_property_approval/data/property_contract_time.xml +++ b/yuthon_property_approval/data/property_contract_time.xml @@ -15,4 +15,17 @@ + + 定时任务:更新物业状态 + + code + model.get_yuthon_property_time() + + + 1 + days + + -1 + + \ No newline at end of file diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index 6855986d3..884e831f2 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -10,6 +10,19 @@ class YuthonProperty(models.Model): property_contract_ids = fields.One2many('property.contract.line', 'yuthon_property_id', string="关联物业合同明细行") + def get_yuthon_property_time(self): + unique_property_ids = set() + for record in self.search([('state', '=', 'to'), ('property_contract_ids', '=', False)]): + contracts = self.env['property.evaluation.plan'].search([]) + for contract in contracts: + for property_id in contract.property_ids: + if property_id.id not in unique_property_ids: + unique_property_ids.add(property_id.id) + if record.id not in unique_property_ids: + record.put_assessment_approval() + else: + continue + # 银行流水 class PropertyBankStatements(models.Model): _inherit = 'property.bank.statements' diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index a702fafdf..8edabe865 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -132,7 +132,7 @@ class PropertyLeaseContract(models.Model): lease_bank_ids = fields.One2many('property.bank.line', 'contract_id', string="承租方账户明细行") bank_statements_ids = fields.One2many('property.bank.statements', 'contract_id', string="银行流水明细行") management_list_ids = fields.One2many('property.management.list', 'contract_id', string="管理费用明细行") - state = fields.Selection([('to', '待评估'), ('done', '已评估'), ('ing', '评估中')], string="状态", default='to') + state = fields.Selection([('to', '待评估'), ('done', '已评估'), ('ing', '评估中')], string="状态") # 附件 license_id = fields.Many2one('ir.attachment', string="营业执照") card_id = fields.Many2one('ir.attachment', string="经办人身份证") @@ -1088,14 +1088,19 @@ class PropertyLeaseContract(models.Model): record.admin_id = record.lease_ids[0].admin_id.id def get_property_contract_time(self): - for record in self.search([]): - if record.term_start_time: - current_date = date.today() - if record.condition != 'cancel': - if current_date >= record.term_start_time: - record.write({'condition': 'executed'}) - elif current_date < record.term_start_time: - record.write({'condition': 'be_executed'}) + unique_property_ids = set() + lease_contracts = self.env['property.lease.contract'].search([('end_comparison', 'in', ['red', 'yellow', 'blue'])]) + for record in lease_contracts: + contracts = self.env['property.evaluation.plan'].search([]) + for contract in contracts: + for property_id in contract.property_ids: + unique_property_ids.add(property_id.id) + + lease_id_list = [lease.address_id.id for lease in record.lease_ids] + should_process = any(lease_id not in unique_property_ids for lease_id in lease_id_list) + if should_process: + record.put_evaluation_plan() + record.write({'state': 'to'}) # 续租 def button_lease_extension(self): form_id = self.env.ref('yuthon_property_approval.view_property_lease_extension_form').id @@ -1148,22 +1153,24 @@ class PropertyLeaseContract(models.Model): return self.search_count([('expiration_coming', '=', 'due'), ('admin_id', '=', self.env.user.id)]) def put_evaluation_plan(self): - property_ids = [] - property_id = self.lease_ids[0].address_id for record in self: + property_ids = [] + rent_area = 0 + first_address_id = record.lease_ids[0].address_id if record.lease_ids else None for lease_id in record.lease_ids: property_ids.append(lease_id.address_id.id) + rent_area += lease_id.address_id.rent_area self.env['property.evaluation.plan'].create({ 'name': record.name, - 'property_ids': property_ids, - 'evaluation_area': property_id.rent_area, - 'owner_id': property_id.title_information_ids[0].owner_id.id if property_id.title_information_ids else None, - 'registered_id': property_id.title_information_ids[0].registered_id.id if property_id.title_information_ids else None, - 'rent_id': property_id.reference_ids[0].rent_id.id if property_id.reference_ids else None, - 'start_lease_period': property_id.reference_ids[0].start_lease_period if property_id.reference_ids else None, - 'end_lease_period': property_id.reference_ids[0].end_lease_period if property_id.reference_ids else None, - 'annual_increase_percentage': property_id.reference_ids[0].annual_increase_percentage if property_id.reference_ids else None, - 'remake': property_id.remark, + 'property_ids': [(6, 0, property_ids)], + 'evaluation_area': rent_area, + 'owner_id': first_address_id.title_information_ids[0].owner_id.id if first_address_id and first_address_id.title_information_ids else None, + 'registered_id': first_address_id.title_information_ids[0].registered_id.id if first_address_id and first_address_id.title_information_ids else None, + 'rent_id': first_address_id.reference_ids[0].rent_id.id if first_address_id and first_address_id.reference_ids else None, + 'start_lease_period': first_address_id.reference_ids[0].start_lease_period if first_address_id and first_address_id.reference_ids else None, + 'end_lease_period': first_address_id.reference_ids[0].end_lease_period if first_address_id and first_address_id.reference_ids else None, + 'annual_increase_percentage': first_address_id.reference_ids[0].annual_increase_percentage if first_address_id and first_address_id.reference_ids else None, + 'remake': first_address_id.remark if first_address_id else None, 'assessment_category': 'rent_money', }) record.write({'state': 'ing'}) @@ -1181,8 +1188,10 @@ class PropertyLeaseContract(models.Model): property_id = record.lease_ids[0].address_id if record.state == 'done': raise UserError(f'{record.name}该物业已评估,请勿重复评估') + rent_area = 0 for lease_id in record.lease_ids: property_ids.append(lease_id.address_id.id) + rent_area += lease_id.address_id.rent_area self.env['property.evaluation.plan'].create({ 'name': record.name, 'property_ids': property_ids, diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index 79d47fea4..572747c38 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -418,6 +418,7 @@ + diff --git a/yuthon_salary/__manifest__.py b/yuthon_salary/__manifest__.py index b1d2eb7be..bc807f210 100644 --- a/yuthon_salary/__manifest__.py +++ b/yuthon_salary/__manifest__.py @@ -21,6 +21,7 @@ 'views/yuthon_payroll_project_views.xml', 'views/yuthon_payroll_type_setting_views.xml', 'views/yuthon_payroll_labor_views.xml', + 'views/yuthon_salary_documents_views.xml', 'views/yuthon_payroll_retired_views.xml', 'wizard/yuthon_salary_wizard_views.xml', 'wizard/temporary_payslip_wizard_views.xml', @@ -35,6 +36,7 @@ 'assets': { 'web.assets_backend': [ 'yuthon_salary/static/scss/approval.scss', + 'yuthon_salary/static/src/js/salary_documents_button.js', 'yuthon_salary/static/src/js/salary_create_button.js', 'yuthon_salary/static/src/js/salary_payslip_button.js', 'yuthon_salary/static/src/js/salary_labor_button.js', @@ -44,6 +46,7 @@ 'yuthon_salary/static/src/xml/salary_labor_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', 'yuthon_salary/static/src/xml/salary_return_button.xml', ], }, diff --git a/yuthon_salary/models/__init__.py b/yuthon_salary/models/__init__.py index 93f68bafd..0fb4d3f84 100644 --- a/yuthon_salary/models/__init__.py +++ b/yuthon_salary/models/__init__.py @@ -5,4 +5,5 @@ from . import inherit_hr_payslip from . import yuthon_payroll_type_setting from . import yuthon_payroll_project from . import yuthon_payroll_labor -from . import yuthon_payroll_retired \ No newline at end of file +from . import yuthon_payroll_retired +from . import yuthon_salary_documents \ No newline at end of file diff --git a/yuthon_salary/models/yuthon_salary_documents.py b/yuthon_salary/models/yuthon_salary_documents.py new file mode 100644 index 000000000..6dd24449f --- /dev/null +++ b/yuthon_salary/models/yuthon_salary_documents.py @@ -0,0 +1,24 @@ +from odoo import api, fields, models + + +class YuthonSalaryDocuments(models.Model): + _name = 'yuthon.salary.documents' + _description = '薪资附件管理' + + current_year = fields.Integer(string='年份') + current_month = fields.Selection([ + ('1', '1月份'), + ('2', '2月份'), + ('3', '3月份'), + ('4', '4月份'), + ('5', '5月份'), + ('6', '6月份'), + ('7', '7月份'), + ('8', '8月份'), + ('9', '9月份'), + ('10', '10月份'), + ('11', '11月份'), + ('12', '12月份') + ], string="月份") + company_id = fields.Many2one('res.company', string='公司', index=True, default=lambda self: self.env.company) + documents_ids = fields.Many2many('ir.attachment', string="附件") \ No newline at end of file diff --git a/yuthon_salary/security/ir.model.access.csv b/yuthon_salary/security/ir.model.access.csv index 8ebdce9ce..b9ce2dba8 100644 --- a/yuthon_salary/security/ir.model.access.csv +++ b/yuthon_salary/security/ir.model.access.csv @@ -17,4 +17,5 @@ access_temporary_payslip_wizard,access_temporary_payslip_wizard,model_temporary_ access_yuthon_payroll_labor,access_yuthon_payroll_labor,model_yuthon_payroll_labor,base.group_user,1,1,1,1 access_yuthon_payroll_retired,access_yuthon_payroll_retired,model_yuthon_payroll_retired,base.group_user,1,1,1,1 access_payroll_labor_wizard,access_payroll_labor_wizard,model_payroll_labor_wizard,base.group_user,1,1,1,1 -access_payroll_retired_wizard,access_payroll_retired_wizard,model_payroll_retired_wizard,base.group_user,1,1,1,1 \ No newline at end of file +access_payroll_retired_wizard,access_payroll_retired_wizard,model_payroll_retired_wizard,base.group_user,1,1,1,1 +access_yuthon_salary_documents,access_yuthon_salary_documents,model_yuthon_salary_documents,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_salary/static/src/js/salary_documents_button.js b/yuthon_salary/static/src/js/salary_documents_button.js new file mode 100644 index 000000000..f6daffafd --- /dev/null +++ b/yuthon_salary/static/src/js/salary_documents_button.js @@ -0,0 +1,28 @@ +/** @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 CustomDocumentsController extends ListController { + setup() { + super.setup(); + } + + openDocumentsWizard() { + this.actionService.doAction({ + type: 'ir.actions.act_window', + res_model: 'yuthon.salary.documents', + name: '薪资附件管理', + view_mode: 'tree', + view_type: 'tree', + views: [[false, 'tree']], + context: {}, + }); + } +} + +registry.category("views").add("custom_documents_button", { + ...listView, + Controller: CustomDocumentsController, + buttonTemplate: "salary_documents.ListView.Buttons", +}); \ No newline at end of file diff --git a/yuthon_salary/static/src/xml/salary_documents_button.xml b/yuthon_salary/static/src/xml/salary_documents_button.xml new file mode 100644 index 000000000..eb1ca7690 --- /dev/null +++ b/yuthon_salary/static/src/xml/salary_documents_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 444bbd389..774e115e3 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -6,7 +6,7 @@ - + custom_documents_button employee_id @@ -28,7 +28,7 @@ hide - + diff --git a/yuthon_salary/views/yuthon_salary_documents_views.xml b/yuthon_salary/views/yuthon_salary_documents_views.xml new file mode 100644 index 000000000..0dc2436cb --- /dev/null +++ b/yuthon_salary/views/yuthon_salary_documents_views.xml @@ -0,0 +1,20 @@ + + + + yuthon.salary.documents.tree + yuthon.salary.documents + + + + + + + + + + + 薪资附件管理 + yuthon.salary.documents + tree + + diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml index 76163efb7..c1a76fb80 100644 --- a/yuthon_work_brand/views/hr_menus.xml +++ b/yuthon_work_brand/views/hr_menus.xml @@ -370,6 +370,11 @@ parent="human_resources_salary_root_board" action="yuthon_salary.view_yuthon_payroll_temporary_action" sequence="30"/> +