|  | @ -131,20 +131,26 @@ class ReportAgedPartnerBalance(models.AbstractModel): | 
			
		
	
		
		
			
				
					|  |  |             partner_id = line.partner_id.id or False |  |  |             partner_id = line.partner_id.id or False | 
			
		
	
		
		
			
				
					|  |  |             if partner_id not in undue_amounts: |  |  |             if partner_id not in undue_amounts: | 
			
		
	
		
		
			
				
					|  |  |                 undue_amounts[partner_id] = 0.0 |  |  |                 undue_amounts[partner_id] = 0.0 | 
			
		
	
		
		
			
				
					
					|  |  |             line_amount = ResCurrency._get_conversion_rate(line.company_id.currency_id, |  |  |             line_amount = ResCurrency._convert(line.balance, user_currency, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                                                user_currency, line.balance) |  |  |                                                line.company_id, date_from) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             if user_currency.is_zero(line_amount): |  |  |             if user_currency.is_zero(line_amount): | 
			
		
	
		
		
			
				
					|  |  |                 continue |  |  |                 continue | 
			
		
	
		
		
			
				
					|  |  |             for partial_line in line.matched_debit_ids: |  |  |             for partial_line in line.matched_debit_ids: | 
			
		
	
		
		
			
				
					|  |  |                 if partial_line.max_date <= date_from: |  |  |                 if partial_line.max_date <= date_from: | 
			
		
	
		
		
			
				
					
					|  |  |                     line_amount += ResCurrency._get_conversion_rate( |  |  |                     line_amount += ResCurrency._convert( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                         partial_line.company_id.currency_id, user_currency, |  |  |                         from_amount=partial_line.amount, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                         partial_line.amount) |  |  |                         to_currency=user_currency, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                         company=partial_line.company_id, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         date=date_from | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     ) | 
			
		
	
		
		
			
				
					|  |  |             for partial_line in line.matched_credit_ids: |  |  |             for partial_line in line.matched_credit_ids: | 
			
		
	
		
		
			
				
					|  |  |                 if partial_line.max_date <= date_from: |  |  |                 if partial_line.max_date <= date_from: | 
			
		
	
		
		
			
				
					
					|  |  |                     line_amount -= ResCurrency._get_conversion_rate( |  |  |                     line_amount -= ResCurrency._convert( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                         partial_line.company_id.currency_id, user_currency, |  |  |                         from_amount=partial_line.amount, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                         partial_line.amount) |  |  |                         to_currency=user_currency, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                         company=partial_line.company_id, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         date=date_from | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     ) | 
			
		
	
		
		
			
				
					|  |  |             if not self.env.company.currency_id.is_zero(line_amount): |  |  |             if not self.env.company.currency_id.is_zero(line_amount): | 
			
		
	
		
		
			
				
					|  |  |                 undue_amounts[partner_id] += line_amount |  |  |                 undue_amounts[partner_id] += line_amount | 
			
		
	
		
		
			
				
					|  |  |                 lines[partner_id].append({ |  |  |                 lines[partner_id].append({ | 
			
		
	
	
		
		
			
				
					|  | @ -159,7 +165,6 @@ class ReportAgedPartnerBalance(models.AbstractModel): | 
			
		
	
		
		
			
				
					|  |  |             args_list = ( |  |  |             args_list = ( | 
			
		
	
		
		
			
				
					|  |  |             tuple(move_state), tuple(account_type), tuple(partner_ids),) |  |  |             tuple(move_state), tuple(account_type), tuple(partner_ids),) | 
			
		
	
		
		
			
				
					|  |  |             dates_query = '(COALESCE(l.date_maturity,l.date)' |  |  |             dates_query = '(COALESCE(l.date_maturity,l.date)' | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             if periods[str(i)]['start'] and periods[str(i)]['stop']: |  |  |             if periods[str(i)]['start'] and periods[str(i)]['stop']: | 
			
		
	
		
		
			
				
					|  |  |                 dates_query += ' BETWEEN %s AND %s)' |  |  |                 dates_query += ' BETWEEN %s AND %s)' | 
			
		
	
		
		
			
				
					|  |  |                 args_list += ( |  |  |                 args_list += ( | 
			
		
	
	
		
		
			
				
					|  | @ -189,21 +194,30 @@ class ReportAgedPartnerBalance(models.AbstractModel): | 
			
		
	
		
		
			
				
					|  |  |                 partner_id = line.partner_id.id or False |  |  |                 partner_id = line.partner_id.id or False | 
			
		
	
		
		
			
				
					|  |  |                 if partner_id not in partners_amount: |  |  |                 if partner_id not in partners_amount: | 
			
		
	
		
		
			
				
					|  |  |                     partners_amount[partner_id] = 0.0 |  |  |                     partners_amount[partner_id] = 0.0 | 
			
		
	
		
		
			
				
					
					|  |  |                 line_amount = ResCurrency._get_conversion_rate( |  |  |                 line_amount = ResCurrency._convert( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                     line.company_id.currency_id, |  |  |                     from_amount=line.balance, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                                                    user_currency, line.balance) |  |  |                     to_currency=user_currency, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                     company=line.company_id, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     date=date_from | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 ) | 
			
		
	
		
		
			
				
					|  |  |                 if user_currency.is_zero(line_amount): |  |  |                 if user_currency.is_zero(line_amount): | 
			
		
	
		
		
			
				
					|  |  |                     continue |  |  |                     continue | 
			
		
	
		
		
			
				
					|  |  |                 for partial_line in line.matched_debit_ids: |  |  |                 for partial_line in line.matched_debit_ids: | 
			
		
	
		
		
			
				
					|  |  |                     if partial_line.max_date <= date_from: |  |  |                     if partial_line.max_date <= date_from: | 
			
		
	
		
		
			
				
					
					|  |  |                         line_amount += ResCurrency._get_conversion_rate( |  |  |                         line_amount += ResCurrency._convert( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                             partial_line.company_id.currency_id, user_currency, |  |  |                             from_amount=partial_line.amount, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                             partial_line.amount) |  |  |                             to_currency=user_currency, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                             company=partial_line.company_id, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             date=date_from | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         ) | 
			
		
	
		
		
			
				
					|  |  |                 for partial_line in line.matched_credit_ids: |  |  |                 for partial_line in line.matched_credit_ids: | 
			
		
	
		
		
			
				
					|  |  |                     if partial_line.max_date <= date_from: |  |  |                     if partial_line.max_date <= date_from: | 
			
		
	
		
		
			
				
					
					|  |  |                         line_amount -= ResCurrency._get_conversion_rate( |  |  |                         line_amount -= ResCurrency._convert( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                             partial_line.company_id.currency_id, user_currency, |  |  |                             from_amount=partial_line.amount, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                             partial_line.amount) |  |  |                             to_currency=user_currency, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                             company=partial_line.company_id, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                             date=date_from | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         ) | 
			
		
	
		
		
			
				
					|  |  |                 if not self.env.company.currency_id.is_zero( |  |  |                 if not self.env.company.currency_id.is_zero( | 
			
		
	
		
		
			
				
					|  |  |                         line_amount): |  |  |                         line_amount): | 
			
		
	
		
		
			
				
					|  |  |                     partners_amount[partner_id] += line_amount |  |  |                     partners_amount[partner_id] += line_amount | 
			
		
	
	
		
		
			
				
					|  | 
 |