Delete stock moves from components when applying amendment
issue11355 review386301002 (grafted from 36bc7330032ba9cd2199d280e924d207e22a0a35) --HG-- branch : 6.0
This commit is contained in:
1 parent
10813b6999
commit
552368f768
1 file changed
+7
-3
+7
-3
@@ -142,9 +142,7 @@ class Amendment(Workflow, ModelSQL, ModelView):
|
||||
for invoice_line in line.invoice_lines:
|
||||
if invoice_line.invoice_state == 'draft':
|
||||
invoice_lines.add(invoice_line)
|
||||
for move in line.moves:
|
||||
if move.state == 'draft':
|
||||
moves.add(move)
|
||||
moves.update(cls._stock_moves(line))
|
||||
|
||||
InvoiceLine.delete(invoice_lines)
|
||||
Move.delete(moves)
|
||||
@@ -152,6 +150,12 @@ class Amendment(Workflow, ModelSQL, ModelView):
|
||||
Invoice.update_taxes([i for i in invoices if i.lines])
|
||||
Invoice.delete([i for i in invoices if not i.lines])
|
||||
|
||||
@classmethod
|
||||
def _stock_moves(cls, line):
|
||||
for move in line.moves:
|
||||
if move.state == 'draft':
|
||||
yield move
|
||||
|
||||
|
||||
class AmendmentLine(ModelSQL, ModelView):
|
||||
"Purchase Amendment Line"
|
||||
|
||||
Reference in new issue
Block a user