diff --git a/addons/account/account_wizard.xml b/addons/account/account_wizard.xml
index 7be194e2f65..96a2c417739 100644
--- a/addons/account/account_wizard.xml
+++ b/addons/account/account_wizard.xml
@@ -86,6 +86,9 @@
+
+
+
diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py
index 5076fbaba87..11252b0707a 100644
--- a/addons/account/report/account_journal.py
+++ b/addons/account/report/account_journal.py
@@ -45,12 +45,28 @@ class journal_print(report_sxw.rml_parse):
'sum_credit': self._sum_credit
})
- def lines(self, period_id, journal_id, *args):
+ def lines(self, period_id, journal_id, sort_selection='date', *args):
+ 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:
+ self.cr.execute('update account_journal_period set state=%s where journal_id=%d and period_id=%d and state=%s', ('printed',journal,period,'draft'))
+ self.cr.commit()
+ self.cr.execute('select id from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\' order by ('+ sort_selection +'),id', (period, journal))
+ ids = map(lambda x: x[0], self.cr.fetchall())
+ ids_final.append(ids)
+ line_ids = []
+ for line_id in ids_final:
+ a = self.pool.get('account.move.line').browse(self.cr, self.uid, line_id )
+ line_ids.append(a)
+ return line_ids
self.cr.execute('update account_journal_period set state=%s where journal_id=%d and period_id=%d and state=%s', ('printed',journal_id,period_id,'draft'))
self.cr.commit()
self.cr.execute('select id from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\' order by date,id', (period_id, journal_id))
ids = map(lambda x: x[0], self.cr.fetchall())
- return self.pool.get('account.move.line').browse(self.cr, self.uid, ids)
+ return self.pool.get('account.move.line').browse(self.cr, self.uid, ids )
def _sum_debit(self, period_id, journal_id):
self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id))
@@ -60,7 +76,7 @@ class journal_print(report_sxw.rml_parse):
self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id))
return self.cr.fetchone()[0] or 0.0
report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print,header=False)
-
+report_sxw.report_sxw('report.account.journal.period.print.wiz', 'account.journal.period', 'addons/account/report/wizard_account_journal.rml', parser=journal_print,header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/wizard_account_journal.rml b/addons/account/report/wizard_account_journal.rml
new file mode 100644
index 00000000000..def6acbecb8
--- /dev/null
+++ b/addons/account/report/wizard_account_journal.rml
@@ -0,0 +1,191 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ company.name ]]
+ Print Journal - [[ company.currency_id.name ]]
+
+
+
+
+
+
+ [[ time.strftime("%Y-%m-%d %H:%M", time.localtime()) ]]
+ Page
+
+
+
+
+ 1cm 27.7cm 20cm 27.7cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ repeatIn(objects, 'o') ]]
+
+ [[repeatIn(lines(data['form']['period_id'][0][2],data['form']['journal_id'][0][2],data['form']['sort_selection']), 'line') ]]
+
+ |
+ Date
+ |
+
+ Voucher No
+ |
+
+ A/c No.
+ |
+
+ Third party
+ |
+
+ Entry label
+ |
+
+ Debit
+ |
+
+ Credit
+ |
+
+
+ |
+ [[line[0].period_id.name ]]
+ |
+
+ [[line[0].journal_id.code ]] |
+ |
+ |
+ |
+
+ [[ '%.2f' % sum_debit(line[0].period_id.id, line[0].journal_id.id) or '0.00' ]]
+ |
+
+ [[ '%.2f' % sum_credit(line[0].period_id.id, line[0].journal_id.id) or '0.00' ]]
+ |
+
+
+ [[repeatIn(line,'l')]]
+ |
+ [[ l.date ]]
+ |
+
+ [[ l.ref ]]
+ |
+
+ [[ l.account_id.code ]]
+ |
+
+ [[ l.partner_id and l.partner_id.name ]]
+ |
+
+ [[ l.name ]]
+ |
+
+ [[ l.debit and '%.2f' % l.debit or '0.00' ]]
+ |
+
+ [[ l.credit and '%.2f' % l.credit or '0.00' ]]
+ |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index 6ecd2040756..3cae8e78a95 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -64,6 +64,7 @@ import wizard_use_model
import wizard_state_open
import wizard_statement_from_invoice
+import wizard_print_journal
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/wizard_print_journal.py b/addons/account/wizard/wizard_print_journal.py
new file mode 100644
index 00000000000..d9440a8a231
--- /dev/null
+++ b/addons/account/wizard/wizard_print_journal.py
@@ -0,0 +1,71 @@
+# -*- 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},
+ 'sort_selection':{
+ 'string':"Entries Sorted By",
+ 'type':'selection',
+ 'selection':[('date','By date'),('ref','Reference Number')],
+ 'required':True,
+ 'default': lambda *a: 'date',
+ },
+
+}
+
+def print_journal(self, cr, uid, data, context):
+ return {}
+
+class wizard_print_journal(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('print', 'Print'))},
+ },
+ 'print': {
+ 'actions': [print_journal],
+ 'result': {'type':'print', 'report':'account.journal.period.print.wiz', 'state':'end'},
+ },
+ }
+wizard_print_journal('account.print.journal.report')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+