Skip to content

Commit

Permalink
[FIX] stock: fix traceback when user creates a new replenishment record
Browse files Browse the repository at this point in the history
Currently, a traceback occurs when the user tries to create a new
stock replenishment record.

To reproduce this issue:

1) Install `stock`
2) Create a new record from `operation/replenishment`

Error:- "AssertionError: precision_rounding must be positive, got 0.0"

This error is occurring because of the recent refactoring from the
below commit.
odoo@17d9af1

Initially, there was a condition that if there is no product or location, the
`_get_qty_to_order` method simply returns False.

But because the condition was removed from the above mentioned commit,
we get the rounding value as 0.0 as there is no uom when initially creating a new
record.

This leads to the above traceback when the below line executes with rounding as 0.0

https://github.com/odoo/odoo/blob/74d4503a45c9d4ca741d349c3fce673358d2cc42/addons/stock/models/stock_orderpoint.py#L361-L364

sentry-6088943207

closes odoo#188733

X-original-commit: dbd0d6b
Signed-off-by: Adrien Widart (awt) <[email protected]>
Signed-off-by: Altaf Shaik (alsh) <[email protected]>
  • Loading branch information
alsh-odoo committed Nov 27, 2024
1 parent 0b1766c commit 7f860b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addons/stock/models/stock_orderpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ def _compute_qty_to_order_computed(self):

def _get_qty_to_order(self, force_visibility_days=False, qty_in_progress_by_orderpoint={}):
self.ensure_one()
if not self.product_id or not self.location_id:
return False
visibility_days = self.visibility_days
if force_visibility_days is not False:
# Accepts falsy values such as 0.
Expand Down

0 comments on commit 7f860b4

Please sign in to comment.