[18.0][REF] analytic_brand: make use of account analytic distribution models:#286
Conversation
|
Hi @sbejaoui, |
2e8bdd6 to
140dfb9
Compare
140dfb9 to
cfd61d2
Compare
|
Works well, unfortunately backporting this to 16.0 implies doing almost completely different modules (-- I have it working! https://github.com/flinq-ingenieria/brand/tree/16.0-analytic_brand-analytic_distribution_model-mle) as base methods differs too much |
|
This PR significantly improves the integration of brand with analytic accounting. In my humble opinion, the proposed approach is much closer to the functionality users actually expect. For version 16.0, I proposed a conservative migration that followed the previous behavior adapted to analytic distributions. What to do for version 17 is now up to the community to decide. |
| # Copyright 2025 ACSONE SA/NV | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
|
|
|
|
||
| brand_id = fields.Many2one( | ||
| "res.brand", | ||
| ondelete="cascade", |
There was a problem hiding this comment.
I'm not sure about that. Maybe restrict in this case, no ? And we archive brands instead
|
This PR has the |
Add brands as a dimension in account analytic distribution models, instead of defining the analytic distribution directly on the brand. This makes the code more standard, allowing to use the standard flow of analytic distribution models everywhere where they will be used.
…tion models: As brands are a dimension in account analytic distribution models, extend the methods of account.analytic.mixin to make it work for contracts
…on models on account moves
cfd61d2 to
096575f
Compare
AnizR
left a comment
There was a problem hiding this comment.
Code looks good to me.
But, I am a bit puzzled by the comment in sale_analytic_brand/models/sale_order_line.py:27, it is not optimal to call twice the _get_distribution (done once in the super) and if I do a patch on Odoo I won't need your module sale_analytic_brand, right?
096575f to
4e63285
Compare
…models on sale orders
4e63285 to
8f2f92d
Compare
Thanks for your comment. I've changed the comment in the code to be more explicit: The code I'm writing is improving the Odoo method by replacing the hardcoded dict by a method that allows to inject new values in this dict. |
|
/ocabot merge major |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at 62c89e8. Thanks a lot for contributing to OCA. ❤️ |
Add brands as a dimension in account analytic distribution models, instead of defining the analytic distribution directly on the brand. This makes the code more standard, allowing to use the standard flow of analytic distribution models everywhere where they will be used.
This PR contains several commits:
analytic_brandto include brands as a dimension in analytic distribution models. Include a migration script for existing analytic distributions defined on brands.contract_brandto make use of the standard analytic distribution models on contracts.account_analytic_brandto make use of the standard analytic distribution models on account moves.sale_analytic_brandto make use of the standard analytic distribution models on sale orders.