From eb46ccd7d8945a202d210071db9a503722eeea85 Mon Sep 17 00:00:00 2001 From: esraa Date: Mon, 14 Oct 2024 10:47:03 +0300 Subject: [PATCH] update refund invoice --- .../models/end_rental_contract.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/odex25_realstate/property_management/models/end_rental_contract.py b/odex25_realstate/property_management/models/end_rental_contract.py index 543394134..b4004a93d 100644 --- a/odex25_realstate/property_management/models/end_rental_contract.py +++ b/odex25_realstate/property_management/models/end_rental_contract.py @@ -55,15 +55,8 @@ class EndOfRent(models.Model): 'name': end.name + ' - ' + str(end.date), 'price_unit': amount, 'quantity': 1.0, - 'account_id': end.contract_id.debit_account_id.id, })], - 'line_ids': [(0, 0, {'account_id': end.contract_id.debit_account_id.id, 'debit': 0.0, 'credit': amount, - 'name': end.name + ' - ' + str(end.date), - 'quantity': 1}), - (0, 0, - {'account_id': end.contract_id.accrued_account_id.id, 'debit': amount, 'credit': 0.0, - 'quantity': 1})] } return invoice_vals @@ -109,12 +102,7 @@ class EndOfRent(models.Model): for rec in self: if (rec.remain_amount > 0.0) or (rec.remain_amount > 0.0 and rec.maintenance): invoice_vals = rec._prepare_out_refund_invoice_values(rec, rec.remain_amount) - invoice = self.env['account.move'].sudo().create(invoice_vals).with_user(self.env.uid) - # if len(invoice.invoice_line_ids) > 1: - # line_id = invoice.invoice_line_ids[1].id - # commands = [(2, line_id, 0)] - # invoice.write({'invoice_line_ids': commands}) rec.invoice_id = invoice.id rec.write({'state': 'done'}) elif (rec.insurance_amount == 0.0 or rec.remain_amount == 0.0) and not rec.maintenance: