[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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -14,11 +14,8 @@
|
||||
<field name="move_id" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='amount']" position="after">
|
||||
<label for="amount_currency" groups="base.group_multi_currency"/>
|
||||
<div groups="base.group_multi_currency">
|
||||
<field name="amount_currency" class="oe_inline"/>
|
||||
<field name="currency_id" class="oe_inline"/>
|
||||
</div>
|
||||
<field name="company_currency_id" invisible="1"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_uom_id" class="oe_inline"/>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user