~ss-dtic/openerp-costa-rica/6.1-purchase-import

« back to all changes in this revision

Viewing changes to l10n_cr_account_banking_reports/report/conciliation_bank.py

[MRG] Fix conciliation_bank. Add new changes for get the lines (used the new changes in account_webkit_report_library

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
 
145
145
        return res
146
146
 
147
 
    def get_bank_data(self, cr, uid, parent_account_id, filter_type, filter_data, fiscalyear, target_move, context=None):
 
147
    def get_bank_data(self, cr, uid, parent_account_id, filter_type, filter_data, fiscalyear, target_move, historic_strict, special_period, context=None):
148
148
        result_bank_balance = {}
149
149
        result_move_lines = []
150
150
        filters = {}
195
195
        debits_to_reconcile = 0.0
196
196
        accounting_total = 0.0
197
197
        bank_total = 0.0
198
 
        
199
 
        '''
200
 
        #Filters for the move lines to use in get_account_balance 
201
 
        filters['fiscalyear'] = fiscalyear.id
202
 
        if filter_type == 'filter_date':
203
 
            filters['date_from'] = filter_data[0] 
204
 
            filters['date_to'] = filter_data[1]
205
 
        elif filter_type == 'filter_period':
206
 
            periods_ids = self.pool.get('account.period').search(cr, uid, [('date_stop', '<=', filter_data[1].date_stop)])
207
 
            filters['periods'] = periods_ids 
208
 
        '''
209
 
        fiscal_year_id = fiscalyear.id
 
198
 
 
199
        if fiscalyear: 
 
200
            fiscal_year_id = fiscalyear.id
 
201
        else:
 
202
            fiscal_year_id = False
 
203
            
210
204
        if filter_type == 'filter_date':
211
205
            period_ids = False
212
 
            end_date = filter_data[1].id
 
206
            end_date = filter_data[1]
213
207
        elif filter_type == 'filter_period':
214
208
            period_ids = self.pool.get('account.period').search(cr, uid, [('date_stop', '<=', filter_data[1].date_stop)])
215
209
            end_date = False
266
260
        move_obj = self.pool.get('account.move')
267
261
        move_line_obj = self.pool.get('account.move.line')
268
262
        
269
 
        unreconciled_move_lines = account_webkit_report_library_obj.get_move_lines(cr, uid, transit_account_ids, filter_type=filter_type, filter_data=filter_data, fiscalyear=fiscalyear, target_move=target_move, unreconcile = True, context=context)
 
263
        """
 
264
            Cambio realizado el 9 de enero de 2012
 
265
            
 
266
            Anteriormente, el método get_move_lines (del objeto account.webkit.report.library, librería estándar de los reportes, 
 
267
            sólo se utilizaba en el reporte de Conciliación bancaria. El reporte de conciliación bancaria no recibe el período de inicio
 
268
            por lo que el método de get_move_lines no contempla el período de inicio, necesario en el reporte de saldo de cuenta de bancos.
 
269
            Se realiza el cambio tanto en el reporte de conciliación bancaria para que el período inicial no se tome en cuenta (inicializado en None)
 
270
            y en la librería se especifica que si se encuentra en None no lo tome en cuenta y que si trae información lo utilice dentro del filtro
 
271
            para sacar el rango de periodos que se digita en el wizard. 
 
272
            
 
273
            Se modifica tanto el reporte de conciliación bancaria, como la librería, para que el método funcione solamente con un período final o bien
 
274
            con un rango de períodos, como trabaja el reporte de saldo de cuenta de bancos. 
 
275
            
 
276
            Para el caso de las fechas, se trabaja de la misma forma. (El saldo de cuentas de bancos si toma la fecha de inicio)
 
277
            
 
278
            OBSERVACIÓN -> data['form']['historic_strict'],las variables boleanas (historic_strict y special_period) se deben pasar
 
279
            de esta forma, sino vienen como objetos y no con el valor real (True or False). Esto se hace desde el conciliation_bank.mako
 
280
            
 
281
        """
 
282
        filter_data[0] = None 
 
283
        unreconciled_move_lines = account_webkit_report_library_obj.get_move_lines(cr, uid, transit_account_ids, filter_type=filter_type, filter_data=filter_data, fiscalyear=fiscalyear, target_move=target_move, unreconcile = True, historic_strict=historic_strict, special_period=special_period, context=context)
270
284
        
271
285
        result_move_lines = {
272
286
            'credits_to_reconcile' :     [],
383
397
            'bank_total' : bank_total,
384
398
        }
385
399
        
 
400
        #special_period = historic_strict = False
 
401
        
386
402
        return result_bank_balance, result_move_lines, account_is_foreign
387
403
    
388
404
    def get_bank_account(self, cr, uid, data):