Skip to content

Conversation

@ThiagoMForgeFlow
Copy link
Contributor

As mention in #838,

To respect the analytic distribution models defined by Odoo, a refactor is proposed for this module. In this way, analytic distribution models can be directly added, edited, or deleted from the form views of the respective Product or Product Category models.

Product variant form view:
2025-11-11_12-43

Product category form view
2025-11-11_12-44

With this change, the standard logic proposed by Odoo through the distribution models will be directly respected. In the previous version, the configurations set on a product or category were not merged with those defined in the distribution models.

alexis-via and others added 30 commits October 2, 2025 17:20
* OCA fixes
* Analytic account creating invoice lines
* Tests

product_analytic: Add Antiun to authors
… to the one _get_product_accounts() of the account module

product_analytic: add demo data
Add modules product_analytic_pos and product_analytic_purchase
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-11.0/account-analytic-11.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-11-0/account-analytic-11-0-product_analytic/ar/
Currently translated at 100,0% (5 of 5 strings)

Translation: account-analytic-11.0/account-analytic-11.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-11-0/account-analytic-11-0-product_analytic/ca/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-12.0/account-analytic-12.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-product_analytic/
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-12.0/account-analytic-12.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-product_analytic/pt_BR/
Currently translated at 60.0% (3 of 5 strings)

Translation: account-analytic-12.0/account-analytic-12.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-product_analytic/fi/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-13.0/account-analytic-13.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-product_analytic/
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-13.0/account-analytic-13.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-product_analytic/pt_BR/
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-13.0/account-analytic-13.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-product_analytic/ca/
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-13.0/account-analytic-13.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-product_analytic/es/
jaumeplanas and others added 15 commits October 2, 2025 17:20
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-16.0/account-analytic-16.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-product_analytic/ca/
The analytic distribution model serves to provide the analytic account.
Rely on this to collect the product analytic.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-16.0/account-analytic-16.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-product_analytic/
Currently translated at 100.0% (6 of 6 strings)

Translation: account-analytic-16.0/account-analytic-16.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-product_analytic/it/
UI can misbehave if `depends_context` is used on stored fields.
…and categories

To respect the analytic distribution models defined by Odoo, a refactor is proposed for this module. In this way, analytic distribution models can be directly added, edited, or deleted from the form views of the respective Product or Product Category models.
@bosd
Copy link

bosd commented Nov 14, 2025

To respect the analytic distribution models defined by Odoo, a refactor is proposed for this module. In this way, analytic distribution models can be directly added, edited, or deleted from the form views of the respective Product or Product Category models.

Product variant form view: 2025-11-11_12-43

How can you see this new view? I just tried a functional review on the runboat of this pr. But the view is not appearing.
(I enabled analytic accounting for the admin user.)

@ThiagoMForgeFlow
Copy link
Contributor Author

To respect the analytic distribution models defined by Odoo, a refactor is proposed for this module. In this way, analytic distribution models can be directly added, edited, or deleted from the form views of the respective Product or Product Category models.
Product variant form view: 2025-11-11_12-43

How can you see this new view? I just tried a functional review on the runboat of this pr. But the view is not appearing. (I enabled analytic accounting for the admin user.)

It’s placed inside the Accounting tab in the form view of the product variants. To be able to see this tab, you need to add the user to the Show Full Accounting Features group.

Copy link

@bosd bosd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ThiagoMForgeFlow
Copy link
Contributor Author

Hi @Saran440, What is your opinion on this refactoring proposal?

@matteonext
Copy link

matteonext commented Nov 25, 2025

Hi @ThiagoMForgeFlow, I just tried this module on the runboat, but I don't found any analytic account set on invoice:
image
image
Could you please let me know if I'm doing something wrong? Thanks
Edit: I tried setting analytic distribution on product category and there it works properly

@ThiagoMForgeFlow
Copy link
Contributor Author

Hi @matteonext, from what I can see in the images you shared, the product’s analytic distribution model has an account prefix “123”, and the account prefix of the Product Sales account is 400000. If this field has a value, they must match.

Also, just to mention: when there are two analytic distribution models that assign an analytic account from the same plan, Odoo only applies the first one according to the sequence.

Copy link

@matteonext matteonext left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matteonext
Copy link

Thanks @ThiagoMForgeFlow and sorry for bothering you. I just tried and it works!

Copy link
Member

@Saran440 Saran440 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional Test 👍

@Saran440
Copy link
Member

Saran440 commented Dec 9, 2025

FYI: Should we add analytic_distribution field to product.template?
Without using product variants, it can only be configured at the product category level.

@ThiagoMForgeFlow
Copy link
Contributor Author

FYI: Should we add analytic_distribution field to product.template? Without using product variants, it can only be configured at the product category level.

The analytic distribution models only contain the fields product.product and product.category. If we add the ability to edit them from the product.template form, we would need to add new logic to support this field in the analytic distribution models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.