Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c29c7b9
- Add analytic brand module
sbejaoui Dec 30, 2019
5e0d213
- Add analytic_account_id field
sbejaoui Dec 30, 2019
948c442
- set the invoice line analytic account at brand change
sbejaoui Dec 30, 2019
79e9dde
Update analytic_brand.pot
oca-travis Oct 23, 2020
732b4e0
analytic_brand 12.0.1.0.1
OCA-git-bot Oct 23, 2020
ae32e20
- migration analytic_brand 13.0
sbejaoui Oct 23, 2020
bab42a2
Update analytic_brand.pot
oca-travis Oct 24, 2020
97c186b
Migarted analytic_brand module.
AmmarOfficewalaSerpentCS Jun 2, 2021
8739c7d
- analytic_brand
sbejaoui Mar 17, 2022
463dd00
Update analytic_brand.pot
Mar 18, 2022
54f5578
README.rst
OCA-git-bot Mar 18, 2022
ebdfe08
brand view in analytic_brand
BT-tkarpinski Jan 13, 2023
1d1f7a9
analytic_brand 15.0.1.0.1
OCA-git-bot Jan 26, 2023
ff45a39
README.rst
OCA-git-bot Sep 4, 2023
a3ac74d
Added translation using Weblate (Spanish)
Ivorra78 Feb 28, 2024
bafa3e5
Translated using Weblate (Spanish)
Ivorra78 Feb 28, 2024
8aac037
analytic_brand: black, isort, prettier
JasminSForgeFlow Jun 24, 2024
635ab23
analytic_brand: Migration to 17.0
JasminSForgeFlow Jun 24, 2024
eaf53f7
Update analytic_brand.pot
Jan 1, 2025
a04a864
post-merge updates
OCA-git-bot Jan 1, 2025
706f162
Added translation using Weblate (Italian)
mymage Jan 2, 2025
65cc8aa
Translated using Weblate (Italian)
mymage Jan 2, 2025
6906964
analytic_brand: Migration to 18.0
BhaveshHeliconia Feb 11, 2025
a47170b
analytic_brand: replace analytic account by analytic distribution
marielejeune Apr 15, 2025
768665f
Update analytic_brand.pot
Apr 24, 2025
d340ded
post-merge updates
OCA-git-bot Apr 24, 2025
0d33ffb
analytic_brand: Run tests in post-install:
marielejeune Jun 3, 2025
60e1413
Update analytic_brand.pot
Jul 29, 2025
1e803ae
post-merge updates
OCA-git-bot Jul 29, 2025
c8aa9b2
Update translation files
weblate Jul 29, 2025
26912ad
Translated using Weblate (Italian)
mymage Jul 30, 2025
2b3c2a7
Translated using Weblate (Spanish)
MRomeera Aug 7, 2025
121ba62
analytic_brand: make use of account analytic distribution models:
marielejeune Dec 18, 2025
f74efc2
Update analytic_brand.pot
Feb 26, 2026
bc8296a
post-merge updates
OCA-git-bot Feb 26, 2026
ec94525
Update translation files
weblate Feb 26, 2026
6c63f94
analytic_brand refactoring post-migration script: Create analytic dis…
marielejeune Feb 27, 2026
5493fe3
post-merge updates
OCA-git-bot Feb 27, 2026
06114b3
Translated using Weblate (Italian)
mymage Mar 2, 2026
c3b089a
Translated using Weblate (Spanish)
Ed-Spain Apr 20, 2026
f662a5c
Translated using Weblate (Spanish)
Ed-Spain Apr 22, 2026
c6181e4
Added translation using Weblate (Slovenian)
sysadminmatmoz Jun 22, 2026
60d6bc9
Translated using Weblate (Slovenian)
sysadminmatmoz Jun 22, 2026
b9012b4
[MIG] analytic_brand: Migration to 19.0
ManfredNelvin Jul 21, 2026
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
95 changes: 95 additions & 0 deletions analytic_brand/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==============
Analytic Brand
==============

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

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

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

This addon allows to define analytic distribution models using brands in
their domains.

**Table of contents**

