Do not create a production request when quantities are the same

If the available quantity is exactly the same as the quantity sold, there is no
need to create a production request.

Closes #14585
(grafted from 61abfaa01954f661128f014171686a6512ffe630)

--HG--
branch : 8.0
This commit is contained in:
Adrià Tarroja Caubet
2026-07-24 10:12:57 +02:00
parent 14503c1683
commit 9bc74a5eea
2 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ class Line(metaclass=PoolMeta):
available_qty = Uom.compute_qty(
product.default_uom, available_qty, self.unit,
round=False)
if quantity < available_qty:
if quantity <= available_qty:
product_quantities[product] -= Uom.compute_qty(
self.unit, quantity, product.default_uom, round=False)
return
@@ -104,3 +104,21 @@ Sale 4 products with production request::
>>> move, = line.moves
>>> move.state
'staging'
Sale remaining 2 products without production request::
>>> sale = Sale()
>>> sale.party = customer
>>> line = sale.lines.new()
>>> line.product = product
>>> line.quantity = 2
>>> sale.click('quote')
>>> sale.click('confirm')
>>> sale.state
'processing'
>>> line, = sale.lines
>>> len(line.productions)
0
>>> move, = line.moves
>>> move.state
'draft'