Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions sale_stock_available_to_promise_release/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,26 @@ def _get_availability_data(self):
data["availability_status"] = "full"
data["available_qty"] = self.product_uom_qty
return data
product = self.product_id
# Fallback values
availability_status = "no"
expected_availability_date = False
available_qty = sum(
self.mapped("move_ids.ordered_available_to_promise_uom_qty")
)
available_qty = 0
for move in self.move_ids:
if move.state == "cancel":
continue
if move.need_release:
available_qty += self.product_uom._compute_quantity(
move.ordered_available_to_promise_uom_qty,
Copy link
Contributor

@jbaudoux jbaudoux Dec 19, 2025

Choose a reason for hiding this comment

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

promise_qty instead of promise_uom_qty

product.uom_id,
rounding_method="HALF-UP",
)
else:
available_qty += self.product_uom._compute_quantity(
move.quantity, move.product_uom, rounding_method="HALF-UP"
)
delayed_qty = 0
# required values
product = self.product_id
rounding = product.uom_id.rounding
# Fully available
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def setUpClass(cls):
)

def test_expected_date_ok(self):
self.sale.action_confirm()
self._set_stock(self.product, 100)
self.sale.action_confirm()
self.assertTrue(self.sale.is_ok_expected_delivery_date)

def test_no_availability(self):
Expand Down