|
@@ -159,6 +159,7 @@ class AccountVoucher(models.Model):
|
|
|
|
|
|
account_move.post()
|
|
|
|
|
|
+ # Step 7: Write a number for invoice
|
|
|
invoice.action_number()
|
|
|
|
|
|
# Step 8: Create voucher
|
|
@@ -189,6 +190,12 @@ class AccountVoucher(models.Model):
|
|
|
|
|
|
account_voucher.action_move_line_create()
|
|
|
|
|
|
+ # Step 9: Close a invoice
|
|
|
+ if invoice.residual == 0:
|
|
|
+ invoice.write({
|
|
|
+ 'state': 'paid'
|
|
|
+ })
|
|
|
+
|
|
|
return {
|
|
|
'action_id': self.env['ir.actions.report.xml'].search([('report_name', '=', 'account.report_invoice')]).id,
|
|
|
'invoice_id': invoice.id
|