diff --git a/__init__.py b/__init__.py index cc5c37f5e3..931cabdabf 100644 --- a/__init__.py +++ b/__init__.py @@ -33,6 +33,7 @@ def register(): sale.HandleShipmentException, module='product_kit', type_='wizard', depends=['sale']) Pool.register( + sale.Amendment, sale.AmendmentLine, module='product_kit', type_='model', depends=['sale_amendment']) Pool.register( @@ -48,5 +49,6 @@ def register(): purchase.HandleShipmentException, module='product_kit', type_='wizard', depends=['purchase']) Pool.register( + purchase.Amendment, purchase.AmendmentLine, module='product_kit', type_='model', depends=['purchase_amendment']) diff --git a/purchase.py b/purchase.py index 702c39884b..65a5321948 100644 --- a/purchase.py +++ b/purchase.py @@ -143,5 +143,17 @@ class HandleShipmentException( __name__ = 'purchase.handle.shipment.exception' +class Amendment(metaclass=PoolMeta): + __name__ = 'purchase.amendment' + + @classmethod + def _stock_moves(cls, line): + yield from super()._stock_moves(line) + for component in line.components: + for move in component.moves: + if move.state == 'draft': + yield move + + class AmendmentLine(AmendmentLineMixin, metaclass=PoolMeta): __name__ = 'purchase.amendment.line' diff --git a/sale.py b/sale.py index 7580e7c53a..3fbac7f117 100644 --- a/sale.py +++ b/sale.py @@ -158,5 +158,17 @@ class HandleShipmentException( __name__ = 'sale.handle.shipment.exception' +class Amendment(metaclass=PoolMeta): + __name__ = 'sale.amendment' + + @classmethod + def _stock_moves(cls, line): + yield from super()._stock_moves(line) + for component in line.components: + for move in component.moves: + if move.state == 'draft': + yield move + + class AmendmentLine(AmendmentLineMixin, metaclass=PoolMeta): __name__ = 'sale.amendment.line'