@@ -283,10 +283,19 @@ def _add_basic_values(self, vals, account):
283283 "account_id" : (account and account .id )
284284 or partner .property_account_payable_id .id ,
285285 "partner_id" : partner .id ,
286- "credit" : self .payment_amount ,
287286 "debit" : 0 ,
287+ "currency_id" : self .loan_id .currency_id .id ,
288+ "credit" : self .loan_id .journal_id .currency_id ._convert (
289+ from_amount = self .payment_amount ,
290+ to_currency = self .loan_id .company_id .currency_id ,
291+ company = self .loan_id .company_id ,
292+ date = self .date ,
293+ round = False ,
294+ ),
295+ "amount_currency" : - self .payment_amount ,
288296 }
289297 )
298+
290299 return vals
291300
292301 def _add_interests_values (self , vals ):
@@ -295,7 +304,15 @@ def _add_interests_values(self, vals):
295304 {
296305 "account_id" : self .loan_id .interest_expenses_account_id .id ,
297306 "credit" : 0 ,
298- "debit" : self .interests_amount ,
307+ "currency_id" : self .loan_id .currency_id .id ,
308+ "debit" : self .loan_id .journal_id .currency_id ._convert (
309+ from_amount = self .interests_amount ,
310+ to_currency = self .loan_id .company_id .currency_id ,
311+ company = self .loan_id .company_id ,
312+ date = self .date ,
313+ round = False ,
314+ ),
315+ "amount_currency" : self .interests_amount ,
299316 }
300317 )
301318 return vals
@@ -306,7 +323,15 @@ def _add_short_term_account_values(self, vals):
306323 {
307324 "account_id" : self .loan_id .short_term_loan_account_id .id ,
308325 "credit" : 0 ,
309- "debit" : self .payment_amount - self .interests_amount ,
326+ "currency_id" : self .loan_id .currency_id .id ,
327+ "debit" : self .loan_id .journal_id .currency_id ._convert (
328+ from_amount = self .payment_amount - self .interests_amount ,
329+ to_currency = self .loan_id .company_id .currency_id ,
330+ company = self .loan_id .company_id ,
331+ date = self .date ,
332+ round = False ,
333+ ),
334+ "amount_currency" : self .payment_amount - self .interests_amount ,
310335 }
311336 )
312337 return vals
@@ -317,15 +342,31 @@ def _add_long_term_account_values(self, vals):
317342 vals .append (
318343 {
319344 "account_id" : self .loan_id .short_term_loan_account_id .id ,
320- "credit" : self .long_term_principal_amount ,
321345 "debit" : 0 ,
346+ "currency_id" : self .loan_id .currency_id .id ,
347+ "credit" : self .loan_id .journal_id .currency_id ._convert (
348+ from_amount = self .long_term_principal_amount ,
349+ to_currency = self .loan_id .company_id .currency_id ,
350+ company = self .loan_id .company_id ,
351+ date = self .date ,
352+ round = False ,
353+ ),
354+ "amount_currency" : - self .long_term_principal_amount ,
322355 }
323356 )
324357 vals .append (
325358 {
326- "account_id" : self .long_term_loan_account_id .id ,
359+ "account_id" : self .loan_id . short_term_loan_account_id .id ,
327360 "credit" : 0 ,
328- "debit" : self .long_term_principal_amount ,
361+ "currency_id" : self .loan_id .currency_id .id ,
362+ "debit" : self .loan_id .journal_id .currency_id ._convert (
363+ from_amount = self .long_term_principal_amount ,
364+ to_currency = self .loan_id .company_id .currency_id ,
365+ company = self .loan_id .company_id ,
366+ date = self .date ,
367+ round = False ,
368+ ),
369+ "amount_currency" : self .long_term_principal_amount ,
329370 }
330371 )
331372 return vals
0 commit comments