Nehal Panchal (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-account-improvements-nep into 
lp:openobject-addons/6.0.

Requested reviews:
  Jay Vora (OpenERP) (jvo-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-account-improvements-nep/+merge/70712

Hello ,

"Centralizing journals" Report prints double entry for account of the Journal.

Thank You.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-account-improvements-nep/+merge/70712
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-account-improvements-nep.
=== modified file 'account/report/account_central_journal.py'
--- account/report/account_central_journal.py	2011-01-14 00:11:01 +0000
+++ account/report/account_central_journal.py	2011-08-08 09:57:32 +0000
@@ -66,12 +66,18 @@
             self.period_ids, self.journal_ids = zip(*res)
         return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
 
-    def lines(self, period_id, journal_id):
+    def lines(self, period_id, journal_id, amount_currency):
         move_state = ['draft','posted']
         if self.target_move == 'posted':
             move_state = ['posted']
-
-        self.cr.execute('SELECT a.currency_id, a.code, a.name, c.symbol AS currency_code, l.currency_id, l.amount_currency, SUM(debit) AS debit, SUM(credit) AS credit  \
+        if not amount_currency:
+            self.cr.execute('SELECT a.code, a.name, SUM(debit) AS debit, SUM(credit) AS credit  \
+                        from account_move_line l  \
+                        LEFT JOIN account_move am ON (l.move_id=am.id) \
+                        LEFT JOIN account_account a ON (l.account_id=a.id) \
+                        LEFT JOIN res_currency c on (l.currency_id=c.id) WHERE am.state IN %s AND l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name', (tuple(move_state), period_id, journal_id))
+        else:
+            self.cr.execute('SELECT a.currency_id, a.code, a.name, c.symbol AS currency_code, l.currency_id, COALESCE(SUM(l.amount_currency),0.00) as amount_currency, SUM(debit) AS debit, SUM(credit) AS credit  \
                         from account_move_line l  \
                         LEFT JOIN account_move am ON (l.move_id=am.id) \
                         LEFT JOIN account_account a ON (l.account_id=a.id) \

=== modified file 'account/report/account_central_journal.rml'
--- account/report/account_central_journal.rml	2011-01-14 00:11:01 +0000
+++ account/report/account_central_journal.rml	2011-08-08 09:57:32 +0000
@@ -313,7 +313,7 @@
       </tr>
     </blockTable>
     <section>
-      <para style="terp_default_8">[[ repeatIn(lines(o.period_id.id,o.journal_id.id),'line') ]]</para>
+      <para style="terp_default_8">[[ repeatIn(lines(o.period_id.id,o.journal_id.id,data['form']['amount_currency']),'line') ]]</para>
       <blockTable colWidths="50.0,240.0,85.0,85.0,90.0" style="Table_Journal_Line_Content">[[ display_currency(data)  == False or removeParentNode('blockTable') ]]
         <tr>
           <td><para style="terp_default_9">[[ line['code'] ]]</para></td>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to