# Copyright 2021 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models, api


class PosOrder(models.Model):
    _inherit = 'pos.order'

    # ------------------------------------------------------
    # Fields declaration
    # ------------------------------------------------------

    # ------------------------------------------------------
    # SQL Constraints
    # ------------------------------------------------------

    # ------------------------------------------------------
    # Default methods
    # ------------------------------------------------------

    # ------------------------------------------------------
    # Computed fields / Search Fields
    # ------------------------------------------------------

    # ------------------------------------------------------
    # Onchange / Constraints
    # ------------------------------------------------------

    # ------------------------------------------------------
    # CRUD methods (ORM overrides)
    # ------------------------------------------------------
    def test_paid(self):
        for order in self:
            if order.config_id.is_balance_free:
                return True
        return super(PosOrder, self).test_paid()
    # ------------------------------------------------------
    # Actions
    # ------------------------------------------------------

    # ------------------------------------------------------
    # Business methods
    # ------------------------------------------------------