Delete stock moves from components when applying amendment

issue11355
review386301002
This commit is contained in:
Cédric Krier committed 2022-04-06 18:52:08 +02:00
1 parent 75c8539199
commit 16e6db2fdd
3 files changed
+26

No files matched your search

+2
View File
@@ -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'])
+12
View File
@@ -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'
+12
View File
@@ -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'