Skip to content

Commit

Permalink
Merge PR #903 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by sebalix
  • Loading branch information
OCA-git-bot committed Dec 3, 2024
2 parents 9cd26e2 + 1f6901b commit 33026c9
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions sale_stock_available_to_promise_release/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ class SaleOrderLine(models.Model):
digits="Product Unit of Measure", compute="_compute_availability_status"
)

def _on_order_route(self):
self.ensure_one()
mto_route = self.env.ref("stock.route_warehouse0_mto")
product_is_mto = mto_route in self.product_id.route_ids
line_is_mto = mto_route == self.route_id
return product_is_mto or line_is_mto

@api.depends(
"move_ids.ordered_available_to_promise_uom_qty",
"product_id.route_ids",
Expand Down Expand Up @@ -73,9 +66,6 @@ def _get_availability_data(self):
# required values
product = self.product_id
rounding = product.uom_id.rounding
# on_order product
if self._on_order_route():
availability_status = "on_order"
# Fully available
if (
product.type == "service"
Expand All @@ -90,6 +80,9 @@ def _get_availability_data(self):
elif float_compare(available_qty, 0, precision_rounding=rounding) == 1:
availability_status = "partial"
delayed_qty = self.product_uom_qty - available_qty
# On order product
elif self.is_mto:
availability_status = "on_order"
# No stock
elif float_is_zero(available_qty, precision_rounding=rounding):
product_replenishment_date = product._get_next_replenishment_date()
Expand Down

0 comments on commit 33026c9

Please sign in to comment.