Missing rounding during creation of purchase requests
We noticed a crash while using the purchase request wizard: Purchase -> Purchase Requests -> Create Purchase Requests.
User message: The number of digits "3" of field "Stock at Supply Date" on "-0.0800000000000001" exceeds its limit.
Stack trace:
Traceback (most recent call last):
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/protocols/dispatcher.py", line 163, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/wizard/wizard.py", line 287, in execute
return wizard._execute(state_name)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/wizard/wizard.py", line 313, in _execute
do_result = do(action)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/modules/stock_supply/purchase_request.py", line 380, in do_create_
PurchaseRequest.generate_requests(**self._requests_parameters)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/modules/stock_supply/purchase_request.py", line 141, in generate_requests
cls.create_requests(new_requests)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/modules/stock_supply/purchase_request.py", line 151, in create_requests
cls.save(to_save)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/model/descriptors.py", line 33, in newfunc
return self.func(owner, *args, **kwargs)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/model/modelstorage.py", line 1478, in save
news = cls.create([save_values[r] for r in to_create])
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/modules/purchase_request/purchase_request.py", line 251, in create
return super(PurchaseRequest, cls).create(vlist)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/model/modelsql.py", line 611, in create
cls._validate(sub_records)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/model/modelstorage.py", line 1075, in _validate
field_name)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/model/modelstorage.py", line 1061, in digits_test
raise_user_error(value)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/model/modelstorage.py", line 1052, in raise_user_error
error_args=error_args)
File "/home/tryton/venv/local/lib/python2.7/site-packages/trytond/error.py", line 74, in raise_user_error
raise UserError(error)
UserError: ('UserError', (u'The number of digits "3" of field "Stock at Supply Date" on "-0.0800000000000001" exceeds its limit.', ''))
Mon Jul 24 11:37:14 2017] INFO:werkzeug:127.0.0.1 - - [24/Jul/2017 11:37:14] "POST
It seems that the field stock_level of model purchase.request is not rounded while generating the requests. We used the patch attached to workaround the issue.
trytond: 4.2.5
trytond-stock-supply: 4.2.1
Files
Download | Creator | Timestamp | Type |
---|---|---|---|
stock_supply_rounding.patch | @nblock | 2017-07-24 15:28:22.662000 UTC | text/plain |