-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
[17.0][MIG] procurement_mto_analytic #647
[17.0][MIG] procurement_mto_analytic #647
Conversation
… Stock analytic XML part is now migrated Add logo for generic modules
- migration point, put all the modules to not installable
This module allows the user to generate analytic information from stock moves. - Fixed flake8 and pylint errors.
Remove sale and purchase dependency. Add test Only assign analytic account if account != valuation acc Changing field name account_analytic_id Adjust to OCA latest guidelines. Add some usahe info on README
Remove remaining encoding hints. Correct lint in test Correct flake8 in test Fix documentation and test_flake8
Currently translated at 100.0% (2 of 2 strings) Translation: account-analytic-11.0/account-analytic-11.0-stock_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-11-0/account-analytic-11-0-stock_analytic/de/
Currently translated at 100.0% (2 of 2 strings) Translation: account-analytic-12.0/account-analytic-12.0-stock_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-stock_analytic/pt_BR/
Currently translated at 100.0% (2 of 2 strings) Translation: account-analytic-12.0/account-analytic-12.0-stock_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-stock_analytic/ca/
Currently translated at 100.0% (3 of 3 strings) Translation: account-analytic-12.0/account-analytic-12.0-stock_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-stock_analytic/hr/
Currently translated at 100.0% (4 of 4 strings) Translation: account-analytic-12.0/account-analytic-12.0-stock_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-stock_analytic/de/
Currently translated at 100.0% (4 of 4 strings) Translation: account-analytic-12.0/account-analytic-12.0-stock_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-stock_analytic/pt/
Currently translated at 100.0% (4 of 4 strings) Translation: account-analytic-12.0/account-analytic-12.0-stock_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-stock_analytic/es/
(cherry picked from commit 9255622)
Currently translated at 100.0% (3 of 3 strings) Translation: account-analytic-13.0/account-analytic-13.0-procurement_mto_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-procurement_mto_analytic/es/
Currently translated at 100.0% (3 of 3 strings) Translation: account-analytic-13.0/account-analytic-13.0-procurement_mto_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-procurement_mto_analytic/ca/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: account-analytic-15.0/account-analytic-15.0-procurement_mto_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-15-0/account-analytic-15-0-procurement_mto_analytic/
Currently translated at 100.0% (4 of 4 strings) Translation: account-analytic-15.0/account-analytic-15.0-procurement_mto_analytic Translate-URL: https://translation.odoo-community.org/projects/account-analytic-15-0/account-analytic-15-0-procurement_mto_analytic/es/
@aisopuro I noticed three points.
I created PR for this module for 16.0 migration. Can you you please review it and we make the design consistent? |
@AungKoKoLin1997 thanks for your review.
The method If I remove the Would it make more sense to split this module into 2 different modules, one for the "purchase services on sales" case, and the other for the "procure purchases for sold physical products" case?
In the previous version of this module, the extension of Analytic distributions are different in that they are basically sets of accounts, but I tried to emulate the previous logic as well as I could. Do you think we should change this behavior now so that this module doesn't care if lines with different analytics go on the same purchase? I'm not opposed to the idea. I'm not sure this module should have been doing that kind of thing before anyway. Ensuring that procurements with different analytic distributions don't get merged into the same line is enough. But I just want to make sure we're all aware of the change in logic this implies.
That does seem strange, I'll look into why that happens.
@yostashiro has added some comments to that PR, so I'm a little unclear which design I should emulate. After his comments you replaced the |
I think this is because of you removed extending
I failed to understand why we need to do it.
I was thinking to add an option for choosing this behavior in company record(separate PO for different analytic_distribution order line or use same PO). What do you think?
I created refactoring PR in Odoo repo for this odoo/odoo#161916. This will be forward ported when it gets merged. This refactoring is needed for holding multiple analytic distributions in one purchase order. |
Regarding your comments @AungKoKoLin1997 :
I disagree that
Right, which I did since it seemed redundant to implement the same logic twice: once in this module and another time in It seems a little strange to me that we would have a module in this repo whose explicit job it is to handle the propagation of analytics in stock procurements, and then not reuse that in this module. This might indicate that this module currently does too many things. In this repo we have separate, small modules for every other part of standard procurement when it comes to propagating analytics:
This module is the only one that bakes multiple different parts into a single module (sale to purchase, whether services or stockables). I didn't want to do it in the migration, but now with these concerns being raised, should we consider eliminating this module and replacing it with a simpler version that only looks at whether there is analytic distribution information in the procurement? Then if people want the analytics from sales to go to purchase, they just need to install
I meant this as a way to allow us to have the "purchase services directly"-logic without also needing to bring in stock-related dependencies. Even if we simplify the module, in core Odoo there is a distinction between purchasing services directly from sales and procuring the purchase of physical goods. These are different, independent features in core Odoo: you can use the first without using the second. It seems a shame to me that in order to get the analytics propagated in the first case, you would need to install stock modules even if you don't need them (this module would at least need to depend on So basically since the two parts are split into two different modules in core Odoo, it seems sensible to me that we would do the same here.
That could work. I'll see if I can find a proper place for it in the settings. The other option would be to have a setting on the procurement rule itself, but I think that becomes cumbersome to manage for the user, so your idea makes more sense.
Did you conclude it isn't sensible to try and detect whether a PO already contains a line with the same analytic distribution in the current setup? Your PR originally had one attempt to use a raw SQL query, and then yostashiro suggested instead doing it with a I'm mainly asking because I need this feature for a customer project, and I can't wait for Odoo to merge the change and forward port it. I might be able to think of a workaround for my project in the meantime though. For this PR, I can make it wait for that core PR as well. |
* Analytics are now tracked by distributions rather than just an account * Propagation of the analytics from the sale is now handled by sale_stock_analytic * Propagation of the analytics through stock is now handled by stock_analytic * Matching allowed POs and lines has changed, since analytic distributions are not as searchable as accounts (see models/stock_rule.py:_make_po_get_domain) Tests: * product.supplierinfo:name has (finally) been renamed to partner_id * Use Command instead of raw tuple syntax for clarity * analytic.account.account now requires plan_id * Refactor * Could no longer find any reference to a test_enabled context flag
83d210b
to
02699ca
Compare
@AungKoKoLin1997 regarding the part of your first comment I added a test that repeats your steps, but the test passes. I also can't replicate the issue through the UI. What I did:
Did you do anything in addition to what you described? Do you have any other modules installed besides There might be some interaction the unit test isn't catching. |
@aisopuro Sorry for late reply.
I disagree that. How is it worked by luck?
I still don't think we should depend on stock_analytic because we should avoid dependencies on modules that are not directly related to the current module. Otherwise, this can lead to unnecessary work and make the module more complex. In our case, we can just simply pass
No. In the first approach, I overthink and used raw sql query instead of
I understand your situation. I am trying to make the design more configuration and optimal for the users. What I am not comfortable with current design is we can't keep different
I will double check again. Thanks for the investigation. |
@AungKoKoLin1997 continuing the discussion:
But if this module in its readme says "Propagate the analytic information from the sale to the purchase", how can it not be directly related to a module that does exactly that? If the issue is that this module might not need that dependency in certain circumstances, I agree. But in that case I believe that Odoo's base logic has changed so much that this module should be split in two:
That way our purchase-related modules are much more similar to the other modules in this repo, and become a much more logical part of the whole in my opinion. The customer project that I mentioned is now shipped, and they use a separate, frozen branch with this code, so this can be updated as is best seen. However, that also means I will move on to other projects, and I suspect I will not have a lot of time to give to this. So if someone else comes along and needs/wants to continue where this discussion left off, feel free to open a replacing PR or link to patches. |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
The most notable change to the functionality is the way procurements avoid merging to existing purchases and purchase lines. I recommend reviewers pay particular attention to those parts of the code when reviewing, to make sure my logic and explanations are clear to everyone.
Depends on