Only delete requested shipments from the warehouses when supplying internal shipments

Closes #14263
This commit is contained in:
Sergi Almacellas Abellana
2025-10-25 12:24:26 +02:00
parent 0642af4150
commit a0657d1cd7
+11 -5
View File
@@ -32,20 +32,26 @@ class ShipmentInternal(ModelSQL, ModelView):
if not company:
return
clean_request_domain = [
('state', '=', 'request'),
('company', '=', company.id),
]
if not warehouses:
warehouses = Location.search([
('type', '=', 'warehouse'),
])
else:
clean_request_domain.append(
['OR',
('to_location.parent', 'child_of', warehouses),
('from_location.parent', 'child_of', warehouses),
])
today = Date.today()
lead_time = LeadTime.get_max_lead_time()
if clean:
reqs = cls.search([
('state', '=', 'request'),
('company', '=', company.id),
])
cls.delete(reqs)
cls.delete(cls.search(clean_request_domain))
# fetch quantities on order points
order_points = OrderPoint.search([