Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions crm_lead_currency/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================
CRM Lead Currency
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:acc06c8991543c69a07f5523b155ec8720bb257ad2ad69ecebfdfe9048631d60
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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/19.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-19-0/crm-19-0-crm_lead_currency
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=19.0
:alt: Try me on Runboat

|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:

1. 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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_lead_currency%0Aversion:%2019.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 <thierry.ducrest@camptocamp.com>
- `APSL-Nagarro <https://apsl.tech>`__:

- Bernat Obrador <bobrador@apsl.net>

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

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/19.0/crm_lead_currency>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions crm_lead_currency/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions crm_lead_currency/__manifest__.py
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": "19.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,
}
34 changes: 34 additions & 0 deletions crm_lead_currency/i18n/crm_lead_currency.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_lead_currency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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,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 ""
37 changes: 37 additions & 0 deletions crm_lead_currency/i18n/es.po
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-Team: \n"
"Language: es\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"
46 changes: 46 additions & 0 deletions crm_lead_currency/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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 <stefano.consolaro@mymage.it>\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,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"

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"
1 change: 1 addition & 0 deletions crm_lead_currency/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import crm_lead
49 changes: 49 additions & 0 deletions crm_lead_currency/models/crm_lead.py
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
)
3 changes: 3 additions & 0 deletions crm_lead_currency/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions crm_lead_currency/readme/CONFIGURE.md
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.
6 changes: 6 additions & 0 deletions crm_lead_currency/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Thierry Ducrest \<<thierry.ducrest@camptocamp.com>\>
- [APSL-Nagarro](<https://apsl.tech>):
- Bernat Obrador \<<bobrador@apsl.net>\>
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia

6 changes: 6 additions & 0 deletions crm_lead_currency/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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.
1 change: 1 addition & 0 deletions crm_lead_currency/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Just install the module.
4 changes: 4 additions & 0 deletions crm_lead_currency/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To use this module, you need to:

1. Created a new opportunity in the CRM and set a customer currency on
it.
Binary file added crm_lead_currency/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading