From 321c716607952e7dfb5284dae969abf14bfbceb2 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: Sat, 18 Oct 2025 19:49:03 +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 --- .../views/soong_workflow_record.xml | 2 + .../models/yuthon_shift_approval.py | 12 +-- .../views/yuthon_shift_approval_views.xml | 12 +-- yuthon_property/__manifest__.py | 1 + .../models/property_meter_archives.py | 100 +++++++++++------- .../models/property_meter_water.py | 95 ++++++++++------- yuthon_property/security/ir.model.access.csv | 3 +- .../views/property_meter_archives_views.xml | 5 +- .../views/property_meter_water_views.xml | 4 + yuthon_property/wizard/__init__.py | 1 + yuthon_property/wizard/task_push_wizard.py | 43 ++++++++ .../wizard/task_push_wizard_views.xml | 20 ++++ .../inherit_property_tenant_information.py | 43 ++++---- .../models/inherit_yuthon_property.py | 4 +- .../models/property_lease_contract.py | 18 +++- ...erit_property_tenant_information_views.xml | 2 +- .../views/inherit_yuthon_property_views.xml | 50 +++++++-- .../views/property_lease_contract.xml | 1 - .../views/property_menu_all.xml | 20 ++-- .../wizard/choose_contract_wizard_views.xml | 4 +- .../wizard/choose_property_wizard.py | 8 +- 21 files changed, 310 insertions(+), 138 deletions(-) create mode 100644 yuthon_property/wizard/task_push_wizard.py create mode 100644 yuthon_property/wizard/task_push_wizard_views.xml diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml index af5087c11..820785037 100644 --- a/soong_workflow/views/soong_workflow_record.xml +++ b/soong_workflow/views/soong_workflow_record.xml @@ -18,6 +18,7 @@ + @@ -50,6 +51,7 @@ + diff --git a/yuthon_hr_attendance/models/yuthon_shift_approval.py b/yuthon_hr_attendance/models/yuthon_shift_approval.py index c91272bb7..a1ec20f88 100644 --- a/yuthon_hr_attendance/models/yuthon_shift_approval.py +++ b/yuthon_hr_attendance/models/yuthon_shift_approval.py @@ -13,17 +13,17 @@ class YuthonShiftApproval(models.Model): code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('shift_approval')) resource_id = fields.Many2one('resource.resource', string="申请人", default=lambda self: self.env.user.employee_id.resource_id.id) company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.user.company_id.id) - transferees_id = fields.Many2one('resource.resource', string="调班对象", domain="[('id', 'in', resource_ids)]") - alternate_id = fields.Many2one('resource.resource', string="替班对象", domain="[('id', 'in', resource_ids)]") - alternate_shifts = fields.Selection([('transferees', '调班'), ('alternate', '替班')], string="调替班" , default='transferees') + transferees_id = fields.Many2one('resource.resource', string="换班对象", domain="[('id', 'in', resource_ids)]") + alternate_id = fields.Many2one('resource.resource', string="顶班对象", domain="[('id', 'in', resource_ids)]") + alternate_shifts = fields.Selection([('transferees', '换班'), ('alternate', '顶班')], string="申请类型" , default='transferees') shift_date = fields.Date(string="日期") - shift_id = fields.Many2one('planning.slot', string="我的班次1") + shift_id = fields.Many2one('planning.slot', string="我的班次") shift_two_date = fields.Date(string="日期") - shift_two_id = fields.Many2one('planning.slot', string="我的班次2") + shift_two_id = fields.Many2one('planning.slot', string="我的班次") return_date = fields.Date(string="日期") return_id = fields.Many2one('planning.slot', string="对方班次") return_two_date = fields.Date(string="日期") - return_two_id = fields.Many2one('planning.slot', string="对方班次2") + return_two_id = fields.Many2one('planning.slot', string="对方班次") department_id = fields.Many2one('hr.department', string="部门", related='resource_id.employee_id.department_id') resource_ids = fields.Many2many('resource.resource', string="资源用户列表") is_issues = fields.Boolean(string='是否上会') diff --git a/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml b/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml index 8de935a4d..10b6b8a33 100644 --- a/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml +++ b/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml @@ -66,7 +66,7 @@ - + @@ -75,11 +75,12 @@ ('start_datetime', '>', shift_date + ' 00:00:00'), ('end_datetime', '<', shift_date + ' 23:59:59') ]" + invisible="alternate_shifts == 'alternate'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context', 'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context', 'order': 'start_datetime desc', 'search_default_group_by_month': True,}"/> - - - + @@ -106,11 +106,11 @@ ('start_datetime', '>', shift_two_date + ' 00:00:00'), ('end_datetime', '<', shift_two_date + ' 23:59:59') ]" - invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context', + context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context', 'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context', 'order': 'start_datetime desc', 'search_default_group_by_month': True,}"/> - +
+
- @@ -110,6 +112,7 @@ +
diff --git a/yuthon_property/views/property_meter_water_views.xml b/yuthon_property/views/property_meter_water_views.xml index 75c54f1b0..e8f52cea1 100644 --- a/yuthon_property/views/property_meter_water_views.xml +++ b/yuthon_property/views/property_meter_water_views.xml @@ -95,6 +95,9 @@ +
+
@@ -114,6 +117,7 @@ +
diff --git a/yuthon_property/wizard/__init__.py b/yuthon_property/wizard/__init__.py index 920e5106f..d3bf3177c 100644 --- a/yuthon_property/wizard/__init__.py +++ b/yuthon_property/wizard/__init__.py @@ -9,3 +9,4 @@ from . import meter_price_wizard from . import water_price_wizard from . import initialize_wizard from . import electric_water_wizard +from . import task_push_wizard diff --git a/yuthon_property/wizard/task_push_wizard.py b/yuthon_property/wizard/task_push_wizard.py new file mode 100644 index 000000000..ed96e48bb --- /dev/null +++ b/yuthon_property/wizard/task_push_wizard.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields, api, _, SUPERUSER_ID +from odoo.exceptions import ValidationError, UserError +from pypinyin import pinyin, Style +import xlrd +import base64 +import datetime +from datetime import datetime + + +class TaskPushWizard(models.TransientModel): + _name = 'task.push.wizard' + _description = '电水表任务推送弹窗' + + push_date = fields.Date(string='日期', default=fields.date.today()) + meter_ids = fields.Many2many('meter.archives.line', string='电表任务') + water_ids = fields.Many2many('meter.water.line', string='水表任务') + + def confirm(self): + if self.meter_ids: + management_type_id = self.env['yuthon.management.type'].search([('name', '=', '电费')], limit=1) + for meter in self.meter_ids: + self.env['property.accounts.receivable'].create({ + 'contract_id': meter.contract_id.id, + 'lessee_id': meter.lessee_id.id if meter.lessee_id else None, + 'original_amount': meter.receivables, + 'due_date': self.push_date, + 'create_time': datetime.now(), + 'management_type_id': management_type_id.id, + }) + meter.is_push = True + if self.water_ids: + management_type_id = self.env['yuthon.management.type'].search([('name', '=', '水费')], limit=1) + for water in self.water_ids: + self.env['property.accounts.receivable'].create({ + 'contract_id': water.contract_id.id, + 'lessee_id': water.lessee_id.id if water.lessee_id else None, + 'original_amount': water.receivables, + 'due_date': self.push_date, + 'create_time': datetime.now(), + 'management_type_id': management_type_id.id, + }) + water.is_push = True diff --git a/yuthon_property/wizard/task_push_wizard_views.xml b/yuthon_property/wizard/task_push_wizard_views.xml new file mode 100644 index 000000000..080c2fb61 --- /dev/null +++ b/yuthon_property/wizard/task_push_wizard_views.xml @@ -0,0 +1,20 @@ + + + + task.push.wizard.form + task.push.wizard + +
+ + + + + +
+
+
+
+
+
diff --git a/yuthon_property_approval/models/inherit_property_tenant_information.py b/yuthon_property_approval/models/inherit_property_tenant_information.py index 9a23a159c..5e0615ed4 100644 --- a/yuthon_property_approval/models/inherit_property_tenant_information.py +++ b/yuthon_property_approval/models/inherit_property_tenant_information.py @@ -14,22 +14,27 @@ class PropertyTenantInformation(models.Model): tenant_ids = self.env["property.tenant.information"].browse( self._context.get('active_ids', self._context.get('active_id'))) for record in tenant_ids: - record.property_contract_ids.write({'property_contract_ids': [(5, 0, 0)]}) - property_contract_list = [] - contract_ids = self.env["property.lease.contract"].search([('lessee_id', '=', record.id)]) - for contract_id in contract_ids: - property_ids = [] - if contract_id.lease_ids: - for lease_id in contract_id.lease_ids: - if lease_id.address_id: - address_id = lease_id.address_id.id - else: - continue - property_ids.append(address_id) - property_contract_list.append([0, 0,{ - 'tenant_id': record.id, - 'lease_contract_id': contract_id.id, - 'property_ids': [(6, 0, property_ids)], - 'rent': contract_id.rent, - }]) - record.write({'property_contract_ids': property_contract_list}) + if record.property_contract_ids: + for contract in record.property_contract_ids: + if not contract.lease_contract_id: + contract.unlink() + + # record.property_contract_ids.write({'property_contract_ids': [(5, 0, 0)]}) + # property_contract_list = [] + # contract_ids = self.env["property.lease.contract"].search([('lessee_id', '=', record.id)]) + # for contract_id in contract_ids: + # property_ids = [] + # if contract_id.lease_ids: + # for lease_id in contract_id.lease_ids: + # if lease_id.address_id: + # address_id = lease_id.address_id.id + # else: + # continue + # property_ids.append(address_id) + # property_contract_list.append([0, 0,{ + # 'tenant_id': record.id, + # 'lease_contract_id': contract_id.id, + # 'property_ids': [(6, 0, property_ids)], + # 'rent': contract_id.rent, + # }]) + # record.write({'property_contract_ids': property_contract_list}) diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index 4c9d4c76a..213959401 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -810,8 +810,8 @@ class PropertyAccountsReceivable(models.Model): # 批量退回 def action_refuse_all(self): model_type_data = { - '水费': 'property.water.list', - '电费': 'property.tariff.list', + '水费': 'meter.archives.line', + '电费': 'meter.water.line', '押金': 'property.deposit.list', '租金': 'property.rent.list' } diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 4ac9fe1c0..48cb5a674 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -27,7 +27,7 @@ class PropertyTenantLine(models.Model): _description = '物业承租方合同明细行' tenant_id = fields.Many2one('property.tenant.information', string="关联租户信息") - property_ids = fields.Many2many('yuthon.property', string="物业信息") + property_name = fields.Char(related='lease_contract_id.property_name', string="物业信息") lease_contract_id = fields.Many2one('property.lease.contract', string="合同编号") rent = fields.Float(related='lease_contract_id.rent', string="租金") start_time = fields.Date(related='lease_contract_id.actual_start_time', string="生效日期") @@ -523,6 +523,22 @@ class PropertyLeaseContract(models.Model): 'property_contract_ids': [(0, 0, contract_data)] }) + # 更新承租方合同信息 + lessee_contract = self.env['property.tenant.line'].search([ + ('tenant_id', '=', contract.lessee_id.id), + ('lease_contract_id', '=', contract.id) + ], limit=1) + + lessee_date = { + 'tenant_id': contract.lessee_id.id, + 'lease_contract_id': contract.id, + } + + if not lessee_contract: + lessee_contract.write({ + 'property_contract_ids': [(0, 0, lessee_date)] + }) + contract_lines = self.env['property.contract.line'].search([ ('lease_contract_id', '=', contract.id) ]) diff --git a/yuthon_property_approval/views/inherit_property_tenant_information_views.xml b/yuthon_property_approval/views/inherit_property_tenant_information_views.xml index c6e7a9820..d17ee1537 100644 --- a/yuthon_property_approval/views/inherit_property_tenant_information_views.xml +++ b/yuthon_property_approval/views/inherit_property_tenant_information_views.xml @@ -11,7 +11,7 @@ - + diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml index dcc18a251..6d12c6e04 100644 --- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml +++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml @@ -30,6 +30,23 @@ + + inherit.meter.archives.line.search + meter.archives.line + + + + + + + view.meter.water.line.tree.inherit meter.water.line @@ -40,6 +57,23 @@ + + inherit.property.meter.water.search + meter.water.line + + + + + + + yuthon.property.form.inherit yuthon.property @@ -377,7 +411,7 @@ + filter_domain="['|', '|', '|', ('property_ids.name', 'ilike', self), ('lessee_id.name', 'ilike', self), ('contract_id.contract_code', 'ilike', self), ('company_id.name', 'ilike', self)]"/> @@ -412,13 +446,13 @@ code action = model.initialize_reconciliation() - - 更新物业信息 - - - code - action = model.update_property_ids() - + + + + + + + 删除重复数据 diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index addea8179..1abdba6c3 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -46,7 +46,6 @@
- diff --git a/yuthon_property_approval/views/property_menu_all.xml b/yuthon_property_approval/views/property_menu_all.xml index bc6c8fa81..8992b7e5e 100644 --- a/yuthon_property_approval/views/property_menu_all.xml +++ b/yuthon_property_approval/views/property_menu_all.xml @@ -252,16 +252,16 @@ name="管理费列表" parent="yuthon_property.yuthon_property_fee_management" action="property_management_list_action"/> - - + + + + + + + + + + - - + + diff --git a/yuthon_property_approval/wizard/choose_property_wizard.py b/yuthon_property_approval/wizard/choose_property_wizard.py index 6c78d9020..c312e3316 100644 --- a/yuthon_property_approval/wizard/choose_property_wizard.py +++ b/yuthon_property_approval/wizard/choose_property_wizard.py @@ -20,15 +20,17 @@ class ChoosePropertyWizard(models.Model): contract_sort_name = fields.Char( string="合同类型名称", compute='_compute_contract_sort_name', - store=False + store=True ) @api.depends('lease_contract_id.contract_sort') def _compute_contract_sort_name(self): type_mapping = { 'property': '物业', - 'ads': '广告位', - 'guan': '管子间' + 'guanggao': '广告位', + 'guanzi': '管子间', + 'room': '机房', + 'base_station': '基站' } for rec in self: if rec.lease_contract_id and rec.lease_contract_id.contract_sort: