From 5aedbce4487856ddda80cd9ecf25de568e742b4f Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 4 Feb 2014 12:52:26 +0100 Subject: [PATCH] [FIX] account_analytic_analysis: currency were wrong when preparing recurring invoices The id of the sale pricelist of the customer was set as currency_id, instead of using the id of the currency of the pricelist. (Obviously) Furthermore, the currency of the contract pricelist takes the lead. Then, if none of these two are set, we choose the currency of the company, finally. bzr revid: dle@openerp.com-20140204115226-rowmbr5223fcu08k --- .../account_analytic_analysis.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index a0d14e889cb..b73dad2d385 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -664,13 +664,20 @@ class account_analytic_account(osv.osv): partner_payment_term = contract.partner_id.property_payment_term and contract.partner_id.property_payment_term.id or False + currency_id = False + if contract.pricelist_id: + currency_id = contract.pricelist_id.currency_id.id + elif contract.partner_id.property_product_pricelist: + currency_id = contract.partner_id.property_product_pricelist.currency_id.id + elif contract.company_id: + currency_id = contract.company_id.currency_id.id inv_data = { 'reference': contract.code or False, 'account_id': contract.partner_id.property_account_receivable.id, 'type': 'out_invoice', 'partner_id': contract.partner_id.id, - 'currency_id': contract.partner_id.property_product_pricelist.id or False, + 'currency_id': currency_id, 'journal_id': len(journal_ids) and journal_ids[0] or False, 'date_invoice': contract.recurring_next_date, 'origin': contract.name,