Skip to content

Commit 75c907d

Browse files
committed
[ADD] account_invoice_move_currency: exchange rate on customer invoices
This commit adds a new module 'account_invoice_move_currency' that allows users to specify a custom exchange rate on customer invoices. The module introduces two new fields on the account.move model: 'user_secondary_currency_id' for selecting a secondary currency, and 'user_exchange_rate' for entering the exchange rate. The exchange rate field is automatically computed based on the selected secondary currency and the invoice date, but remains editable for user input.
1 parent deb7806 commit 75c907d

6 files changed

Lines changed: 190 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
.. |company| replace:: ADHOC SA
2+
3+
.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png
4+
:alt: ADHOC SA
5+
:target: https://www.adhoc.com.ar
6+
7+
.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png
8+
9+
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
10+
:target: https://www.gnu.org/licenses/agpl
11+
:alt: License: AGPL-3
12+
13+
==============================
14+
Account Invoice Move Currency
15+
==============================
16+
17+
This module adds an editable field for the user to report the exchange rate on customer invoices.
18+
19+
The module provides:
20+
21+
* A secondary currency field for informative purposes on invoices
22+
* An informative exchange rate field that displays the rate between the secondary currency and the company currency
23+
* These fields are automatically calculated but can be edited when the invoice is in draft state
24+
25+
The informative exchange rate helps users understand currency conversions at the time of the invoice without affecting the accounting entries.
26+
27+
Installation
28+
============
29+
30+
To install this module, you need to:
31+
32+
#. Install the module dependencies
33+
#. Install this module from Apps menu
34+
35+
Configuration
36+
=============
37+
38+
To configure this module, you need to:
39+
40+
#. No specific configuration needed
41+
#. Make sure you have the proper exchange rates configured in your system
42+
43+
Usage
44+
=====
45+
46+
To use this module, you need to:
47+
48+
#. Go to Accounting > Customers > Invoices (or Vendor Bills)
49+
#. Create or edit an invoice/bill in draft state
50+
#. When the invoice currency is different from the company currency, you will see:
51+
52+
* **Rate Currency**: Select a secondary currency for reference
53+
* **Informative Exchange Rate**: Shows the exchange rate (automatically calculated, but editable in draft)
54+
55+
#. The fields are visible only when:
56+
57+
* The invoice currency differs from the company currency
58+
* The move type is invoice or refund (customer/vendor)
59+
60+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
61+
:alt: Try me on Runbot
62+
:target: http://runbot.adhoc.com.ar/
63+
64+
Bug Tracker
65+
===========
66+
67+
Bugs are tracked on `GitHub Issues
68+
<https://github.com/ingadhoc/account-invoicing/issues>`_. In case of trouble, please
69+
check there if your issue has already been reported. If you spotted it first,
70+
help us smashing it by providing a detailed and welcomed feedback.
71+
72+
Credits
73+
=======
74+
75+
Images
76+
------
77+
78+
* ADHOC SA: `Icon <https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png>`__.
79+
80+
Contributors
81+
------------
82+
83+
Maintainer
84+
----------
85+
86+
.. image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png
87+
:alt: ADHOC SA
88+
:target: https://www.adhoc.com.ar
89+
90+
This module is maintained by the ADHOC SA.
91+
92+
To contribute to this module, please visit https://www.adhoc.com.ar.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
##############################################################################
2+
# For copyright and license notices, see __manifest__.py file in module root
3+
# directory
4+
##############################################################################
5+
6+
from . import models
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
##############################################################################
2+
#
3+
# Copyright (C) 2026 ADHOC SA (http://www.adhoc.com.ar)
4+
# All Rights Reserved.
5+
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Affero General Public License as
8+
# published by the Free Software Foundation, either version 3 of the
9+
# License, or (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Affero General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Affero General Public License
17+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
#
19+
##############################################################################
20+
{
21+
"name": "Account Invoice Move Currency",
22+
"version": "18.0.1.0.0",
23+
"category": "Technical",
24+
"author": "ADHOC SA",
25+
"website": "https://www.adhoc.com.ar",
26+
"license": "AGPL-3",
27+
"summary": "Adds an editable field for the user to report the exchange rate on customer invoices.",
28+
"depends": [
29+
"account_ux",
30+
],
31+
"data": [
32+
"views/account_move_view.xml",
33+
],
34+
"demo": [],
35+
"installable": True,
36+
"auto_install": False,
37+
"application": False,
38+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import account_move
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
##############################################################################
2+
# For copyright and license notices, see __manifest__.py file in module root
3+
# directory
4+
##############################################################################
5+
6+
from odoo import api, fields, models
7+
8+
9+
class AccountMove(models.Model):
10+
_inherit = "account.move"
11+
12+
user_exchange_rate = fields.Float(
13+
string="Informative Exchange Rate",
14+
help="Informative exchange rate value.",
15+
digits=(16, 2),
16+
compute="_compute_user_exchange_rate",
17+
store=True,
18+
)
19+
20+
user_secondary_currency_id = fields.Many2one(
21+
comodel_name="res.currency",
22+
string="Secondary Currency",
23+
)
24+
25+
@api.depends("user_secondary_currency_id", "invoice_date")
26+
def _compute_user_exchange_rate(self):
27+
for move in self:
28+
rate = False
29+
if move.user_secondary_currency_id and move.invoice_date:
30+
rate = move.user_secondary_currency_id._get_rates(move.company_id, move.invoice_date).get(
31+
move.user_secondary_currency_id.id
32+
)
33+
move.user_exchange_rate = 1 / rate
34+
else:
35+
move.user_exchange_rate = 1.0
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<odoo>
2+
<record id="view_move_form_inherit_user_exchange_rate" model="ir.ui.view">
3+
<field name="name">account.move.form.inherit.user.exchange.rate</field>
4+
<field name="model">account.move</field>
5+
<field name="inherit_id" ref="account.view_move_form"/>
6+
<field name="arch" type="xml">
7+
<xpath expr="//field[@name='l10n_latam_document_type_id']" position="before">
8+
<div class="d-flex align-items-center" invisible="currency_id != company_currency_id or move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')">
9+
<label for="user_secondary_currency_id" string="Rate Currency" class="oe_inline"/>
10+
<span class="mx-2"></span>
11+
<field name="user_secondary_currency_id" options="{'no_create': True, 'no_open': True}" class="oe_inline" widget="selection" readonly="state != 'draft'" domain="[('id', '!=', company_currency_id)]"/>
12+
<span class="mx-2" invisible="not user_secondary_currency_id">=</span>
13+
<field name="user_exchange_rate" class="oe_inline" widget="float" invisible="not user_secondary_currency_id" readonly="state != 'draft'" required="user_secondary_currency_id"/>
14+
</div>
15+
</xpath>
16+
</field>
17+
</record>
18+
</odoo>

0 commit comments

Comments
 (0)