couldn't delete statement with lines
If I try to delete a statement (in 'draft' state) whereas some lines were already filled, I have the following exception:
Traceback (most recent call last):
File "/trytond/wsgi.py", line 73, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 46, in rpc
request, database_name, *request.rpc_params)
File "/trytond/wsgi.py", line 44, in auth_required
return wrapped(*args, **kwargs)
File "/trytond/protocols/wrappers.py", line 122, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 176, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond/modules/account_statement/statement.py", line 372, in delete
cls.cancel(statements)
File "/trytond/model/modelview.py", line 666, in wrapper
return func(cls, records, *args, **kwargs)
File "/trytond/model/workflow.py", line 36, in wrapper
result = func(cls, filtered, *args, **kwargs)
File "/trytond/modules/account_statement/statement.py", line 555, in cancel
StatementLine.delete_move(lines)
File "/trytond/modules/account_statement/statement.py", line 841, in delete_move
for line in lines for l in line.move.lines
File "/trytond/modules/account_statement/statement.py", line 841, in
for line in lines for l in line.move.lines
AttributeError: 'NoneType' object has no attribute 'lines'
Please note that manually delete the lines, save the record, and next delete the statement works as excepted.
To reproduce:
- create a new Statement (with amount validation for example)
- add a StatementLine
- save the record
- delete the record : the exception is triggered