On change move crash when debit or credit is None
As it is an on_change the value of debit or credit does not respect necessary the credit_debit
check.
So this traceback may happen:
Traceback (most recent call last):
File "/tryton/tryton/trytond/trytond/protocols/dispatcher.py", line 200, in _dispatch
result = rpc.result(meth(inst, *c_args, **c_kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tryton/tryton/trytond/trytond/model/modelview.py", line 31, in wrapper
result = func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tryton/tryton/trytond/trytond/model/fields/field.py", line 124, in wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tryton/tryton/trytond/trytond/modules/account/move.py", line 949, in on_change_move
total = sum(l.debit - l.credit
^^^^^^^^^^^^^^^^^^^^^^
File "/tryton/tryton/trytond/trytond/modules/account/move.py", line 949, in <genexpr>
total = sum(l.debit - l.credit
~~~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'decimal.Decimal'