[FIX] account: fix incorrect value for company_residual_signed on invoice + set invoice in the journal currency and not in euro
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
!record {model: account.invoice, id: demo_invoice_1}:
|
||||
company_id: base.main_company
|
||||
partner_id: base.res_partner_12
|
||||
currency_id: base.EUR
|
||||
user_id: base.user_demo
|
||||
reference_type: none
|
||||
payment_term_id: account.account_payment_term
|
||||
@@ -25,7 +24,6 @@
|
||||
!record {model: account.invoice, id: demo_invoice_2}:
|
||||
company_id: base.main_company
|
||||
partner_id: base.res_partner_2
|
||||
currency_id: base.EUR
|
||||
type: 'out_invoice'
|
||||
date_invoice: !eval time.strftime('%Y-%m')+'-08'
|
||||
invoice_line_ids:
|
||||
@@ -43,7 +41,6 @@
|
||||
!record {model: account.invoice, id: demo_invoice_3}:
|
||||
company_id: base.main_company
|
||||
partner_id: base.res_partner_2
|
||||
currency_id: base.EUR
|
||||
type: 'out_invoice'
|
||||
date_invoice: !eval time.strftime('%Y-%m')+'-08'
|
||||
invoice_line_ids:
|
||||
@@ -61,7 +58,6 @@
|
||||
!record {model: account.invoice, id: demo_invoice_invest_sale}:
|
||||
company_id: base.main_company
|
||||
partner_id: base.res_partner_3
|
||||
currency_id: base.EUR
|
||||
type: 'out_invoice'
|
||||
date_invoice: !eval time.strftime('%Y-%m')+'-08'
|
||||
-
|
||||
@@ -89,7 +85,6 @@
|
||||
!record {model: account.invoice, id: demo_invoice_0}:
|
||||
company_id: base.main_company
|
||||
partner_id: base.res_partner_12
|
||||
currency_id: base.EUR
|
||||
user_id: base.user_demo
|
||||
reference_type: none
|
||||
payment_term_id: account.account_payment_term
|
||||
@@ -110,7 +105,6 @@
|
||||
!record {model: account.invoice, id: demo_invoice_january_wages}:
|
||||
company_id: base.main_company
|
||||
partner_id: base.res_partner_12
|
||||
currency_id: base.EUR
|
||||
type: 'in_invoice'
|
||||
date_invoice: !eval time.strftime('%Y-%m')+'-01'
|
||||
-
|
||||
@@ -131,7 +125,6 @@
|
||||
!record {model: account.invoice, id: demo_invoice_equipment_purchase}:
|
||||
company_id: base.main_company
|
||||
partner_id: base.res_partner_1
|
||||
currency_id: base.EUR
|
||||
type: 'in_invoice'
|
||||
date_invoice: !eval time.strftime('%Y-%m')+'-15'
|
||||
-
|
||||
|
||||
@@ -87,13 +87,13 @@ class AccountInvoice(models.Model):
|
||||
sign = self.type in ['in_refund', 'out_refund'] and -1 or 1
|
||||
for line in self.sudo().move_id.line_ids:
|
||||
if line.account_id.internal_type in ('receivable', 'payable'):
|
||||
residual_company_signed += line.amount_residual * sign
|
||||
residual_company_signed += line.amount_residual
|
||||
if line.currency_id == self.currency_id:
|
||||
residual += line.amount_residual_currency if line.currency_id else line.amount_residual
|
||||
else:
|
||||
from_currency = (line.currency_id and line.currency_id.with_context(date=line.date)) or line.company_id.currency_id.with_context(date=line.date)
|
||||
residual += from_currency.compute(line.amount_residual, self.currency_id)
|
||||
self.residual_company_signed = residual_company_signed
|
||||
self.residual_company_signed = abs(residual_company_signed) * sign
|
||||
self.residual_signed = abs(residual) * sign
|
||||
self.residual = abs(residual)
|
||||
digits_rounding_precision = self.currency_id.rounding
|
||||
|
||||
Reference in New Issue
Block a user