From 40f7f4983b28bd3fc2b00075ee4de7ba2fe40d51 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: Thu, 27 Nov 2025 18:33:59 +0800 Subject: [PATCH 1/2] =?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 --- .../wizard/print_payment_wizard.py | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/yuthon_property_approval/wizard/print_payment_wizard.py b/yuthon_property_approval/wizard/print_payment_wizard.py index 562f59845..df806f65c 100644 --- a/yuthon_property_approval/wizard/print_payment_wizard.py +++ b/yuthon_property_approval/wizard/print_payment_wizard.py @@ -32,6 +32,7 @@ class PrintPaymentWizard(models.Model): return start_date, end_date def confirm(self): + receivable_report_ids = [] """确认按钮:筛选数据并触发打印""" self.ensure_one() today = date.today() @@ -53,24 +54,30 @@ class PrintPaymentWizard(models.Model): receivable_lines = contract_id.receivable_ids.filtered( lambda line: start_date <= line.due_date <= end_date ) - for line in receivable_lines: - line.print_date = today - # line.number +=1 - report_data = { - 'contract': contract_id, - 'selected_year': self.select_year, - 'selected_month': self.select_month, - 'day': today.day, - 'lessee_name': contract_id.lessee_id.name, - 'receivable_lines': [{ - '1':1, - '2':2, - '3':3, - }], - 'line_count': len(receivable_lines), - 'total_amount': sum(line.original_amount for line in receivable_lines) - } + if receivable_lines: + receivable_report_ids.extend(receivable_lines.ids) + + if receivable_report_ids: + contract_id.receivable_report_ids = [(6, 0, receivable_report_ids)] + # + # # for line in receivable_lines: + # # line.print_date = today + # # line.number +=1 + # report_data = { + # 'contract': contract_id, + # 'selected_year': self.select_year, + # 'selected_month': self.select_month, + # 'day': today.day, + # 'lessee_name': contract_id.lessee_id.name, + # 'receivable_lines': [{ + # '1':1, + # '2':2, + # '3':3, + # }], + # 'line_count': len(receivable_lines), + # 'total_amount': sum(line.original_amount for line in receivable_lines) + # } report_ref = self.env['ir.actions.report'].search([ ('report_name', '=', 'yuthon_property_approval.report_contract_accounts_receivable')]) - return report_ref.report_action(self, data=report_data) \ No newline at end of file + return report_ref.report_action(self.contract_ids) \ No newline at end of file From 0b7f75c06cccb3445caff19bf7431a3283b4e454 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: Thu, 27 Nov 2025 18:56:00 +0800 Subject: [PATCH 2/2] =?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_maintain/models/property_device_repair.py | 1 + yuthon_maintain/models/property_report_repair.py | 1 + .../models/property_bills_payable.py | 3 +-- .../models/property_lease_renewal.py | 12 +++++------- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/yuthon_maintain/models/property_device_repair.py b/yuthon_maintain/models/property_device_repair.py index 2c7b4ffa7..19f9521e8 100644 --- a/yuthon_maintain/models/property_device_repair.py +++ b/yuthon_maintain/models/property_device_repair.py @@ -45,6 +45,7 @@ class PropertyDeviceRelief(models.Model): self.report_state = 'done' order_id = self.env['processing.order.approval'].create({ 'device_id': self.id, + 'code': self.env['ir.sequence'].next_by_code('property_device_repair_code'), }) workflow_record_id = self.env['soong.workflow.record'].search([ ('code', '=', self.code), diff --git a/yuthon_maintain/models/property_report_repair.py b/yuthon_maintain/models/property_report_repair.py index b1ad32dee..fc6e3c8bf 100644 --- a/yuthon_maintain/models/property_report_repair.py +++ b/yuthon_maintain/models/property_report_repair.py @@ -69,6 +69,7 @@ class PropertyRentRelief(models.Model): soong_workflow_line_list = [] order_id = self.env['processing.order.approval'].create({ 'repair_id': self.id, + 'code': self.env['ir.sequence'].next_by_code('property_report_repair_code'), }) workflow_record_id = self.env['soong.workflow.record'].search([ ('code', '=', self.code), diff --git a/yuthon_property_approval/models/property_bills_payable.py b/yuthon_property_approval/models/property_bills_payable.py index 876716200..aac495efb 100644 --- a/yuthon_property_approval/models/property_bills_payable.py +++ b/yuthon_property_approval/models/property_bills_payable.py @@ -10,8 +10,7 @@ class PropertyBillsPayable(models.Model): _inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin'] name = fields.Char(string='标题') - code = fields.Char(string="编号", - default=lambda self: self.env['ir.sequence'].next_by_code('property_bills_payable_code')) + code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_bills_payable_code')) users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") company_id = fields.Many2one(related='users_id.company_id', string="公司") diff --git a/yuthon_property_approval/models/property_lease_renewal.py b/yuthon_property_approval/models/property_lease_renewal.py index 53736898a..5a1f0c3f3 100644 --- a/yuthon_property_approval/models/property_lease_renewal.py +++ b/yuthon_property_approval/models/property_lease_renewal.py @@ -205,6 +205,7 @@ class PropertyLeaseRenewal(models.Model): })) bills_payable = self.env['property.bills.payable'].create({ + 'code': self.env['ir.sequence'].next_by_code('property_bills_payable_code'), 'lease_contract_id': rec.contract_id.id, 'name': f'{rec.contract_id.contract_code}应付单', 'create_uid': self.env.uid, @@ -213,15 +214,16 @@ class PropertyLeaseRenewal(models.Model): if not rec.is_full_refund: start_time = datetime.combine(rec.early_quitting_date, datetime.min.time().replace(hour=8, minute=00)) - self.env['property.bank.statements'].create({ + self.env['property.bank.statements'].sudo().create({ 'start_time': start_time, 'original_amount': rec.balance, 'name_account': rec.new_lessee_id.name, - 'remake': f'合同为{rec.contract_id.contract_code}提前退押金', + 'remake': f'合同为{rec.contract_id.contract_code}{rec.remake}', }) workflow_record_id = self.env['soong.workflow.record'].search([ - ('code', '=', self.code), + ('code', '=', rec.code), + ('res_id', '=', rec.id), ]) soong_workflow_line_list.append((0, 0, { 'model': 'property.bills.payable', @@ -231,10 +233,6 @@ class PropertyLeaseRenewal(models.Model): self.bills_record_id = bills_payable.id bills_payable.soong_record_ids = soong_workflow_line_list - soong_record = self.env["soong.workflow.record"].search([("code", "=", bills_payable.code)]) - if soong_record: - self.workflow_record_id = soong_record.id - # 原有作废/减免逻辑保留 for receivable_id in rec.receivables_ids: if receivable_id.void: