Skip to content
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

[14.0] Purchase - Picking Count field or picking_count calculation very inefficient #66128

Open
aliomattux opened this issue Feb 14, 2021 · 1 comment
Labels
14.0 Logistics about stock, mrp, delivery, purchase

Comments

@aliomattux
Copy link

Impacted versions:
14.0
Steps to reproduce:
Delete the column purchase_order.picking_count in a database with 20k plus purchase orders
Current behavior:
New field is created and compute is called on each PO. The method iterates over each line item in a PO, selects all of the moves, then groups them by picking id
Expected behavior:
Suggestion: Wouldn't it be immensely easier/more efficient to just have a column purchase_id on stock.picking? Looping through all po lines and associated move lines is a very bad solution to calculate a parent field value.
Video/Screenshot link (optional):

Support ticket number submitted via odoo.com/help (optional):

@Yenthe666 Yenthe666 added 14.0 Logistics about stock, mrp, delivery, purchase labels Feb 15, 2021
@ryv-odoo
Copy link
Contributor

ryv-odoo commented Mar 16, 2021

Hello @aliomattux , Thank you for your report.
I have some remark/question about this:

New field is created and compute is called on each PO

Why the creation of a new field should trigger the compute_picking ? I don't get it.

The method iterates over each line item in a PO, selects all of the moves, then groups them by picking id

At first glance, it shouldn't be a issue with the prefetch and because the store compute should compute a lot (and not on all your DB.

Also, do you have py-flame about this compute, it can greatly help ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
14.0 Logistics about stock, mrp, delivery, purchase
Projects
None yet
Development

No branches or pull requests

3 participants