[12.0][MIG] account_tax_balance
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
# © 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, fields, api
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
move_type = fields.Selection(
|
||||
string="Move type", selection=[
|
||||
@api.model
|
||||
def _selection_move_type(self):
|
||||
return [
|
||||
('other', 'Other'),
|
||||
('liquidity', 'Liquidity'),
|
||||
('receivable', 'Receivable'),
|
||||
('receivable_refund', 'Receivable refund'),
|
||||
('payable', 'Payable'),
|
||||
('payable_refund', 'Payable refund'),
|
||||
], compute='_compute_move_type', store=True, readonly=True)
|
||||
]
|
||||
|
||||
move_type = fields.Selection(
|
||||
selection='_selection_move_type',
|
||||
compute='_compute_move_type', store=True, readonly=True)
|
||||
|
||||
@api.multi
|
||||
@api.depends(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# © 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, fields, api, _
|
||||
from odoo import _, api, fields, models
|
||||
|
||||
|
||||
class AccountTax(models.Model):
|
||||
@@ -80,9 +80,13 @@ class AccountTax(models.Model):
|
||||
for tax in self:
|
||||
tax.has_moves = tax.id in ids_with_moves
|
||||
|
||||
@api.model
|
||||
def _is_unsupported_search_operator(self, operator):
|
||||
return operator != '='
|
||||
|
||||
@api.model
|
||||
def _search_has_moves(self, operator, value):
|
||||
if operator != '=' or not value:
|
||||
if self._is_unsupported_search_operator(operator) or not value:
|
||||
raise ValueError(_("Unsupported search operator"))
|
||||
ids_with_moves = self._account_tax_ids_with_moves()
|
||||
return [('id', 'in', ids_with_moves)]
|
||||
|
||||
Reference in New Issue
Block a user