Tryton - Issues



Title Wrong on_change calls on a paid invoices
Priority bug Status resolved
Superseder Nosy List ced, pokoli, reviewbot, roundup-bot
Type crash Components sao
Assigned To ced Keywords review
Reviews 38171003
View: 38171003

Created on 2018-04-13.16:47:19 by pokoli, last changed by roundup-bot.

New changeset d59c78fcea95 by C├ędric Krier in branch 'default':
Do not convert 0 value into null in Float/Numeric fields
review38171003 updated at
msg40282 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-04-20.13:01:17
Here is review38171003
msg39959 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-04-13.16:47:19
When opening the form view on sao of an invoice with alternate currency that has been already paid I get the following traceback:

Traceback (most recent call last):
  File "/trytond/", line 71, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/", line 41, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/", line 42, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/", line 172, in _dispatch
    result = rpc.result(meth(inst, *c_args, **c_kwargs))
  File "/trytond/model/", line 671, in on_change
  File "/trytond/model/", line 84, in wrapper
    result = func(self, *args, **kwargs)
  File "/trytond/model/fields/", line 113, in wrapper
    return func(self, *args, **kwargs)
  File "/trytond/modules/account/", line 817, in on_change_debit
  File "/trytond/modules/account/", line 833, in _amount_second_currency_sign
    self.amount_second_currency.copy_sign(self.debit -
TypeError: unsupported operand type(s) for -: 'NoneType' and 'Decimal'

The error is raised because sao triggers the following request:

ERROR trytond.protocols.dispatcher <class 'trytond.pool.account.move.line'>.on_change(*({u'id': 4, u'credit': Decimal('16.5'), u'amount_second_currency': Decimal('-18.15'), u'debit': None}, [u'debit'], {u'language': u'en', u'language_direction': u'ltr', u'company.rec_name': u'Company', u'groups': [5, 6, 1, 2, 3, 4], u'employee': None, u'type': u'out', u'company': 1}), **{}) from admin@

If I open an invoice with company currency, when navigating I get a message if I want to save the changes (but I haven't modified anything). 

Everything works as expected on tryton.
Date User Action Args
2018-04-20 18:42:44roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg40297
2018-04-20 13:35:18reviewbotsetnosy: + reviewbot
messages: + msg40283
2018-04-20 13:01:17cedsetstatus: unread -> testing
keyword: + review
nosy: + ced
messages: + msg40282
reviews: 38171003
assignedto: ced
2018-04-13 16:47:19pokolicreate

Showing 10 items. Show all history (warning: this could be VERY long)