Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-578779-ado into 
lp:openobject-addons/6.1.

Requested reviews:
  Xavier ALT (OpenERP) (xal-openerp)
  Naresh(OpenERP) (nch-openerp)
Related bugs:
  Bug #1045424 in OpenERP Addons: "When opening an account from a chart of 
account, the move lines are not filtered"
  https://bugs.launchpad.net/openobject-addons/+bug/1045424

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578779-ado/+merge/123005

Hello,

[FIX] When opening an account(double click on link of account) from a chart of 
account the move lines are not filtered based on selected periods of chart of 
account wizard

Stpes:
1. Create a new DB with demo data and install the "account_accountant" module
2. Select the chart of account "France" (this bug is not specific to the French 
chart of account... but it's easier for to to describe the bug with it)
3. Activate extended view
4. Create a new customer invoice for Agrolait with 1 HDD1 product and validate 
it. It creates an account move in period 09/2012 with 3 account move lines with 
accounts 411100, 445711, 707100
5. Go to Accounting > Charts > Chart of Accounts
   Open a chart of accounts with :
   Fiscal year = 2012 (default)
   Target moves = All Posted entries (default)
   Start period = 10/2012
   End period = 12/2012
6. Open the hierarchy of accounts until you reach the account 707100. You see : 
Debit = 0, Credit = 0, Balance = 0 -> It's ok, because the only account move 
that we have is in the period 09/2012.
7. Double click on the account 707100 : you see the account move line 
corresponding to the product HDD1, which belongs to the period 09/2012
-> that's the bug : this view should only display the account move lines that 
belong to the period selected for the chart of accounts.

Regards,
Amit Dodiya

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578779-ado/+merge/123005
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-578779-ado.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2012-07-27 11:43:03 +0000
+++ account/account_move_line.py	2012-09-06 04:38:20 +0000
@@ -698,6 +698,14 @@
     # writeoff; entry generated for the difference between the lines
     #
     def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
+        if context is None:
+            context = {}
+        if context and context.get('periods', False):
+            args.append(('period_id', 'in', context.get('periods')))
+        elif context and context.get('fiscalyear', False):
+            periods = self.pool.get('account.fiscalyear').browse(cr, uid, context.get('fiscalyear'), context=context).period_ids
+            period_ids = [period.id for period in periods]
+            args.append(('period_id', 'in', period_ids))
         partner_domain = self._partner_domain(cr, uid, offset, context=context)
         if partner_domain is None:
             return []

_______________________________________________
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