mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] account_payment_order: Fine-tune amount_company_currency SQL
This commit is contained in:
@@ -192,12 +192,13 @@ def populate_computed_fields(env):
|
||||
)
|
||||
FROM bank_payment_line bpl2
|
||||
INNER JOIN account_payment_line apl ON apl.bank_line_id = bpl2.id
|
||||
INNER JOIN account_move_line aml ON aml.id = apl.move_line_id
|
||||
LEFT JOIN currency_rate cr ON (
|
||||
cr.currency_id = apl.currency
|
||||
cr.currency_id = apl.currency_id
|
||||
AND cr.company_id = bpl2.company_id
|
||||
AND cr.date_start <= COALESCE(apl.date, now())
|
||||
AND cr.date_start <= COALESCE(apl.date, aml.date_maturity)
|
||||
AND (cr.date_end is null
|
||||
OR cr.date_end > COALESCE(apl.date, now()))
|
||||
OR cr.date_end > COALESCE(apl.date, aml.date_maturity)
|
||||
)
|
||||
WHERE bpl2.id = bpl.id
|
||||
""", (AsIs(env['res.currency']._select_companies_rates()), ),
|
||||
|
||||
Reference in New Issue
Block a user