1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
22 from openerp.osv import osv
24 class account_move_line_select(osv.osv_memory):
26 Account move line select
28 _name = "account.move.line.select"
29 _description = "Account move line select"
31 def open_window(self, cr, uid, ids, context=None):
32 mod_obj = self.pool.get('ir.model.data')
33 act_obj = self.pool.get('ir.actions.act_window')
34 account_obj = self.pool.get('account.account')
35 fiscalyear_obj = self.pool.get('account.fiscalyear')
40 if 'fiscalyear' not in context:
41 fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')])
43 fiscalyear_ids = [context['fiscalyear']]
45 fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids, context=context)
49 for fiscalyear in fiscalyears:
50 for period in fiscalyear.period_ids:
51 period_ids.append(period.id)
52 domain = str(('period_id', 'in', period_ids))
54 result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_tree1')
55 id = result and result[1] or False
56 result = act_obj.read(cr, uid, [id])[0]
59 'account_id': context['active_id'],
60 'active_id': context['active_id'],
63 if context['active_id']:
64 acc_data = account_obj.browse(cr, uid, context['active_id']).child_consol_ids
66 result['context'].update({'consolidate_children': True})
67 result['domain']=result['domain'][0:-1]+','+domain+result['domain'][-1]
71 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: