From db638d8b3376aa56f56e1b3e46e615be50aaa440 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 8 Jan 2016 14:02:46 +0100 Subject: [PATCH] [FIX] account: currency in analytic line Once accounting is installed, the currency of the amount must be the currency of the company, while the amount currency contains amount in the original currency. opw-665821 --- addons/account/models/account_analytic_line.py | 3 +++ addons/account/views/account_analytic_view.xml | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/models/account_analytic_line.py b/addons/account/models/account_analytic_line.py index 6b8fcdc17aa..39ea202796c 100644 --- a/addons/account/models/account_analytic_line.py +++ b/addons/account/models/account_analytic_line.py @@ -8,6 +8,7 @@ class AccountAnalyticLine(models.Model): _description = 'Analytic Line' _order = 'date desc' + amount = fields.Monetary(currency_field='company_currency_id') product_uom_id = fields.Many2one('product.uom', string='Unit of Measure') product_id = fields.Many2one('product.product', string='Product') general_account_id = fields.Many2one('account.account', string='Financial Account', ondelete='restrict', @@ -15,6 +16,8 @@ class AccountAnalyticLine(models.Model): move_id = fields.Many2one('account.move.line', string='Move Line', ondelete='cascade', index=True) code = fields.Char(size=8) ref = fields.Char(string='Ref.') + company_currency_id = fields.Many2one('res.currency', related='company_id.currency_id', readonly=True, + help='Utility field to express amount currency') currency_id = fields.Many2one('res.currency', related='move_id.currency_id', string='Account Currency', store=True, help="The related account currency if not equal to the company one.", readonly=True) amount_currency = fields.Monetary(related='move_id.amount_currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True) partner_id = fields.Many2one('res.partner', related='account_id.partner_id', string='Partner', store=True, readonly=True) diff --git a/addons/account/views/account_analytic_view.xml b/addons/account/views/account_analytic_view.xml index 7964a693a09..ca0f4e13f7f 100644 --- a/addons/account/views/account_analytic_view.xml +++ b/addons/account/views/account_analytic_view.xml @@ -14,11 +14,8 @@ -