Meera Trambadia (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-912623-mtr into 
lp:openobject-addons/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-912623-mtr/+merge/91403

account: added missing date on fiscalyear closure 
wizard(account.fiscalyear.close), backported from trunk addons revison:6379
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-912623-mtr/+merge/91403
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-912623-mtr.
=== modified file 'account/wizard/account_fiscalyear_close.py'
--- account/wizard/account_fiscalyear_close.py	2011-09-23 10:37:46 +0000
+++ account/wizard/account_fiscalyear_close.py	2012-02-03 10:16:21 +0000
@@ -102,16 +102,17 @@
             'name': '/',
             'ref': '',
             'period_id': period.id,
+            'date': period.date_start,
             'journal_id': new_journal.id,
         }
         move_id = obj_acc_move.create(cr, uid, vals, context=context)
 
         #1. report of the accounts with defferal method == 'unreconciled'
         cr.execute('''
-            SELECT a.id 
+            SELECT a.id
             FROM account_account a
             LEFT JOIN account_account_type t ON (a.user_type = t.id)
-            WHERE a.active 
+            WHERE a.active
               AND a.type != 'view'
               AND t.close_method = %s''', ('unreconciled', ))
         account_ids = map(lambda x: x[0], cr.fetchall())
@@ -122,16 +123,16 @@
                      name, create_uid, create_date, write_uid, write_date,
                      statement_id, journal_id, currency_id, date_maturity,
                      partner_id, blocked, credit, state, debit,
-                     ref, account_id, period_id, date, move_id, amount_currency, 
-                     quantity, product_id, company_id) 
+                     ref, account_id, period_id, date, move_id, amount_currency,
+                     quantity, product_id, company_id)
                   (SELECT name, create_uid, create_date, write_uid, write_date,
                      statement_id, %s,currency_id, date_maturity, partner_id,
                      blocked, credit, 'draft', debit, ref, account_id,
-                     %s, date, %s, amount_currency, quantity, product_id, company_id
+                     %s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id
                    FROM account_move_line
-                   WHERE account_id IN %s 
-                     AND ''' + query_line + ''' 
-                     AND reconcile_id IS NULL)''', (new_journal.id, period.id, move_id, tuple(account_ids),))
+                   WHERE account_id IN %s
+                     AND ''' + query_line + '''
+                     AND reconcile_id IS NULL)''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
 
             #We have also to consider all move_lines that were reconciled
             #on another fiscal year, and report them too
@@ -146,7 +147,7 @@
                      b.name, b.create_uid, b.create_date, b.write_uid, b.write_date,
                      b.statement_id, %s, b.currency_id, b.date_maturity,
                      b.partner_id, b.blocked, b.credit, 'draft', b.debit,
-                     b.ref, b.account_id, %s, b.date, %s, b.amount_currency,
+                     b.ref, b.account_id, %s, (%s) AS date, %s, b.amount_currency,
                      b.quantity, b.product_id, b.company_id
                      FROM account_move_line b
                      WHERE b.account_id IN %s
@@ -154,7 +155,7 @@
                        AND b.period_id IN ('''+fy_period_set+''')
                        AND b.reconcile_id IN (SELECT DISTINCT(reconcile_id)
                                           FROM account_move_line a
-                                          WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, move_id, tuple(account_ids),))
+                                          WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
 
         #2. report of the accounts with defferal method == 'detail'
         cr.execute('''
@@ -177,11 +178,11 @@
                   (SELECT name, create_uid, create_date, write_uid, write_date,
                      statement_id, %s,currency_id, date_maturity, partner_id,
                      blocked, credit, 'draft', debit, ref, account_id,
-                     %s, date, %s, amount_currency, quantity, product_id, company_id
+                     %s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id
                    FROM account_move_line
                    WHERE account_id IN %s
                      AND ''' + query_line + ''')
-                     ''', (new_journal.id, period.id, move_id, tuple(account_ids),))
+                     ''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
 
 
         #3. report of the accounts with defferal method == 'balance'
@@ -197,7 +198,7 @@
         query_1st_part = """
                 INSERT INTO account_move_line (
                      debit, credit, name, date, move_id, journal_id, period_id,
-                     account_id, currency_id, amount_currency, company_id, state) VALUES 
+                     account_id, currency_id, amount_currency, company_id, state) VALUES
         """
         query_2nd_part = ""
         query_2nd_part_args = []
@@ -207,7 +208,7 @@
                 cr.execute('SELECT sum(amount_currency) as balance_in_currency FROM account_move_line ' \
                         'WHERE account_id = %s ' \
                             'AND ' + query_line + ' ' \
-                            'AND currency_id = %s', (account.id, account.currency_id.id)) 
+                            'AND currency_id = %s', (account.id, account.currency_id.id))
                 balance_in_currency = cr.dictfetchone()['balance_in_currency']
 
             company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id

_______________________________________________
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