Skip to content
Open
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
116 changes: 116 additions & 0 deletions base_multicompany_reporting_currency/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

====================================
Base Multicompany Reporting Currency
====================================

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

.. |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%2Fsale--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/sale-reporting/tree/19.0/base_multicompany_reporting_currency
:alt: OCA/sale-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-reporting-19-0/sale-reporting-19-0-base_multicompany_reporting_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/sale-reporting&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

In Odoo standard, when it comes to reporting in a multicompany and
multicurrency environment, it should be done on the invoices. (Cf Fabien
Pinckaers tweet: https://twitter.com/fpodoo/status/1511831215673913344)

Nonetheless, some companies do not use the Invoicing or Accounting app
in Odoo. For example, when using only CRM and Sales. With this module,
we introduce the concept of currency for reporting to be set in General
Settings. This way we can reuse the idea behind
https://github.com/OCA/sale-workflow/tree/10.0/sale_company_currency,
but with a predefined currency.

This module adds:

- a setting in General Settings to set multicompany reporting currency
which be applied to all companies
- a system parameter to store the chosen multicompany reporting
currency DB-wide
- a mixin model to inherit for handling all basic operations - eg:
automatically update the multicompany reporting currency on a model's
records when the settings change

Multicompany reporting currency field will be used in other dependent
modules to compare amounts in different companies and documents.

NB: This module does not provide any feature for specific apps. You
should install ``sale_multicompany_reporting_currency`` from
https://github.com/OCA/sale-reporting or
``crm_multicompany_reporting_currency`` from https://github.com/OCA/crm
to have additional Total (Multicompany Reporting Currency) fields on
specific apps.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-reporting/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/sale-reporting/issues/new?body=module:%20base_multicompany_reporting_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

Contributors
------------

- [Camptocamp SA](https://www.camptocamp.com):

- Maksym Yankin <maksym.yankin@camptocamp.com>
- Silvio Gregorini <silvio.gregorini@camptocamp.com>

- [APSL-Nagarro](https://apsl.tech):

- Antoni Marroig <amarroig@apsl.net>

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.

This module is part of the `OCA/sale-reporting <https://github.com/OCA/sale-reporting/tree/19.0/base_multicompany_reporting_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 base_multicompany_reporting_currency/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions base_multicompany_reporting_currency/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Base Multicompany Reporting Currency",
"summary": "Adds the possibility to specify Multicompany Reporting Currency",
"version": "19.0.1.0.0",
"category": "Sales",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
# Odoo
"base_setup",
],
"website": "https://github.com/OCA/sale-reporting",
"data": [
# Views
"views/res_config_settings.xml",
],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_multicompany_reporting_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: base_multicompany_reporting_currency
#: model:ir.model,name:base_multicompany_reporting_currency.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: base_multicompany_reporting_currency
#: model:ir.model.fields,field_description:base_multicompany_reporting_currency.field_res_config_settings__multicompany_reporting_currency
msgid "Multicompany Reporting Currency"
msgstr ""

#. module: base_multicompany_reporting_currency
#: model_terms:ir.ui.view,arch_db:base_multicompany_reporting_currency.res_config_settings_view_form
msgid "Set Multicompany Reporting Currency"
msgstr ""
32 changes: 32 additions & 0 deletions base_multicompany_reporting_currency/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_multicompany_reporting_currency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-06-23 14:08+0000\n"
"Last-Translator: eccit-quim <quim@eccit.com>\n"
"Language-Team: none\n"
"Language: ca\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: base_multicompany_reporting_currency
#: model:ir.model,name:base_multicompany_reporting_currency.model_res_config_settings
msgid "Config Settings"
msgstr "Paràmetres de configuració"

#. module: base_multicompany_reporting_currency
#: model:ir.model.fields,field_description:base_multicompany_reporting_currency.field_res_config_settings__multicompany_reporting_currency
msgid "Multicompany Reporting Currency"
msgstr "Moneda informes multicompanyia"

#. module: base_multicompany_reporting_currency
#: model_terms:ir.ui.view,arch_db:base_multicompany_reporting_currency.res_config_settings_view_form
msgid "Set Multicompany Reporting Currency"
msgstr "Estableix la moneda dels informes multicompanyia"
32 changes: 32 additions & 0 deletions base_multicompany_reporting_currency/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_multicompany_reporting_currency
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-12-01 09:31+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 5.10.4\n"

#. module: base_multicompany_reporting_currency
#: model:ir.model,name:base_multicompany_reporting_currency.model_res_config_settings
msgid "Config Settings"
msgstr "Impostazioni configurazione"

#. module: base_multicompany_reporting_currency
#: model:ir.model.fields,field_description:base_multicompany_reporting_currency.field_res_config_settings__multicompany_reporting_currency
msgid "Multicompany Reporting Currency"
msgstr "Valuta resoconto multi azienda"

#. module: base_multicompany_reporting_currency
#: model_terms:ir.ui.view,arch_db:base_multicompany_reporting_currency.res_config_settings_view_form
msgid "Set Multicompany Reporting Currency"
msgstr "Imposta valuta resoconto multi azienda"
3 changes: 3 additions & 0 deletions base_multicompany_reporting_currency/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import ir_config_parameter
from . import multicompany_reporting_currency_mixin
from . import res_config_settings
54 changes: 54 additions & 0 deletions base_multicompany_reporting_currency/models/ir_config_parameter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2026 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import api, models


class IrConfigParameter(models.Model):
_inherit = "ir.config_parameter"

@api.model
def _get_multicompany_reporting_currency_key(self) -> str:
return "base_multicompany_reporting_currency.multicompany_reporting_currency"

def init(self, force=False):
# OVERRIDE: if missing, create the system parameter for key
# ``base_multicompany_reporting_currency.multicompany_reporting_currency``
# (will be EUR by default)
res = super().init(force=force)
key = self._get_multicompany_reporting_currency_key()
if not self.search([("key", "=", key)]):
self.set_param(key, str(self.env.ref("base.EUR").id))
return res

@api.model_create_multi
def create(self, vals_list):
# OVERRIDE: recompute the multicompany reporting currency if needed
params = super().create(vals_list)
if params._check_multicompany_reporting_currency_needs_update():
self._update_multicompany_reporting_currency()
return params

def write(self, vals):
# OVERRIDE: recompute the multicompany reporting currency if needed
res = super().write(vals)
needs_update = self._check_multicompany_reporting_currency_needs_update()
if {"key", "value"}.intersection(vals) and needs_update:
self._update_multicompany_reporting_currency()
return res

def unlink(self):
# OVERRIDE: recompute the multicompany reporting currency if needed
needs_update = self._check_multicompany_reporting_currency_needs_update()
res = super().unlink()
if needs_update:
self._update_multicompany_reporting_currency()
return res

def _check_multicompany_reporting_currency_needs_update(self) -> bool:
return self._get_multicompany_reporting_currency_key() in self.mapped("key")

@api.model
def _update_multicompany_reporting_currency(self):
mixin = self.env["multicompany.reporting.currency.mixin"]
mixin._update_multicompany_reporting_currency()
Loading