Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] crm_lead_currency: Migration to 18.0 #610

Open
wants to merge 25 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3de70ba
[IMP] rename module, fix manifest
gurneyalex May 13, 2019
a2ee48e
Fix lead company_currency not set (on create)
TDu May 14, 2019
42afbf1
[UPD] Update crm_lead_currency.pot
oca-travis Feb 28, 2022
64f7fad
[UPD] README.rst
OCA-git-bot Feb 28, 2022
07413b8
Apply dotfiles
hbrunn Nov 23, 2022
c7b02bd
crm_lead_currency 12.0.1.0.1
OCA-git-bot Dec 14, 2022
61a07a0
[IMP] crm_lead_currency: update indentation
Josesosa07 Apr 20, 2023
8e2f303
[IMP] crm_lead_currency: black, isort, prettier
Josesosa07 Apr 18, 2023
f4c0730
[MIG] crm_lead_currency: Migration to 14.0
Josesosa07 Apr 18, 2023
7b32978
[UPD] Update crm_lead_currency.pot
Apr 26, 2023
ec4196c
[UPD] README.rst
OCA-git-bot Apr 26, 2023
2b6ce40
[IMP] crm_lead_currency: show customer currency only for opportunities
Josesosa07 Apr 28, 2023
57a8851
crm_lead_currency 14.0.1.0.1
OCA-git-bot May 8, 2023
681a9a4
Added translation using Weblate (Italian)
mymage Jun 13, 2023
87cb108
Translated using Weblate (Italian)
mymage Jun 14, 2023
bb97191
[MIG] crm_lead_currency: Migration to 16.0
keylor2906 Jun 20, 2023
9d58c67
[UPD] Update crm_lead_currency.pot
Jun 22, 2023
bc9aa8b
[UPD] README.rst
OCA-git-bot Sep 3, 2023
901c062
Update translation files
weblate Oct 9, 2023
b19a944
[IMP] crm_lead_currency: pre-commit auto fixes
BernatObrador Jul 18, 2024
2d41915
[MIG] crm_lead_currency: Migration to 17.0
BernatObrador Jul 18, 2024
2e51892
[UPD] Update crm_lead_currency.pot
Jul 19, 2024
d0ed7df
[BOT] post-merge updates
OCA-git-bot Jul 19, 2024
9b646fc
[IMP] crm_lead_currency: pre-commit auto fixes
HeliconiaSolutions Nov 27, 2024
cf39ff0
[MIG] crm_lead_currency: Migration to 18.0
HeliconiaSolutions Nov 27, 2024
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
114 changes: 114 additions & 0 deletions crm_lead_currency/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
=================
CRM Lead Currency
=================

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

.. |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/18.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-18-0/crm-18-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=18.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:%2018.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]>
- `APSL-Nagarro <https://apsl.tech>`__:

- Bernat Obrador <[email protected]>

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

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/18.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": "18.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 17.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 <[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,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.
4 changes: 4 additions & 0 deletions crm_lead_currency/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Thierry Ducrest \<<[email protected]>\>
- [APSL-Nagarro](<https://apsl.tech>):
- Bernat Obrador \<<[email protected]>\>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_
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