Tryton - Issues

 

Issue7349

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.

Messages
New changeset d59c78fcea95 by C├ędric Krier in branch 'default':
Do not convert 0 value into null in Float/Numeric fields
http://hg.tryton.org/sao/rev/d59c78fcea95
review38171003 updated at https://codereview.tryton.org/38171003/#ps1
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/wsgi.py", line 71, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 41, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 42, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 172, in _dispatch
    result = rpc.result(meth(inst, *c_args, **c_kwargs))
  File "/trytond/model/modelview.py", line 671, in on_change
    method()
  File "/trytond/model/modelview.py", line 84, in wrapper
    result = func(self, *args, **kwargs)
  File "/trytond/model/fields/field.py", line 113, in wrapper
    return func(self, *args, **kwargs)
  File "/trytond/modules/account/move.py", line 817, in on_change_debit
    self._amount_second_currency_sign()
  File "/trytond/modules/account/move.py", line 833, in _amount_second_currency_sign
    self.amount_second_currency.copy_sign(self.debit - self.credit)
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@127.0.0.1//account_es/

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.
History
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)