.. contents::
:local:

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

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

* ACSONE SA/NV

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

- Souheil Bejaoui <souheil.bejaoui@acsone.eu>
- Ammar Officewala <aofficewala@opensourceintegrators.com>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

- Marie Lejeune <marie.lejeune@acsone.eu/>

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-sbejaoui| image:: https://github.com/sbejaoui.png?size=40px
:target: https://github.com/sbejaoui
:alt: sbejaoui

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sbejaoui|

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

{
"name": "Analytic Brand",
"summary": """
This addon allows to define analytic distribution models using
brands in their domains.""",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/brand",
"depends": ["analytic", "brand"],
"data": ["views/account_analytic_distribution_model.xml"],
"demo": [],
"maintainers": ["sbejaoui"],
"external_dependencies": {
"python": ["openupgradelib"],
},
}
32 changes: 32 additions & 0 deletions analytic_brand/i18n/analytic_brand.pot
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:
# * analytic_brand
#
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: analytic_brand
#: model:ir.model,name:analytic_brand.model_account_analytic_distribution_model
msgid "Analytic Distribution Model"
msgstr ""

#. module: analytic_brand
#: model:ir.model.fields,field_description:analytic_brand.field_account_analytic_distribution_model__brand_id
msgid "Brand"
msgstr ""

#. module: analytic_brand
#: model:ir.model.fields,help:analytic_brand.field_account_analytic_distribution_model__brand_id
msgid ""
"Select a brand for which the analytic distribution will be used (e.g. create"
" new customer invoice or Sales order linked to this brand, it will "
"automatically take this as an analytic account)"
msgstr ""
51 changes: 51 additions & 0 deletions analytic_brand/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * analytic_brand
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-04-22 14:45+0000\n"
"Last-Translator: Ed-Spain <eduamoros@gmail.com>\n"
"Language-Team: none\n"
"Language: es\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.15.2\n"

#. module: analytic_brand
#: model:ir.model,name:analytic_brand.model_account_analytic_distribution_model
msgid "Analytic Distribution Model"
msgstr "Modelo de Distribución Analítica"

#. module: analytic_brand
#: model:ir.model.fields,field_description:analytic_brand.field_account_analytic_distribution_model__brand_id
msgid "Brand"
msgstr "Marca"

#. module: analytic_brand
#: model:ir.model.fields,help:analytic_brand.field_account_analytic_distribution_model__brand_id
msgid ""
"Select a brand for which the analytic distribution will be used (e.g. create "
"new customer invoice or Sales order linked to this brand, it will "
"automatically take this as an analytic account)"
msgstr ""
"Selecciona una marca para la que se usará la distribución analítica. (Por "
"Ejemplo, al crear una nueva factura de cliente o un pedido de venta "
"vinculado a esa marca, se asignará automáticamente esta como cuenta "
"analítica.)"

#~ msgid "Analytic Distribution"
#~ msgstr "Distribución analítica"

#~ msgid "Analytic Precision"
#~ msgstr "Precisión analítica"

#~ msgid "Distribution Analytic Account"
#~ msgstr "Cuenta analítica de distribución"

#~ msgid "Analytic Account"
#~ msgstr "Cuenta Analítica"
51 changes: 51 additions & 0 deletions analytic_brand/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * analytic_brand
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-03-02 18:45+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.15.2\n"

#. module: analytic_brand
#: model:ir.model,name:analytic_brand.model_account_analytic_distribution_model
msgid "Analytic Distribution Model"
msgstr "Modello distribuzione analitica"

#. module: analytic_brand
#: model:ir.model.fields,field_description:analytic_brand.field_account_analytic_distribution_model__brand_id
msgid "Brand"
msgstr "Marca"

#. module: analytic_brand
#: model:ir.model.fields,help:analytic_brand.field_account_analytic_distribution_model__brand_id
msgid ""
"Select a brand for which the analytic distribution will be used (e.g. create "
"new customer invoice or Sales order linked to this brand, it will "
"automatically take this as an analytic account)"
msgstr ""
"Seleziona un marchio per il quale verrà utilizzata la distribuzione "
"analitica (ad esempio, crea una nuova fattura cliente o un ordine di vendita "
"collegato a questo marchio, che verrà automaticamente considerato come un "
"account analitico)"

