Skip to content

Commit

Permalink
[MIG] account_balance_reporting/l10n_es_account_balance_report: Migra…
Browse files Browse the repository at this point in the history
…tion to 10.0
  • Loading branch information
pedrobaeza committed Jan 20, 2017
1 parent 31b5b43 commit 3bb3302
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 35 deletions.
2 changes: 1 addition & 1 deletion account_balance_reporting/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Usage

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/189/9.0
:target: https://runbot.odoo-community.org/runbot/189/10.0

Known issues / Roadmap
======================
Expand Down
2 changes: 1 addition & 1 deletion account_balance_reporting/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{
"name": "Account balance reporting engine",
"version": "9.0.1.0.0",
"version": "10.0.1.0.0",
"author": "Pexego, "
"AvanzOSC, "
"Tecnativa, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# © 2016 Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).

from openerp import api, fields, models, _
from odoo import api, fields, models, _
from .account_balance_reporting_template import CSS_CLASSES
import re
import logging
Expand Down Expand Up @@ -212,19 +212,15 @@ def name_get(self):
res.append((item.id, "[%s] %s" % (item.code, item.name)))
return res

def name_search(self, cr, uid, name, args=None, operator='ilike',
context=None, limit=80):
"""Redefine the method to allow searching by code."""
ids = []
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
"""Allow to search by code."""
if args is None:
args = []
if name:
ids = self.search(cr, uid, [('code', 'ilike', name)] + args,
limit=limit, context=context)
if not ids:
ids = self.search(cr, uid, [('name', operator, name)] + args,
limit=limit, context=context)
return self.name_get(cr, uid, ids, context=context)
args += ['|', ('code', operator, name)]
return super(AccountBalanceReportingLine, self).name_search(
name=name, args=args, operator=operator, limit=limit,
)

@api.multi
def _get_account_balance(self, expr, domain, balance_mode=0):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# © 2016 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).

from openerp import api, fields, models, _
from odoo import _, api, fields, models


_VALUE_FORMULA_HELP = (
Expand Down Expand Up @@ -157,18 +157,12 @@ def name_get(self):
res.append((item.id, "[%s] %s" % (item.code, item.name)))
return res

def name_search(self, cr, uid, name, args=None, operator='ilike',
context=None, limit=80):
"""Redefine the name_search method to allow searching by code."""
if context is None:
context = {}
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
"""Allow to search by code."""
if args is None:
args = []
ids = []
if name:
ids = self.search(cr, uid, [('code', 'ilike', name)] + args,
limit=limit, context=context)
if not ids:
ids = self.search(cr, uid, [('name', operator, name)] + args,
limit=limit, context=context)
return self.name_get(cr, uid, ids, context=context)
args += ['|', ('code', operator, name)]
return super(AccountBalanceReportingTemplateLine, self).name_search(
name=name, args=args, operator=operator, limit=limit,
)
15 changes: 13 additions & 2 deletions account_balance_reporting/tests/test_account_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Copyright 2016 Tecnativa - Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).

from openerp.tests import common
from openerp import fields
from odoo.tests import common
from odoo import fields


class TestAccountBalance(common.SavepointCase):
Expand Down Expand Up @@ -241,6 +241,17 @@ def test_copy_template(self):
copied_template = self.template.copy()
self.assertEqual(len(copied_template.line_ids), 6)

def test_template_line_name_search(self):
line_obj = self.env['account.balance.reporting.template.line']
self.assertTrue(line_obj.name_search('account'))
self.assertTrue(line_obj.name_search('1600'))

def test_report_line_name_search(self):
self.report.action_calculate()
line_obj = self.env['account.balance.reporting.line']
self.assertTrue(line_obj.name_search('account'))
self.assertTrue(line_obj.name_search('1600'))

def test_account_balance_mode_0(self):
""" Check results for debit-credit report. """
self.report.action_calculate()
Expand Down
8 changes: 4 additions & 4 deletions l10n_es_account_balance_report/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ Contribuidores

* Borja Soilán <borjals@pexego.es>
* Raimon Esteve (Zikzakmedia) <resteve@zikzakmedia.com>
# Juanjo Algaz
# Joaquín Gutierrez <joaquing.pedrosa@gmail.com>
# Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Vicent Cubells <vicent.cubells@tecnativa.com>
* Juanjo Algaz
* Joaquín Gutierrez <joaquing.pedrosa@gmail.com>
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>

Financiadores
-------------
Expand Down
2 changes: 1 addition & 1 deletion l10n_es_account_balance_report/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{
"name": "Informes de cuentas anuales españoles",
"version": "9.0.1.0.0",
"version": "10.0.1.0.0",
"author": "Pexego, "
"Tecnativa,"
"Zikzakmedia,"
Expand Down

0 comments on commit 3bb3302

Please sign in to comment.