diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 42efd14aa97..ec2b23ff07b 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -56,7 +56,7 @@ class account_move_line(osv.osv): where_move_lines_by_date = '' if context.get('date_from', False) and context.get('date_to', False): - if initital_bal: + if initial_bal: where_move_lines_by_date = " AND " +obj+".move_id in ( select id from account_move where date < '"+context['date_from']+"')" else: where_move_lines_by_date = " AND " +obj+".move_id in ( select id from account_move where date >= '" +context['date_from']+"' AND date <= '"+context['date_to']+"')" @@ -88,42 +88,6 @@ class account_move_line(osv.osv): query += company_clause - if context.get('period_manner','') == 'created': - #the query have to be build with no reference to periods but thanks to the creation date - if context.get('periods',False): - #if one or more period are given, use them - fiscalperiod_ids = fiscalperiod_obj.search(cr, uid, [('id','in',context['periods'])]) - else: - fiscalperiod_ids = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id','in',fiscalyear_ids)]) - - - - #remove from the old query the clause related to the period selection - res = '' - count = 1 - clause_list = query.split('AND') - ref_string = ' '+obj+'.period_id in' - for clause in clause_list: - if count != 1 and not clause.startswith(ref_string): - res += "AND" - if not clause.startswith(ref_string): - res += clause - count += 1 - - #add to 'res' a new clause containing the creation date criterion - count = 1 - res += " AND (" - periods = self.pool.get('account.period').read(cr, uid, p_ids, ['date_start','date_stop']) - for period in periods: - if count != 1: - res += " OR " - #creation date criterion: the creation date of the move_line has to be - # between the date_start and the date_stop of the selected periods - res += "("+obj+".create_date between to_date('" + period['date_start'] + "','yyyy-mm-dd') and to_date('" + period['date_stop'] + "','yyyy-mm-dd'))" - count += 1 - res += ")" - return res - return query def default_get(self, cr, uid, fields, context={}): diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py index ed5e5b144ef..b02b017be55 100644 --- a/addons/account/wizard/account_report_common.py +++ b/addons/account/wizard/account_report_common.py @@ -118,7 +118,8 @@ class account_common_report(osv.osv_memory): elif data['form']['filter'] == 'filter_period': if not data['form']['period_from'] or not data['form']['period_to']: raise osv.except_osv(_('Error'),_('Select a starting and an ending period')) - result['periods'] = period_obj.build_ctx_periods(cr, uid, data['form']['period_from'], data['form']['period_to']) + result['period_from'] = data['form']['period_from'] + result['period_to'] = data['form']['period_to'] return result def _print_report(self, cr, uid, ids, data, context=None):