mirror of
https://github.com/NaN-tic/trytond-account_reports.git
synced 2023-12-14 05:43:08 +01:00
Remove prints and commented code.
This commit is contained in:
parent
33e4b0ae8c
commit
2c66bb52a8
10
__init__.py
10
__init__.py
|
@ -2,7 +2,6 @@
|
|||
# copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from .common import *
|
||||
# from .general_ledger import *
|
||||
from . import general_ledger
|
||||
from . import taxes_by_invoice
|
||||
|
||||
|
@ -12,15 +11,8 @@ def register():
|
|||
Pool.register(
|
||||
Account,
|
||||
Party,
|
||||
# PrintGeneralLedgerStart,
|
||||
FiscalYear,
|
||||
module=module, type_='model')
|
||||
# Pool.register(
|
||||
# PrintGeneralLedger,
|
||||
# module='account_reports', type_='wizard')
|
||||
# Pool.register(
|
||||
# GeneralLedgerReport,
|
||||
# module='account_reports', type_='report')
|
||||
|
||||
general_ledger.register(module)
|
||||
taxes_by_invoice.register(module)
|
||||
taxes_by_invoice.register(module)
|
||||
|
|
|
@ -296,26 +296,15 @@ class GeneralLedgerReport(HTMLReport):
|
|||
|
||||
rline = {
|
||||
'sequence': sequence,
|
||||
# 'key': str(currentKey),
|
||||
'line': line,
|
||||
# 'account_code': line.account.code or '',
|
||||
# 'account_name': line.account.name or '',
|
||||
# 'account_type': account_type,
|
||||
# 'date': line.date.strftime('%d/%m/%Y'),
|
||||
# 'move_line_name': line.description or '',
|
||||
'ref': (line.origin.rec_name if line.origin and
|
||||
hasattr(line.origin, 'rec_name') else None),
|
||||
# 'move_number': line.move.number,
|
||||
# 'move_post_number': (line.move.post_number
|
||||
# if line.move.post_number else ''),
|
||||
# 'party_name': line.party.name if line.party else '',
|
||||
'credit': credit,
|
||||
'debit': debit,
|
||||
'balance': balance,
|
||||
}
|
||||
|
||||
key = _get_key(currentKey)
|
||||
print(key)
|
||||
if records.get(key):
|
||||
records[key]['lines'].append(rline)
|
||||
records[key]['total_debit'] += debit
|
||||
|
@ -349,24 +338,7 @@ class GeneralLedgerReport(HTMLReport):
|
|||
elif account.type and account.type.payable:
|
||||
account_type = 'payable'
|
||||
|
||||
# records.append({
|
||||
# 'sequence': 1,
|
||||
# 'key': str(account),
|
||||
# 'account_code': account.code or '',
|
||||
# 'account_name': account.name or '',
|
||||
# 'account_type': account_type,
|
||||
# 'move_line_name': '###PREVIOUSBALANCE###',
|
||||
# 'ref': '-',
|
||||
# 'move_number': '-',
|
||||
# 'move_post_number': '-',
|
||||
# 'credit': credit,
|
||||
# 'debit': debit,
|
||||
# 'balance': balance,
|
||||
# 'previous_balance': (balance or _ZERO) + (credit or _ZERO) - (debit or _ZERO),
|
||||
# })
|
||||
|
||||
key = '%s %s' % (account.code, account.name)
|
||||
print(key)
|
||||
if records.get(key):
|
||||
records[key]['total_debit'] += debit
|
||||
records[key]['total_credit'] += credit
|
||||
|
@ -375,7 +347,6 @@ class GeneralLedgerReport(HTMLReport):
|
|||
records[key] = {
|
||||
'account': account.name,
|
||||
'code': account.code,
|
||||
# 'party': DualRecord(line.party) if line.party else None,
|
||||
'lines': [],
|
||||
'previous_balance': (balance + credit - debit),
|
||||
'total_debit': debit,
|
||||
|
@ -408,26 +379,8 @@ class GeneralLedgerReport(HTMLReport):
|
|||
credit = z.get('credit', Decimal(0))
|
||||
debit = z.get('debit', Decimal(0))
|
||||
balance = z.get('balance', Decimal(0))
|
||||
# rline = {
|
||||
# 'sequence': sequence,
|
||||
# 'key': str(currentKey),
|
||||
# 'account_code': account.code or '',
|
||||
# 'account_name': account.name or '',
|
||||
# 'account_type': account_type,
|
||||
# 'move_line_name': '###PREVIOUSBALANCE###',
|
||||
# 'ref': '-',
|
||||
# 'move_number': '-',
|
||||
# 'move_post_number': '-',
|
||||
# 'party_name': party.name,
|
||||
# 'credit': credit,
|
||||
# 'debit': debit,
|
||||
# 'balance': balance,
|
||||
# 'previous_balance': (balance + credit - debit),
|
||||
# }
|
||||
|
||||
key = _get_key(currentKey)
|
||||
print('account')
|
||||
print(key)
|
||||
if records.get(key):
|
||||
records[key]['total_debit'] += debit
|
||||
records[key]['total_credit'] += credit
|
||||
|
@ -436,25 +389,18 @@ class GeneralLedgerReport(HTMLReport):
|
|||
records[key] = {
|
||||
'account': account.name,
|
||||
'code': account.code,
|
||||
# 'party': DualRecord(line.party) if line.party else None,
|
||||
'lines': [],
|
||||
'previous_balance': (balance + credit - debit),
|
||||
'total_debit': debit,
|
||||
'total_credit': credit,
|
||||
'total_balance': balance,
|
||||
}
|
||||
# return records, parameters
|
||||
return collections.OrderedDict(sorted(records.items())), parameters
|
||||
|
||||
@classmethod
|
||||
def execute(cls, ids, data):
|
||||
#from timer import Timer
|
||||
|
||||
#t = Timer()
|
||||
|
||||
with Transaction().set_context(active_test=False):
|
||||
records, parameters = cls.prepare(data)
|
||||
#print('PREPARED', t)
|
||||
|
||||
context = Transaction().context
|
||||
context['report_lang'] = Transaction().language
|
||||
|
|
|
@ -200,7 +200,6 @@ class TaxesByInvoiceReport(HTMLReport):
|
|||
periods = []
|
||||
periods_subtitle = ''
|
||||
if data.get('periods'):
|
||||
print('PERIODS')
|
||||
periods = Period.browse(data.get('periods', []))
|
||||
periods_subtitle = []
|
||||
for x in periods:
|
||||
|
@ -285,14 +284,14 @@ class TaxesByInvoiceReport(HTMLReport):
|
|||
totals = {'total_total':0,'total_tax':0,'total_invoice':0}
|
||||
tax_totals = {}
|
||||
if data['grouping'] == 'invoice':
|
||||
periods = AccountInvoiceTax.search(domain,
|
||||
periods = AccountInvoiceTax.search(domain,
|
||||
order=[('invoice.move.period', 'ASC'),
|
||||
('invoice','ASC')])
|
||||
|
||||
for period in periods:
|
||||
records.setdefault(period.invoice.move.period, []).append(
|
||||
DualRecord(period))
|
||||
|
||||
|
||||
# With this we have the total for each tax (total base, total
|
||||
# amount and total)
|
||||
tax_totals.setdefault(period.invoice.move.period, {
|
||||
|
@ -314,19 +313,15 @@ class TaxesByInvoiceReport(HTMLReport):
|
|||
taxes = AccountInvoiceTax.search(domain, order=[('account', 'ASC'),
|
||||
('invoice','ASC')])
|
||||
|
||||
#print('DOMAIN ',domain)
|
||||
#print('LEN TAXES',len(taxes))
|
||||
|
||||
for tax in taxes:
|
||||
records.setdefault(tax.tax, []).append(DualRecord(tax))
|
||||
|
||||
# With this we have the total for each tax (total base, total
|
||||
# amount and total)
|
||||
tax_totals.setdefault(tax.tax, {'total_untaxed':0,
|
||||
'total_tax':0, 'total':0})
|
||||
tax_totals[tax.tax]['total_untaxed'] += tax.company_base
|
||||
tax_totals[tax.tax]['total_tax'] += tax.company_amount
|
||||
tax_totals[tax.tax]['total'] += (tax.company_base +
|
||||
tax_totals[tax.tax]['total'] += (tax.company_base +
|
||||
tax.company_amount)
|
||||
|
||||
parameters['tax_totals'] = tax_totals
|
||||
|
@ -334,12 +329,8 @@ class TaxesByInvoiceReport(HTMLReport):
|
|||
|
||||
@classmethod
|
||||
def execute(cls, ids, data):
|
||||
#from timer import Timer
|
||||
|
||||
#t = Timer()
|
||||
with Transaction().set_context(active_test=False):
|
||||
records, parameters = cls.prepare(data)
|
||||
#print('PREPARED', t)
|
||||
|
||||
context = Transaction().context
|
||||
context['report_lang'] = Transaction().language
|
||||
|
@ -366,4 +357,4 @@ class TaxesByInvoiceReport(HTMLReport):
|
|||
|
||||
|
||||
class TaxesByInvoiceAndPeriodReport(TaxesByInvoiceReport):
|
||||
__name__ = 'account_reports.taxes_by_invoice_and_period'
|
||||
__name__ = 'account_reports.taxes_by_invoice_and_period'
|
||||
|
|
Loading…
Reference in a new issue