Crash on production cost when purchase line have no amount
As unit price is not enforced on purchase line, line.amount
can be None, producing the following crash on computing the production cost of the outsourcing.
Traceback (most recent call last):
File "/trytond/wsgi.py", line 109, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 43, in rpc
return methods.get(request.rpc_method, _dispatch)(
File "/trytond/wsgi.py", line 75, in wrapper
return func(request, *args, **kwargs)
File "/trytond/protocols/wrappers.py", line 197, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 196, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond/model/modelsql.py", line 1171, in read
getter_results = field.get(
File "/trytond/model/fields/function.py", line 27, in wrapper
return func(self, *args, **kwargs)
File "/trytond/transaction.py", line 50, in wrapper
return func(*args, **kwargs)
File "/trytond/model/fields/function.py", line 159, in get
return dict((name, call(name)) for name in names)
File "/trytond/model/fields/function.py", line 159, in <genexpr>
return dict((name, call(name)) for name in names)
File "/trytond/model/fields/function.py", line 133, in call
return {r.id: convert(method(r, name), name) for r in records}
File "/trytond/model/fields/function.py", line 133, in <dictcomp>
return {r.id: convert(method(r, name), name) for r in records}
File "/trytond/modules/production_outsourcing/production.py", line 124, in get_cost
cost += Currency.compute(
TypeError: unsupported operand type(s) for +=: 'decimal.Decimal' and 'NoneType'
Fault: unsupported operand type(s) for +=: 'decimal.Decimal' and 'NoneType'