Skip to content

Commit 4824c49

Browse files
committed
[ADD]sale-workflow:New fiel currency rate in sale
1 parent 0b84ffc commit 4824c49

17 files changed

+790
-0
lines changed

sale_order_currency_rate/README.rst

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
===========================
2+
Currency Rate in Sale Order
3+
===========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:3291877161bc090199e47ae42d1b2bd5dca0ef3aef0a1b7e59b52f9bb59dcb85
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_order_currency_rate
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_order_currency_rate
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows you to show the currency rate of a foreign currency in sale orders.
32+
You can define if you want to see the currency rate.
33+
Normal: Foreign currency to company currency.
34+
Inverse: Company currency to foreign currency.
35+
36+
**Table of contents**
37+
38+
.. contents::
39+
:local:
40+
41+
Usage
42+
=====
43+
44+
1. Go to Sales Configuration.
45+
2. Go to Quotations & Orders section.
46+
3. In show currency rate, select how do you want to see the currency rate.
47+
48+
Bug Tracker
49+
===========
50+
51+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
52+
In case of trouble, please check there if your issue has already been reported.
53+
If you spotted it first, help us to smash it by providing a detailed and welcomed
54+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_currency_rate%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
55+
56+
Do not contact contributors directly about support or help with technical issues.
57+
58+
Credits
59+
=======
60+
61+
Authors
62+
~~~~~~~
63+
64+
* Jarsa
65+
66+
Contributors
67+
~~~~~~~~~~~~
68+
69+
* Oscar Reyes <oscar.reyes@jarsa.com>
70+
71+
Maintainers
72+
~~~~~~~~~~~
73+
74+
This module is maintained by the OCA.
75+
76+
.. image:: https://odoo-community.org/logo.png
77+
:alt: Odoo Community Association
78+
:target: https://odoo-community.org
79+
80+
OCA, or the Odoo Community Association, is a nonprofit organization whose
81+
mission is to support the collaborative development of Odoo features and
82+
promote its widespread use.
83+
84+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_order_currency_rate>`_ project on GitHub.
85+
86+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

sale_order_currency_rate/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2023 Jarsa
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
from . import models
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2023 Jarsa
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
{
5+
"name": "Currency Rate in Sale Order",
6+
"version": "16.0.1.0.0",
7+
"category": "Sales Management",
8+
"website": "https://github.com/OCA/sale-workflow",
9+
"author": "Jarsa, Odoo Community Association (OCA)",
10+
"license": "LGPL-3",
11+
"depends": ["sale"],
12+
"data": [
13+
"data/decimal_precision_data.xml",
14+
"views/sale_order.xml",
15+
"views/res_config_settings.xml",
16+
],
17+
"installable": True,
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo noupdate="1">
3+
<record id="currency_rate_precision" model="decimal.precision">
4+
<field name="name">Currency Rate Precision</field>
5+
<field name="digits">6</field>
6+
</record>
7+
</odoo>
+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_currency_rate
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0+e\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2023-08-16 22:05+0000\n"
10+
"PO-Revision-Date: 2023-08-16 22:05+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: sale_order_currency_rate
19+
#: model_terms:ir.ui.view,arch_db:sale_order_currency_rate.res_config_settings_view
20+
msgid "<span class=\"o_form_label\">Show Currency Rate</span>"
21+
msgstr "<span class=\"o_form_label\">Mostrar tipo de cambio</span>"
22+
23+
#. module: sale_order_currency_rate
24+
#: model:ir.model.fields.selection,name:sale_order_currency_rate.selection__res_company__sale_show_currency_rate__both
25+
msgid "Both"
26+
msgstr "Ambos"
27+
28+
#. module: sale_order_currency_rate
29+
#: model:ir.model,name:sale_order_currency_rate.model_res_company
30+
msgid "Companies"
31+
msgstr "Empresas"
32+
33+
#. module: sale_order_currency_rate
34+
#: model:ir.model,name:sale_order_currency_rate.model_res_config_settings
35+
msgid "Config Settings"
36+
msgstr "Ajustes de configuración"
37+
38+
#. module: sale_order_currency_rate
39+
#: model:ir.model.fields,field_description:sale_order_currency_rate.field_sale_order__currency_rate
40+
msgid "Currency Rate"
41+
msgstr "Tipo de cambio"
42+
43+
#. module: sale_order_currency_rate
44+
#: model:ir.model.fields.selection,name:sale_order_currency_rate.selection__res_company__sale_show_currency_rate__inverse
45+
msgid "Inverse"
46+
msgstr "Inverso"
47+
48+
#. module: sale_order_currency_rate
49+
#: model:ir.model.fields,field_description:sale_order_currency_rate.field_sale_order__inverse_currency_rate
50+
msgid "Inverse Currency Rate"
51+
msgstr "Tipo de Cambio Inverso"
52+
53+
#. module: sale_order_currency_rate
54+
#: model:ir.model.fields.selection,name:sale_order_currency_rate.selection__res_company__sale_show_currency_rate__no
55+
msgid "No"
56+
msgstr "No"
57+
58+
#. module: sale_order_currency_rate
59+
#: model:ir.model.fields.selection,name:sale_order_currency_rate.selection__res_company__sale_show_currency_rate__normal
60+
msgid "Normal"
61+
msgstr "Normal"
62+
63+
#. module: sale_order_currency_rate
64+
#: model:ir.model,name:sale_order_currency_rate.model_sale_order
65+
msgid "Sales Order"
66+
msgstr "Orden de venta"
67+
68+
#. module: sale_order_currency_rate
69+
#: model_terms:ir.ui.view,arch_db:sale_order_currency_rate.res_config_settings_view
70+
msgid ""
71+
"Select how to show exchange rate in sale orders.<br/>\n"
72+
" <b>No:</b> Don't show the exchange rate.<br/>\n"
73+
" <b>Normal:</b> Foreing currency to company currency.<br/>\n"
74+
" <b>Inverse:</b> Company currency to foreign currency.<br/>\n"
75+
" <b>Both:</b> Show both currency rates."
76+
msgstr ""
77+
"Selecciona como mostrar el tipo de cambio en pedido de venta.<br/>\n"
78+
" <b>No:</b> No muestra el tipo de cambio.<br/>\n"
79+
" <b>Normal:</b> Moneda extranjera a moneda de la empresa.<br/>\n"
80+
" <b>Inverso:</b> Moneda de la empresa a moneda extranjera.<br/>\n"
81+
" <b>Ambos:</b> Muestra ambos tipos de cambios."
82+
83+
#. module: sale_order_currency_rate
84+
#: model:ir.model.fields,field_description:sale_order_currency_rate.field_res_company__sale_show_currency_rate
85+
#: model:ir.model.fields,field_description:sale_order_currency_rate.field_res_config_settings__sale_show_currency_rate
86+
#: model:ir.model.fields,field_description:sale_order_currency_rate.field_sale_order__sale_show_currency_rate
87+
msgid "Show Currency Rate"
88+
msgstr "Mostrar tipo de cambio"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright 2023 Jarsa
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
5+
from . import sale_order
6+
from . import res_company
7+
from . import res_config_settings
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2023 Jarsa
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResCompany(models.Model):
8+
_inherit = "res.company"
9+
10+
sale_show_currency_rate = fields.Selection(
11+
[
12+
("no", "No"),
13+
("normal", "Normal"),
14+
("inverse", "Inverse"),
15+
("both", "Both"),
16+
],
17+
string="Show Currency Rate",
18+
default="normal",
19+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2023 Jarsa
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResConfigSettings(models.TransientModel):
8+
_inherit = "res.config.settings"
9+
10+
sale_show_currency_rate = fields.Selection(
11+
related="company_id.sale_show_currency_rate",
12+
readonly=False,
13+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2023 Jarsa
2+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class SaleOrder(models.Model):
8+
_inherit = "sale.order"
9+
10+
currency_rate = fields.Float(
11+
compute="_compute_currency_rate",
12+
digits="Currency Rate Precision",
13+
)
14+
15+
inverse_currency_rate = fields.Float(
16+
compute="_compute_currency_rate",
17+
digits="Currency Rate Precision",
18+
)
19+
20+
sale_show_currency_rate = fields.Selection(
21+
string="Show Currency Rate",
22+
related="company_id.sale_show_currency_rate",
23+
)
24+
25+
@api.depends("currency_id", "company_id.currency_id")
26+
def _compute_currency_rate(self):
27+
for order in self:
28+
if order.currency_id != order.company_id.currency_id:
29+
order.currency_rate = order.currency_id._convert(
30+
1.0,
31+
order.company_id.currency_id,
32+
order.company_id,
33+
order.date_order,
34+
round=False,
35+
)
36+
order.inverse_currency_rate = order.company_id.currency_id._convert(
37+
1.0,
38+
order.currency_id,
39+
order.company_id,
40+
order.date_order,
41+
round=False,
42+
)
43+
else:
44+
order.currency_rate = 1.0
45+
order.inverse_currency_rate = 1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Oscar Reyes <oscar.reyes@jarsa.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This module allows you to show the currency rate of a foreign currency in sale orders.
2+
You can define if you want to see the currency rate.
3+
Normal: Foreign currency to company currency.
4+
Inverse: Company currency to foreign currency.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1. Go to Sales Configuration.
2+
2. Go to Quotations & Orders section.
3+
3. In show currency rate, select how do you want to see the currency rate.

0 commit comments

Comments
 (0)