mirror of
https://github.com/NaN-tic/trytond-sale_product_stock.git
synced 2023-12-14 07:03:03 +01:00
Continue validate enough stock when line not have product or not in TYPES
This commit is contained in:
parent
95cd10adf1
commit
759d332bf4
5
sale.py
5
sale.py
|
@ -4,10 +4,9 @@
|
|||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
__all__ = ['Sale']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
PRODUCT_TYPES = ['goods']
|
||||
|
||||
class Sale:
|
||||
__name__ = 'sale.sale'
|
||||
|
@ -31,6 +30,8 @@ class Sale:
|
|||
for sale in sales:
|
||||
locations = [sale.warehouse.id]
|
||||
for line in sale.lines:
|
||||
if not line.product or line.product.type not in PRODUCT_TYPES:
|
||||
continue
|
||||
with Transaction().set_context(locations=locations):
|
||||
quantity = Product.get_quantity([line.product], 'quantity')
|
||||
if not quantity or quantity[line.product.id] < line.quantity:
|
||||
|
|
Loading…
Reference in a new issue