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] stock_packaging_calculator: computation will hang on very large quantities #2247

Open
MartinAavastik opened this issue Jan 24, 2025 · 0 comments
Labels

Comments

@MartinAavastik
Copy link

Module stock_packaging_calculator

Describe the bug

StockPicking view will hang if the StockMoveLine has very large quantity like 76 000 000.

Problem is with _qty_by_pkg method:

    def _qty_by_pkg(self, pkg_qty, qty):
        """Calculate qty needed for given package qty."""
        qty_per_pkg = 0
        while (
            float_compare(qty - pkg_qty, 0.0, precision_digits=self.uom_id.rounding)
            >= 0.0
        ):
            qty -= pkg_qty
            qty_per_pkg += 1
        return qty_per_pkg, qty

If quantity is very large and pkg_qty is like 1.0, then this will just hang.

To Reproduce

Affected versions:
16

Steps to reproduce the behavior:
1.
2.
3.

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here. (e.g. OS, Python version, ...)

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

No branches or pull requests

1 participant