Skip to content

Commit 5d73a60

Browse files
committed
IMP performance
1 parent cde9a7c commit 5d73a60

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

l10n_ar_account_vat_ledger/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
##############################################################################
66
from . import account
77
from . import account_vat_report
8+
from . import account_invoice

l10n_ar_account_vat_ledger/account.py

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
##############################################################################
66
from openerp import models, fields, api, _
77
import openerp.addons.decimal_precision as dp
8+
import logging
9+
_logger = logging.getLogger(__name__)
810

911

1012
# TODO mejorar y usar los signos de tax codes para todo (o signo del impuesto)
@@ -35,6 +37,8 @@ class afip_document_class(models.Model):
3537
def _get_amounts(self):
3638
"""
3739
"""
40+
_logger.info('Getting amounts for document class %s(%s)' % (
41+
self.name, self.id))
3842
vat_ledger_id = self._context.get('vat_ledger_id', False)
3943
if vat_ledger_id:
4044
vat_ledger = self.env['account.vat.ledger'].browse(vat_ledger_id)
@@ -85,6 +89,8 @@ class account_tax_code(models.Model):
8589
def _get_amounts(self):
8690
"""
8791
"""
92+
_logger.info('Getting amounts for tax code %s(%s)' % (
93+
self.name, self.id))
8894
amount_untaxed = False
8995
amount_tax = False
9096
amount_total = False
@@ -156,6 +162,8 @@ class afip_responsability(models.Model):
156162
def _get_amounts(self):
157163
"""
158164
"""
165+
_logger.info('Getting amounts for responsability %s(%s)' % (
166+
self.name, self.id))
159167
amount_untaxed = False
160168
amount_tax = False
161169
amount_total = False
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
##############################################################################
3+
# For copyright and license notices, see __openerp__.py file in module root
4+
# directory
5+
##############################################################################
6+
from openerp import models, fields
7+
import logging
8+
_logger = logging.getLogger(__name__)
9+
10+
11+
# for performance
12+
# TODO this should be suggested to odoo by a PR
13+
class AccountInvoiceLine(models.Model):
14+
_inherit = 'account.invoice.line'
15+
16+
invoice_id = fields.Many2one(
17+
auto_join=True
18+
)
19+
20+
21+
class AccountInvoiceTax(models.Model):
22+
_inherit = 'account.invoice.tax'
23+
24+
invoice_id = fields.Many2one(
25+
auto_join=True
26+
)

0 commit comments

Comments
 (0)