update refund invoice
This commit is contained in:
parent
c6c82d6644
commit
eb46ccd7d8
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue