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

[16.0][FIX] product_packaging_container_deposit : performance #1583

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

jbaudoux
Copy link
Contributor

When an order is modified, do not recompute container deposit for each line

When an order is modified, do not recompute container deposit for each line
res = super(
OrderMixin, self.with_context(skip_update_container_deposit=True)
).write(vals)
self.update_order_container_deposit_quantity()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the point of calling update_order_container_deposit_quantity if you always skip it?
Also, wouldn't be better to check if there's any update on values that might impact on deposit container lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skip it during the call to super and call it once done.
When you modify SO lines in the UI, when you save the form, this calls write on SO which in turns calls write on SO line.
If you don't skip at this stage, the update will be performed on each SO line. In addition, those write could trigger other calls to write which will again recompute it.

Your second point could be a further improvement in another PR.

Copy link
Contributor

@simahawk simahawk Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your second point could be a further improvement in another PR.

I would check - at least - that you are writing on order_line. That's easy, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iI rechecked and update_order_container_deposit_quantity is already managing that properly

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@jbaudoux
Copy link
Contributor Author

jbaudoux commented May 2, 2024

@simahawk Can we merge this?

@OCA-git-bot
Copy link
Contributor

Sorry @jbaudoux you are not allowed to merge.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

@jbaudoux
Copy link
Contributor Author

ping @simahawk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants