Crediting a posted invoice fails if there are comment lines
Steps to reproduce :
Create a new invoice
add a comment line
post it
credit it
you get the following traceback :
Traceback (most recent call last):
File "/trytond/wsgi.py", line 47, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 41, in rpc
request, database_name, *request.rpc_params)
File "/trytond/wsgi.py", line 39, in auth_required
return wrapped(*args, **kwargs)
File "/trytond/protocols/wrappers.py", line 105, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 162, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond/wizard/wizard.py", line 287, in execute
return wizard._execute(state_name)
File "/trytond/wizard/wizard.py", line 313, in _execute
do_result = do(action)
File "/trytond/modules/account_invoice/invoice.py", line 2728, in do_credit
credit_invoices = Invoice.credit(invoices, refund=refund)
File "/trytond/modules/account_invoice/invoice.py", line 1275, in credit
new_invoices = [i._credit() for i in invoices]
File "/trytond/modules/account_invoice/invoice.py", line 1263, in _credit
credit.lines = [line._credit() for line in self.lines]
File "/trytond/modules/account_invoice/invoice.py", line 2038, in _credit
line.quantity = -self.quantity
TypeError: bad operand type for unary -: 'NoneType'