Update end_rental_contract.py

This commit is contained in:
zainab2097 2024-10-03 22:03:38 +03:00 committed by GitHub
parent 7b855b7f8f
commit 2471fa2160
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -42,6 +42,7 @@ class EndOfRent(models.Model):
invoice_id = fields.Many2one('account.move', string="Invoice") invoice_id = fields.Many2one('account.move', string="Invoice")
def _prepare_invoice_values(self, end, amount): def _prepare_invoice_values(self, end, amount):
self.contract_id.partner_id.property_account_receivable_id = end.contract_id.debit_account_id.id
invoice_vals = { invoice_vals = {
'ref': end.name, 'ref': end.name,
'move_type': 'out_invoice', 'move_type': 'out_invoice',
@ -54,12 +55,14 @@ class EndOfRent(models.Model):
'name': end.name + ' - ' + str(end.date), 'name': end.name + ' - ' + str(end.date),
'price_unit': amount, 'price_unit': amount,
'quantity': 1.0, 'quantity': 1.0,
'account_id': end.contract_id.revenue_account_id.id,
})], })],
} }
return invoice_vals return invoice_vals
def _prepare_out_refund_invoice_values(self, end, amount): def _prepare_out_refund_invoice_values(self, end, amount):
self.contract_id.partner_id.property_account_receivable_id = end.contract_id.accrued_account_id.id
invoice_vals = { invoice_vals = {
'ref': end.name, 'ref': end.name,
'move_type': 'out_refund', 'move_type': 'out_refund',
@ -72,6 +75,7 @@ class EndOfRent(models.Model):
'name': end.name + ' - ' + str(end.date), 'name': end.name + ' - ' + str(end.date),
'price_unit': amount, 'price_unit': amount,
'quantity': 1.0, 'quantity': 1.0,
'account_id': end.contract_id.debit_account_id.id,
})], })],
} }