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_report.xml b/addons/account/account_report.xml index 1ec5d25aa4f..e4f9ca21b02 100644 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -2,20 +2,20 @@ - - - + + + - + - + - + - + - + - + + + + + + + + diff --git a/addons/account/i18n/fr_FR.po b/addons/account/i18n/fr_FR.po index 2a888155ce6..c43dfd58cc7 100644 --- a/addons/account/i18n/fr_FR.po +++ b/addons/account/i18n/fr_FR.po @@ -237,7 +237,7 @@ msgstr "Taxes fournisseurs" #. module: account #: rml:account.vat.declaration:0 msgid "Tax Report" -msgstr "Déclaration TVA" +msgstr "Taxes Statement" #. module: account #: selection:account.tax.template,type:0 @@ -727,7 +727,7 @@ msgstr "Grand livre analytique" #. module: account #: model:ir.actions.wizard,name:account.wizard_vat_declaration msgid "VAT Declaration" -msgstr "Déclaration TVA" +msgstr "Taxes Statement" #. module: account #: model:ir.actions.act_window,name:account.report_account_analytic_journal_tree 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/general_ledger.py b/addons/account/report/general_ledger.py index 57a355f4f93..c27f3fcee24 100755 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -32,6 +32,7 @@ from report import report_sxw import xml import rml_parse import pooler +from osv import osv class general_ledger(rml_parse.rml_parse): _name = 'report.account.general.ledger' @@ -135,9 +136,12 @@ class general_ledger(rml_parse.rml_parse): for child_id in self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', [account.id])]): + child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) + sold_account = self._sum_solde_account(child_account,form) self.sold_accounts[child_account.id] = sold_account + if form['display_account'] == 'bal_mouvement': if child_account.type != 'view' \ and len(self.pool.get('account.move.line').search(self.cr, self.uid, @@ -163,7 +167,6 @@ class general_ledger(rml_parse.rml_parse): ## We will now compute solde initiaux - for move in res: SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'" @@ -188,7 +191,7 @@ class general_ledger(rml_parse.rml_parse): else: move.init_credit = 0 move.init_debit = 0 - + ## return res 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_voucher/report/invoice.py b/addons/account/wizard/wizard_general_journal.py old mode 100755 new mode 100644 similarity index 55% rename from addons/account_voucher/report/invoice.py rename to addons/account/wizard/wizard_general_journal.py index e041761bee6..5b72a944ea1 --- a/addons/account_voucher/report/invoice.py +++ b/addons/account/wizard/wizard_general_journal.py @@ -1,6 +1,9 @@ +# -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. +# 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 @@ -25,26 +28,33 @@ # ############################################################################## -import time -from report import report_sxw +import wizard +import pooler -class account_invoice_tax_retail(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(account_invoice_tax_retail, self).__init__(cr, uid, name, context) - self.localcontext.update({ - 'time': time, - 'title': self.getTitle, - }) - - def getTitle(self, invoice): - title = ''; - if invoice.retail_tax: - title = invoice.retail_tax[0].swapcase() + invoice.retail_tax[1:] - return title; +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: -report_sxw.report_sxw( - 'report.tax.retail.account.invoice', - 'account.invoice', - 'addons/india/account/report/invoice.rml', - parser=account_invoice_tax_retail, -) \ No newline at end of file diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py index a03162cf11d..0aa23c79ccb 100644 --- a/addons/account/wizard/wizard_general_ledger_report.py +++ b/addons/account/wizard/wizard_general_ledger_report.py @@ -68,11 +68,13 @@ period_form = '''
- +