#~ msgid "Analytic Distribution"
#~ msgstr "Distribuzione analitica"

#~ msgid "Analytic Precision"
#~ msgstr "Precisione analitica"

#~ msgid "Distribution Analytic Account"
#~ msgstr "Conto distribuzione analitica"

#~ msgid "Analytic Account"
#~ msgstr "Conto analitico"
40 changes: 40 additions & 0 deletions analytic_brand/i18n/sl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * analytic_brand
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2026-06-22 10:27+0000\n"
"Last-Translator: Matjaz Mozetic <matjaz@luxim.si>\n"
"Language-Team: none\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || "
"n%100==4 ? 2 : 3;\n"
"X-Generator: Weblate 5.15.2\n"

#. module: analytic_brand
#: model:ir.model,name:analytic_brand.model_account_analytic_distribution_model
msgid "Analytic Distribution Model"
msgstr "Model analitične porazdelitve"

#. module: analytic_brand
#: model:ir.model.fields,field_description:analytic_brand.field_account_analytic_distribution_model__brand_id
msgid "Brand"
msgstr "Blagovna znamka"

#. module: analytic_brand
#: model:ir.model.fields,help:analytic_brand.field_account_analytic_distribution_model__brand_id
msgid ""
"Select a brand for which the analytic distribution will be used (e.g. create"
" new customer invoice or Sales order linked to this brand, it will "
"automatically take this as an analytic account)"
msgstr ""
"Izberite blagovno znamko, za katero se bo uporabljala analitična "
"porazdelitev (npr. ob ustvarjanju novega računa za stranko ali prodajnega "
"naročila, povezanega s to blagovno znamko, se bo ta samodejno upoštevala kot "
"analitični račun)"
26 changes: 26 additions & 0 deletions analytic_brand/migrations/18.0.1.1.0/pre-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging

from openupgradelib import openupgrade

_logger = logging.getLogger(__name__)


@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE res_brand
ADD analytic_distribution jsonb;
""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE res_brand
SET analytic_distribution = jsonb_build_object(analytic_account_id, 100.0)
WHERE analytic_account_id IS NOT NULL;
""",
)
63 changes: 63 additions & 0 deletions analytic_brand/migrations/18.0.2.0.0/post-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging

from openupgradelib import openupgrade

_logger = logging.getLogger(__name__)


def _find_company_from_analytic_distribution(env, analytic_distribution):
# Take inspiration from Odoo method _compute_distribution_analytic_account_ids
# on analytic.mixin
account_ids = {int(_id) for key in analytic_distribution for _id in key.split(";")}
env.cr.execute(
"""
SELECT DISTINCT company_id
FROM account_analytic_account
WHERE id IN %(account_ids)s
""",
{
"account_ids": tuple(account_ids),
},
)
res = env.cr.fetchall()
if not res:
return False
if len(res) > 1:
_logger.error(
"Analytic distribution %s mixes accounts from several companies",
analytic_distribution,
)
return res[0][0]


@openupgrade.migrate()
def migrate(env, version):
_logger.info("Delete res.brand form view")
openupgrade.delete_records_safely_by_xml_id(
env, "analytic_brand.res_brand_form_view"
)
_logger.info("Create analytic distribution models for brands")
openupgrade.logged_query(
env.cr,
"""
SELECT id, analytic_distribution
FROM res_brand
WHERE analytic_distribution IS NOT NULL
""",
)
res = env.cr.fetchall()
vals_create = []
for brand_id, analytic_distribution in res:
company_id = _find_company_from_analytic_distribution(
env, analytic_distribution
)
vals_create.append(
{
"brand_id": brand_id,
"analytic_distribution": analytic_distribution,
"company_id": company_id,
}
)
env["account.analytic.distribution.model"].create(vals_create)
1 change: 1 addition & 0 deletions analytic_brand/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_analytic_distribution_model
Loading
Loading