1
# -*- encoding: utf-8 -*-
2
###################################################################################
4
# Dutch accounting module to generate reports.
5
# Copyright (C) 2010-2012 Neobis ICT Dienstverlening BV (<http://www.neobis.nl>)
7
# This program is free software: you can redistribute it and/or
8
# modify it under the terms of the GNU Affero General Public
9
# License as published by the Free Software Foundation, either
10
# version 3 of the License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public
18
# License along with this program. If not, see
19
# <http://www.gnu.org/licenses/>.
21
###################################################################################
22
from report import report_sxw
25
class report_nl_balance(report_sxw.rml_parse):
27
def __init__(self, cr, uid, name, context):
28
super(report_nl_balance, self).__init__(cr, uid, name, context)
29
self.selection_periods = []
32
self.acc_nl = self.pool.get('nl.accounts')
33
self.localcontext.update(
35
'assemble_data': self.assemble_data,
36
'get_date_from': self.get_date_from,
37
'get_date_to': self.get_date_to,
38
'sum_credit_func': self.sum_credit_func,
39
'sum_debit_func': self.sum_debit_func,
40
'get_acclines': self.get_acclines,
41
'get_difference': self.get_difference,
42
'get_period_names': self.get_period_names,
45
self.context = context
47
def get_period_names(self):
48
if not self.acc_nl.selection_periods:
51
period_obj = self.pool.get('account.period')
52
periods = period_obj.browse(self.cr, self.uid, self.selection_periods)
53
period_names = '%s t/m %s' % (periods[0].name, periods[-1].name)
57
def assemble_data(self, data):
58
self.acc_nl.assemble_data(self.cr, self.uid, data)
60
def get_acclines(self):
61
return self.acc_nl.get_acclines()
63
def get_date_from(self):
66
def get_date_to(self):
69
def sum_credit_func(self):
70
return self.acc_nl.sum_credit
72
def sum_debit_func(self):
73
return self.acc_nl.sum_debit
75
def get_difference(self):
76
return abs(self.acc_nl.sum_credit - self.acc_nl.sum_debit)
78
report_sxw.report_sxw(
81
'addons/nl_accounts/report/report_nl_balance.rml',
82
parser = report_nl_balance,