diff --git a/addons/.project b/addons/.project deleted file mode 100644 index 8fc3cc934ff..00000000000 --- a/addons/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - pso-newaddons - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/addons/.pydevproject b/addons/.pydevproject deleted file mode 100644 index 78259a9c3db..00000000000 --- a/addons/.pydevproject +++ /dev/null @@ -1,6 +0,0 @@ - - - - -python 2.4 - diff --git a/addons/account/account_wizard.xml b/addons/account/account_wizard.xml index 2b7303c6454..70d63123a36 100644 --- a/addons/account/account_wizard.xml +++ b/addons/account/account_wizard.xml @@ -89,9 +89,16 @@ +<<<<<<< TREE + + +======= +>>>>>>> MERGE-SOURCE + + diff --git a/addons/account/report/general_journal.py b/addons/account/report/general_journal.py index 8899977e17a..621f870361c 100644 --- a/addons/account/report/general_journal.py +++ b/addons/account/report/general_journal.py @@ -66,38 +66,73 @@ class journal_print(report_sxw.rml_parse): return not res filtered_objs = filter(filter_unique, journal_period_objs) return map(lambda x: x.period_id, filtered_objs) - - def lines(self, period_id): + + def lines(self, period_id, journal_id=[]): + if type(period_id)==type([]): + ids_final = [] + for journal in journal_id: + for period in period_id: + ids_journal_period = self.pool.get('account.journal.period').search(self.cr,self.uid, [('journal_id','=',journal),('period_id','=',period)]) + if ids_journal_period: + ids_final.append(ids_journal_period[0]) + data_jour_period = self.pool.get('account.journal.period').browse(self.cr, self.uid, ids_final) + lines_data = [] + periods = [] + for data in data_jour_period: + if not data.period_id.id in periods: + periods.append(data.period_id.id) + for period in periods: + period_data = self.pool.get('account.period').browse(self.cr, self.uid, period) + self.cr.execute('select j.code, j.name, sum(l.debit) as debit, sum(l.credit) as credit from account_move_line l left join account_journal j on (l.journal_id=j.id) where period_id=%d and journal_id in (' + ','.join(map(str, journal_id)) + ') and l.state<>\'draft\' group by j.id, j.code, j.name', (period,)) + res = self.cr.dictfetchall() + res[0].update({'period_name':period_data.name}) + res[0].update({'pid':period}) + lines_data.append(res) + return lines_data if not self.journal_ids: return [] self.cr.execute('select j.code, j.name, sum(l.debit) as debit, sum(l.credit) as credit from account_move_line l left join account_journal j on (l.journal_id=j.id) where period_id=%d and journal_id in (' + self.journal_ids + ') and l.state<>\'draft\' group by j.id, j.code, j.name', (period_id,)) - return self.cr.dictfetchall() - - def _sum_debit_period(self, period_id): + res = self.cr.dictfetchall() + return res + + def _sum_debit_period(self, period_id,journal_id=None): + if type(journal_id)==type([]): + self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id in (' + ','.join(map(str, journal_id)) + ') and state<>\'draft\'', (period_id,)) + return self.cr.fetchone()[0] or 0.0 if not self.journal_ids: return 0.0 self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id in (' + self.journal_ids + ') and state<>\'draft\'', (period_id,)) + return self.cr.fetchone()[0] or 0.0 - - def _sum_credit_period(self, period_id): + + def _sum_credit_period(self, period_id,journal_id=None): + if type(journal_id)==type([]): + self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id in (' + ','.join(map(str, journal_id)) + ') and state<>\'draft\'', (period_id,)) + return self.cr.fetchone()[0] or 0.0 if not self.journal_ids: return 0.0 self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id in (' + self.journal_ids + ') and state<>\'draft\'', (period_id,)) return self.cr.fetchone()[0] or 0.0 - - def _sum_debit(self): + + def _sum_debit(self,period_id=None,journal_id=None): + if type(period_id)==type([]): + self.cr.execute('select sum(debit) from account_move_line where period_id in (' + ','.join(map(str, period_id)) + ') and journal_id in (' + ','.join(map(str, journal_id)) + ') and state<>\'draft\'') + return self.cr.fetchone()[0] or 0.0 if not self.journal_ids or not self.period_ids: return 0.0 self.cr.execute('select sum(debit) from account_move_line where period_id in (' + self.period_ids + ') and journal_id in (' + self.journal_ids + ') and state<>\'draft\'') return self.cr.fetchone()[0] or 0.0 - - def _sum_credit(self): + + def _sum_credit(self,period_id=None,journal_id=None): + if type(period_id)==type([]): + self.cr.execute('select sum(credit) from account_move_line where period_id in (' + ','.join(map(str, period_id)) + ') and journal_id in (' + ','.join(map(str, journal_id)) + ') and state<>\'draft\'') + return self.cr.fetchone()[0] or 0.0 if not self.journal_ids or not self.period_ids: return 0.0 self.cr.execute('select sum(credit) from account_move_line where period_id in (' + self.period_ids + ') and journal_id in (' + self.journal_ids + ') and state<>\'draft\'') return self.cr.fetchone()[0] or 0.0 report_sxw.report_sxw('report.account.general.journal', 'account.journal.period', 'addons/account/report/general_journal.rml',parser=journal_print, header=False) - +report_sxw.report_sxw('report.account.general.journal.wiz', 'account.journal.period', 'addons/account/report/wizard_general_journal.rml',parser=journal_print, header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/wizard_general_journal.rml b/addons/account/report/wizard_general_journal.rml new file mode 100644 index 00000000000..e61aa9b2267 --- /dev/null +++ b/addons/account/report/wizard_general_journal.rml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Printing Date : + + + [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] + + + + + + + + + +
+ + + + + Jrl Code + + + Journal Name + + + Period + + + Debit Trans. + + + Credit Trans. + + + + + + + + Total: + + + + + + + + + + + + + [[ '%.2f' % sum_debit(data['form']['period_id'][0][2],data['form']['journal_id'][0][2]) ]] + + + [[ '%.2f' % sum_credit(data['form']['period_id'][0][2],data['form']['journal_id'][0][2]) ]] + + + + + + + + + + [[ repeatIn( lines( data['form']['period_id'][0][2], data['form']['journal_id'][0][2] ),'line')]] + + + + [[ line[0]['period_name'] ]] : + + + + + + + + + + + + + [[ '%.2f' % sum_debit_period( line[0]['pid'],data['form']['journal_id'][0][2]) ]] + + + [[ '%.2f' % sum_credit_period(line[0]['pid'],data['form']['journal_id'][0][2]) ]] + + + + + + + + [[ repeatIn(line,'l') ]] + [[ l['code'] ]] + + + [[ l['name'] ]] + + + [[ line[0]['period_name'] ]] + + + [[ l['debit'] and ('%.2f' % l['debit']) or '' ]] + + + [[ l['credit'] and ('%.2f' % l['credit']) or '' ]] + + + + + + + + + +
+ + + +
+
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py index 5a434c54cd2..aa26e3f8e9d 100644 --- a/addons/account/wizard/__init__.py +++ b/addons/account/wizard/__init__.py @@ -66,6 +66,7 @@ import wizard_state_open import wizard_statement_from_invoice import wizard_print_journal import wizard_central_journal +import wizard_general_journal # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/wizard_central_journal.py b/addons/account/wizard/wizard_central_journal.py index 2c41ad252a5..db4002bc084 100644 --- a/addons/account/wizard/wizard_central_journal.py +++ b/addons/account/wizard/wizard_central_journal.py @@ -32,7 +32,7 @@ import wizard import pooler form = ''' -
+ ''' diff --git a/addons/account/wizard/wizard_general_journal.py b/addons/account/wizard/wizard_general_journal.py new file mode 100644 index 00000000000..5b72a944ea1 --- /dev/null +++ b/addons/account/wizard/wizard_general_journal.py @@ -0,0 +1,60 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import wizard +import pooler + +form = ''' +
+ + +''' + +fields = { + 'journal_id': {'string': 'Journal', 'type': 'many2many', 'relation': 'account.journal', 'required': True}, + 'period_id': {'string': 'Period', 'type': 'many2many', 'relation': 'account.period', 'required': True}, +} + + +class wizard_print_journal(wizard.interface): + states = { + 'init': { + 'actions': [], + 'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('print', 'Print'))}, + }, + 'print': { + 'actions': [], + 'result': {'type':'print', 'report':'account.general.journal.wiz', 'state':'end'}, + }, + } +wizard_print_journal('account.general.journal.report') + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +