Unreconcile lines when cancelling statement

As it is not allowed to delete a move with lines reconciled.

issue4017
review37631002
This commit is contained in:
Cédric Krier
2017-09-03 11:23:02 +02:00
parent 16a64ab622
commit 8b826906c8
3 changed files with 30 additions and 1 deletions
+2
View File
@@ -1,3 +1,5 @@
* Unreconcile lines when cancelling statement
Version 4.4.0 - 2017-05-01
* Bug fixes (see mercurial logs for details)
* Add statement line number as move description
+8 -1
View File
@@ -719,7 +719,14 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
@classmethod
def delete_move(cls, lines):
Move = Pool().get('account.move')
pool = Pool()
Move = pool.get('account.move')
Reconciliation = pool.get('account.move.reconciliation')
reconciliations = [l.reconciliation
for line in lines for l in line.move.lines
if line.move and l.reconciliation]
Reconciliation.delete(reconciliations)
Move.delete(list({l.move for l in lines if l.move}))
def get_move_line(self):
+20
View File
@@ -210,6 +210,26 @@ Validate statement::
>>> statement.state
u'validated'
Cancel statement::
>>> statement.click('cancel')
>>> statement.state
u'cancel'
>>> filter(None, [l.move for l in statement.lines])
[]
Reset to draft, validate and post statement::
>>> statement.click('draft')
>>> statement.state
u'draft'
>>> statement.click('validate_statement')
>>> statement.state
u'validated'
>>> statement.click('post')
>>> statement.state
u'posted'
Test posted moves::
>>> statement_line = statement.lines[0]