Crash when using wrong values on modify price wizard
Steps to reproduce:
- Create a new product
- Use the recompute cost wizard to update it's cost (from
product.template
menu) - Enter
0
as value
The following exception is raised:
Traceback (most recent call last):
File "/trytond/modules/stock/product.py", line 1130, in check_cost_price
raise ValueError
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/trytond/wsgi.py", line 117, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 47, in rpc
return methods.get(request.rpc_method, _dispatch)(
File "/trytond/wsgi.py", line 84, in auth_required
return wrapped(*args, **kwargs)
File "/trytond/protocols/wrappers.py", line 156, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond/wizard/wizard.py", line 314, in execute
return wizard._execute(state_name)
File "/trytond/wizard/wizard.py", line 345, in _execute
result = self._execute(transition())
File "/trytond/modules/stock/product.py", line 1041, in transition_modify
Revision.save(revisions)
File "/trytond/model/descriptors.py", line 33, in newfunc
return self.func(owner, *args, **kwargs)
File "/trytond/model/modelstorage.py", line 1782, in save
news = cls.create([save_values[r] for r in to_create])
File "/trytond/model/modelsql.py", line 159, in wrapper
return func(cls, *args, **kwargs)
File "/trytond/model/modelsql.py", line 679, in create
cls._validate(sub_records)
File "/trytond/model/modelstorage.py", line 79, in wrapper
return func(*args, **kwargs)
File "/trytond/model/modelstorage.py", line 87, in wrapper
return func(*args, **kwargs)
File "/trytond/model/modelstorage.py", line 1386, in _validate
cls.validate(records)
File "/trytond/modules/stock/product.py", line 1125, in validate
revision.check_cost_price()
File "/trytond/modules/stock/product.py", line 1135, in check_cost_price
product=self.product.rec_name,
AttributeError: 'NoneType' object has no attribute 'rec_name'