OCA / operating-unit

Manage Operating Units in Odoo
GNU Affero General Public License v3.0
73 stars 240 forks source link

[13.0][FIX] sale_operating_unit: fix perfomance issues in sale order #510

Closed alan196 closed 1 year ago

alan196 commented 2 years ago

This PR makes the field operating_unit_id stored in sale order line model.

This is required because it causes performance issues in databases with large number of sale.order records.

Without this change, if you open a sale order record with a database with 1 million records, it takes 20 seconds to open the sale.order.

With this change, it takes less than 1 second.

alan196 commented 2 years ago

@LoisRForgeFlow

AaronHForgeFlow commented 2 years ago

Ok for me. Can you see why travis is failing? and also, is it possible to add a migration script so the column is filled more quickly?

github-actions[bot] commented 1 year ago

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. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

alan196 commented 1 year ago

@nhomar @moylop260 Could you help me to review this PR 🙏

AaronHForgeFlow commented 1 year ago

Hi @alan196 , when you apply this change to a database. Does it fill the column for the already created sale order lines? or do they remain blank? In case they are filled in does it take to much to fill that value? I just wonder if the migration scripts is really needed or not.

moylop260 commented 1 year ago

Hi @AaronHForgeFlow

Good catch!

@alan196 Please, create a migration script since that if it is slow opening the view so it will be slow computing the whole database for old databases using this modules and using this new change

github-actions[bot] commented 1 year ago

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. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

alan196 commented 1 year ago

@AaronHForgeFlow I apply this change in a database with millions of sale order lines and the migration script was not necessary and it was fast

AaronHForgeFlow commented 1 year ago

/ocabot merge minor

OCA-git-bot commented 1 year ago

On my way to merge this fine PR! Prepared branch 13.0-ocabot-merge-pr-510-by-AaronHForgeFlow-bump-minor, awaiting test results.

OCA-git-bot commented 1 year ago

Congratulations, your PR was merged at 1d6ef7598a45cd9a40b952f04c134f6003759a0b. Thanks a lot for contributing to OCA. ❤️