diff --git a/production.py b/production.py index c7fdc5bb44..08deb5f747 100644 --- a/production.py +++ b/production.py @@ -80,7 +80,7 @@ class Production: products = Product.search([ ('type', '=', 'goods'), ('consumable', '=', False), - ('purchasable', '=', False), + ('producible', '=', True), ]) # compute requests today = Date.today() diff --git a/stock.py b/stock.py index 574c72b917..cecc01a17d 100644 --- a/stock.py +++ b/stock.py @@ -1,6 +1,6 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -from trytond.pyson import Eval +from trytond.pyson import Eval, If from trytond.pool import PoolMeta __all__ = ['OrderPoint'] @@ -14,6 +14,15 @@ class OrderPoint: def __setup__(cls): super(OrderPoint, cls).__setup__() + cls.product.domain = [ + cls.product.domain, + If(Eval('type') == 'production', + ('producible', '=', True), + ()), + ] + if 'type' not in cls.product.depends: + cls.product.depends.append('type') + cls.warehouse_location.states['invisible'] &= ( Eval('type') != 'production') cls.warehouse_location.states['required'] |= (