# -*- coding: utf-8 -*-
##############################################################################
#
#    Odoo, Open Source Management Solution
#    Copyright (C) 2016 Prime Consulting SA, Cape Verde (<http://prime.cv>).
#
##############################################################################

from odoo import models, api

class AccountInvoice(models.Model):
    _inherit = "account.invoice"

    @api.multi
    def get_invoice_list(self):
        invoices = []
        for invoice in self:
                invoices.append(invoice)
        return [invoices]

    @api.multi
    def get_invoices_list(self):
        invoices = []
        for invoice in self:
                invoices.append(invoice)
        return invoices

    @api.multi
    def get_invoice_total_balance(self):
        result = {}
        for invoice in self:
            if invoice.currency_id not in result:
                result[invoice.currency_id] = 0.0
            if invoice.currency_id in result:
                result[invoice.currency_id] += invoice.residual
        res = []
        for r in result:
            res.append([r, result[r]])
        return res

