Error Invalid literal for Decimal: "Decimal('0.0')" after installing account_deposit
After installing the account_deposit module I was getting the trace:
ERROR:tryton.common.common:Traceback (most recent call last):
File "/opt/tryton/tryton/gui/window/view_form/view/list_gtk/widget.py", line 52, in wrapper
return func(self, *args, **kwargs)
File "/opt/tryton/tryton/gui/window/view_form/view/list_gtk/widget.py", line 399, in setter
super(Float, self).setter(column, cell, store, iter)
File "/opt/tryton/tryton/gui/window/view_form/view/list_gtk/widget.py", line 52, in wrapper
return func(self, *args, **kwargs)
File "/opt/tryton/tryton/gui/window/view_form/view/list_gtk/widget.py", line 101, in wrapper
func(self, column, cell, store, iter)
File "/opt/tryton/tryton/gui/window/view_form/view/list_gtk/widget.py", line 195, in setter
text = self.get_textual_value(record)
File "/opt/tryton/tryton/gui/window/view_form/view/list_gtk/widget.py", line 290, in get_textual_value
record, factor=self.factor)
File "/opt/tryton/tryton/gui/window/view_form/model/field.py", line 352, in get_client
factor=Decimal(str(factor)))
File "/opt/tryton/tryton/gui/window/view_form/model/field.py", line 331, in get_client
d = Decimal(repr(value * factor))
File "/usr/lib/python2.7/decimal.py", line 547, in __new__
"Invalid literal for Decimal: %r" % value)
File "/usr/lib/python2.7/decimal.py", line 3873, in _raise_error
raise error(explanation)
InvalidOperation: Invalid literal for Decimal: "Decimal('0.0')"
IMHO, the error was related do the function get_deposit on account_deposit/party.py. I changed the line 36 from:
values = {p.id: 0 for p in parties}
to
values = {p.id: Decimal('0.0') for p in parties}
and the problem seems corrected. I am including a patch.
Files
Download | Creator | Timestamp | Type |
---|---|---|---|
decimal_patch | @rvnovaes | 2015-11-07 14:28:55.141000 UTC | text/plain |