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
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user