-
-
Notifications
You must be signed in to change notification settings - Fork 791
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
[12.0][IMP] purchase_landed_cost workflow #897
Conversation
It would desirable to have each improvement in a different PR, so the discussion can flow independently and direct things can be directly merged without waiting for the rest. Would you mind doing that way? |
Ok, I'll make 3 more PR so and let's talk about this one here. |
In a quick glance, yes, but that's why I want to discuss them by parts: for refining each separately. |
FYI @pedrobaeza I made a second PR about new variables names #901 Cc @rvalyi |
Following this idea to improve the purchase_landed_cost workflow, I add 3 commits in order to :
|
But why are you still adding more and more stuff to the same PR? This is becoming a difficult piece to be reviewable. It's advisable to put each change in a separate PR for being reviewed quickly those that are straight-forward, and retain those that not. This way, all are retained, and more because Travis is red. |
5a9f239
to
3bb1235
Compare
@pedrobaeza I've just corrected some old flake8 problems and now Travis is green. I'm sorry if this PR is quite long to be reviewed... By the way, I just added the migration script you asked on the other PR aiming to rename price variables : #901 I hope these 2 PR are now ready to be reviewed in your point of view. Let me know if I can improve other things. I'm still working on another PR aiming to improve the way to link invoice_lines to Cost Distribution Expenses. I'll publish it as soon as is will be ready. cc @rvalyi |
3bb1235
to
181fbbc
Compare
@pedrobaeza @rvalyi Thank you very much for your reviews ! ✨ |
Hi @clementmbr, I don't see the 'Show History' link in the product : I don't understand this result I did not go further in my tests : |
About all the state propagation, I have 2 doubts:
|
@pedrobaeza @tonygalmiche thank you very much for your interest ! @pedrobaeza , I think I don't understand what you are saying... This And once they are here I use also these fields to hide/display the "Landed Cost" and "Register Landed Cost" buttons too. Let me know if you think it could be possible to do this link between Cost Distributions and their related PO/pickings in a shorter way... |
OK about the reasoning of adding them, but not about the implementation. When I say "computed", I mean in the ORM sense of computed: a computed field with proper |
As this tutorial I shared with you was made for an Akretion client, the "Show history" is displayed with an Akretion module called product_usability : Sorry not to have mentioned it when we talked about it. This "Show history" button helps to visualize how the product's If you don't understand the meaning of these "Picking lines" columns maybe you will like my other PR that try to set more explicit names, not only for the variables used in the code but also for these columns titles : #901 But if I can help you understanding these names :
Is it clearer ? |
I'm sorry I think I still don't understand what do you mean by "the ORM sense of computed"... Or do you mean I should decorate this |
Thank you for this detailed answer but it's a storable product and that's why I don't understand this result : I just did a new test and I still have the same result |
@tonygalmiche then it's because your actual product cost ( See this documentation for more understanding. Anyway, I added this warning when you try to Update a product cost which has not an "Average Cost (AVCO)" cost method : You would have noticed it if you've tried to click on "Update Cost". |
Thank you @clementmbr for all these explanations. Everything works as indicated without anomaly. Very good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in terms of working, it's ok for me
Improve workflow for Cost Distribution creation. - Add a 'cost_distribution_ok' field on Purchase Orders and Pickings to differentiate those who must be linked to a Cost Distribution - Add a button to create a new Cost Distribution from Purchase Orders and pickings (when 'cost_distribution_ok' is True)
Filter Purchase Orders and Pickings by their related Cost Distribution state (with the filter 'Required Costs Dist.' if they are not related to any while they must be)
a70565a
to
8e01502
Compare
Allow to import Pickings in state "assigned" (or "done") into a draft Cost Distribution (with a blocking message if the user try to update products costs with still undone pickings).
Hide the Configuration option of the core module 'stock_landed_cost' in order to avoid the user to install both OCA 'purchase_landed_cost' and Oddo core module.
d4b16d3
to
8c800d8
Compare
- Rename "cost_lines" to "distrib_line_ids" - Rename "distribution_line" to "distrib_line_id" - Rename "imported_lines" to "distrib_line_ids" (as it refers to all the Cos distribution lines, that are not necessary imported, cf PR OCA#897 OCA#897 ) - Rename "affected_lines" to "affected_line_ids" - Rename "distribution" to "distrib_id" in both "purchase.cost.distribution.line" and "purchase.cost.distribution.expense" - Rename "distribution_expense" in "expense_id" ...With the proper migration script.
@clementmbr not sure but may be this is related to what @pedrobaeza was trying to explain you OCA/odoo-community.org#50 (comment) |
Well, my explanation is for v13 |
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. |
These 3 commits aim to improve the
purchase_landed_cost
workflow and fix small bugs.The basic idea is to add the possibility to create/open a Cost Distribution directly from the Purchase Order/Picking.
It adds a boolean on the PO and the Picking that allows the user to create/access the related Cost Distribution from there. It also adds an option on
res_partner
in order to pre-fill this boolean on PO and Pickings linked with some specified vendors :Beside that, the Fix helps linking Invoice Lines with Cost Distribution Expenses even when the user fill the
invoice_line
field directly from the Cost Distribution Expense o2m list without using the button "Import Invoice Line".What do you think about it @percevaq @pedrobaeza @cubells @ernestotejeda ?
Starting from here, I would like to open a discussion about renaming some variable names in order to be more meaningful and help users and other developers to understand how the module works.
For instance, objects from
'purchase.cost.distribution.line'
are called in too many different ways :cost_lines
in the modelpurchase.cost.distribution
distribution_line
in the modelpurchase.cost.distribution.line.expense
affected_lines
orimported_lines
in the modelpurchase.cost.distribution.expense
dist_line
when needed inside its own model.... while in fact they all refer to some kind of
stock.move
objects. Thus names likemoves
,distribution_move
,affected_moves
andimported_moves
would make more sense, wouldn't they ?But it may involve to rename the model
'purchase.cost.distribution.move'
and other modifications if you all agree with it.Another renaming work would be on these
'purchase.cost.distribution.line'
fields :standard_price_old
doesn't refer to what would be "the product's standard_price before the picking was done" as we can imagine, but refers to the Product move's purchase price (via his definition throughdist_line.move_id._get_price_unit()
).Thus it looks like a duplicate of the other field
product_price_unit
while the real information about "the product's standard_price before the picking was done" seems to be quite relevant to be calculated and displayed to the user.standard_price_new
doesn't refer to what would be the "new product's standard_price afther the cost update", but refer to the (sought-after) product's "Landed Cost".I would suggest to call it
landed_price_unit
if you agree.WIP in #901
Finally, it looks like some improvements are needed in the link between Cost Distribution's Expenses and their related Invoice Lines.
Firs of all I would suggest to rename the title "Supplier Invoice line" into something more relevant like "Expense Invoice line" to avoid confusions with the Invoice line linked to the purchase of the product we are updating the price.
Then, the button "Import from Pickings" in the Invoice form is not really obvious to use. Maybe a more explicit name like "Link Invoice Line to Cost Distribution Expense" would be better, imagining that it would display a wizard allowing to chose a real Cost Distribution Expense object and not a Stock Picking.
Thank you very much for your reading,
I hope you found these inputs interesting. Of course I am available to work on the suggestions I made if you agree with some of them and I'm opened to other ideas in order to improve this useful module.
cc @rvalyi