-
-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by luisg123v
- Loading branch information
Showing
20 changed files
with
874 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
================= | ||
CRM Lead Currency | ||
================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github | ||
:target: https://github.com/OCA/crm/tree/16.0/crm_lead_currency | ||
:alt: OCA/crm | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_lead_currency | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/111/16.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to select a specific currency for a lead or an opportunity. | ||
If the selected currency is different to the company currency, an amount in the customer | ||
currency can be set and the expected revenue of the opportunity will automatically be | ||
computed in the company currency. The default rate used for the computation is the rate | ||
of the day. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
Just install the module. | ||
|
||
Configuration | ||
============= | ||
|
||
No specific configuration is needed but multi-currency should be enabled for the module | ||
to make sense. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Created a new opportunity in the CRM and set a customer currency on it. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/crm/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_lead_currency%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Camptocamp SA | ||
* Vauxoo | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Thierry Ducrest <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
.. |maintainer-luisg123v| image:: https://github.com/luisg123v.png?size=40px | ||
:target: https://github.com/luisg123v | ||
:alt: luisg123v | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-luisg123v| | ||
|
||
This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/16.0/crm_lead_currency>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2019 Copyright 2019 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "CRM Lead Currency", | ||
"summary": """ | ||
On leads/opportunities, add the amount in the customer's currency.""", | ||
"maintainers": [ | ||
"luisg123v", | ||
], | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Camptocamp SA,Odoo Community Association (OCA),Vauxoo", | ||
"website": "https://github.com/OCA/crm", | ||
"depends": [ | ||
"crm", | ||
], | ||
"data": [ | ||
"views/crm_lead_views.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * crm_lead_currency | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__amount_customer_currency | ||
msgid "Customer amount" | ||
msgstr "" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__customer_currency_id | ||
msgid "Customer currency" | ||
msgstr "" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model,name:crm_lead_currency.model_crm_lead | ||
msgid "Lead/Opportunity" | ||
msgstr "" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__is_same_currency | ||
msgid "Same currency" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * crm_lead_currency | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-06-20 18:02+0000\n" | ||
"PO-Revision-Date: 2023-06-20 18:02+0000\n" | ||
"Last-Translator: \n" | ||
"Language: es\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__amount_customer_currency | ||
msgid "Customer amount" | ||
msgstr "Monto cliente" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__customer_currency_id | ||
msgid "Customer currency" | ||
msgstr "Moneda cliente" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model,name:crm_lead_currency.model_crm_lead | ||
msgid "Lead/Opportunity" | ||
msgstr "Iniciativa/Oportunidad" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__is_same_currency | ||
msgid "Same currency" | ||
msgstr "Misma moneda" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * crm_lead_currency | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-06-14 15:08+0000\n" | ||
"Last-Translator: mymage <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__amount_customer_currency | ||
msgid "Customer amount" | ||
msgstr "Valore cliente" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__customer_currency_id | ||
msgid "Customer currency" | ||
msgstr "Valuta cliente" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__display_name | ||
msgid "Display Name" | ||
msgstr "Nome visualizzato" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead____last_update | ||
msgid "Last Modified on" | ||
msgstr "Ultima modifica il" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model,name:crm_lead_currency.model_crm_lead | ||
msgid "Lead/Opportunity" | ||
msgstr "Contatto/Opportunità" | ||
|
||
#. module: crm_lead_currency | ||
#: model:ir.model.fields,field_description:crm_lead_currency.field_crm_lead__is_same_currency | ||
msgid "Same currency" | ||
msgstr "Stessa valuta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import crm_lead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2018 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class CrmLead(models.Model): | ||
_inherit = "crm.lead" | ||
|
||
customer_currency_id = fields.Many2one( | ||
string="Customer currency", | ||
comodel_name="res.currency", | ||
default=lambda self: self.env.company.currency_id, | ||
) | ||
amount_customer_currency = fields.Monetary( | ||
string="Customer amount", | ||
currency_field="customer_currency_id", | ||
) | ||
is_same_currency = fields.Boolean( | ||
string="Same currency", | ||
compute="_compute_is_same_currency", | ||
) | ||
|
||
@api.onchange("customer_currency_id", "amount_customer_currency") | ||
def _onchange_currency(self): | ||
self.expected_revenue = self.get_revenue_in_company_currency() | ||
|
||
def get_revenue_in_company_currency(self): | ||
"""Compute the expected revenue in the company currency. | ||
If the customer currency is different than the company currency, | ||
the expected revenue is computed in the company currency. | ||
""" | ||
self.ensure_one() | ||
if self.is_same_currency: | ||
return self.expected_revenue | ||
return self.customer_currency_id._convert( | ||
self.amount_customer_currency or 0, | ||
self.company_currency, | ||
self.env.company, | ||
fields.Datetime.now(), | ||
) | ||
|
||
@api.depends("customer_currency_id", "company_currency") | ||
def _compute_is_same_currency(self): | ||
for lead in self: | ||
lead.is_same_currency = lead.customer_currency_id == ( | ||
lead.company_currency or self.env.company.currency_id | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
No specific configuration is needed but multi-currency should be enabled for the module | ||
to make sense. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Thierry Ducrest <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This module allows to select a specific currency for a lead or an opportunity. | ||
If the selected currency is different to the company currency, an amount in the customer | ||
currency can be set and the expected revenue of the opportunity will automatically be | ||
computed in the company currency. The default rate used for the computation is the rate | ||
of the day. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Just install the module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
To use this module, you need to: | ||
|
||
#. Created a new opportunity in the CRM and set a customer currency on it. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.