Issue with processing of some sales

Hello,

I noticed that some sales remain in the «processing» state, even when everything is done. It’s a service sale, so no shipment, but the invoice is paid.

I tried to manually process one of them, and got the backtrace:

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 46, 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 159, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 180, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/model/modelview.py", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/modules/sale/sale.py", line 960, in process
    cls._process_invoice_shipment_states(sales)
  File "/trytond/modules/sale/sale.py", line 1022, in _process_invoice_shipment_states
    line.set_actual_quantity()
  File "/trytond/modules/sale/sale.py", line 1701, in set_actual_quantity
    invoiced_quantity += Uom.compute_qty(
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

Fault: unsupported operand type(s) for +=: 'int' and 'NoneType'

The only notable thing is that I have a comment line in the sale, and another one in the invoice (the comment from the sale is not automatically transfered to the invoice)

Tell-me if I can give more info

additionnal info:

I tried to manually process other stuck sales, and some of them reach the finished state, while others backtrace. Currently I have two of them which remain stuck, and at least one with the very same structure which reached the finished state.

For the stuck sales, the «paid» status of the invoice does not appear in the sales list. There the invoice remains Waiting (but it is paid, and listed as such in the invoice lists)

Which is the backtrace? THe same as posted on the same topic.

Are you using a version that contains such fix?

There is a process button on invoice that should be used on such case. Probably there is an error there. Could you share it’s traceback?

yep, the backtrace is the same for both sales

what fix ?

yep the client does not display a backtrace, but the server console does:

76331 139877672802048 [2022-07-05 14:07:15,074] CRITICAL trytond.worker <Task 542@tryton-6.2-dev> failed
Traceback (most recent call last):
  File "/home/hobbes/tryton/tryton-6.2-dev/lib/python3.9/site-packages/trytond/worker.py", line 119, in run_task
    task.run()
  File "/home/hobbes/tryton/tryton-6.2-dev/lib/python3.9/site-packages/trytond/ir/queue.py", line 177, in run
    getattr(Model, self.data['method'])(
  File "/home/hobbes/tryton/tryton-6.2-dev/lib/python3.9/site-packages/trytond/model/modelview.py", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/home/hobbes/tryton/tryton-6.2-dev/lib/python3.9/site-packages/trytond/modules/sale/sale.py", line 960, in process
    cls._process_invoice_shipment_states(sales)
  File "/home/hobbes/tryton/tryton-6.2-dev/lib/python3.9/site-packages/trytond/modules/sale/sale.py", line 1022, in _process_invoice_shipment_states
    line.set_actual_quantity()
  File "/home/hobbes/tryton/tryton-6.2-dev/lib/python3.9/site-packages/trytond/modules/sale/sale.py", line 1701, in set_actual_quantity
    invoiced_quantity += Uom.compute_qty(
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

By the way I’m on tryton 6.2, I haven’t upgraded to 6.4 yet.

Do you have any invoice with lines that have empty quantity but related to sale lines?
That may cause the issue.

Sorry I missed the link. The one from Issue 11503: Actual Quantity not always rounded - Tryton issue tracker

Then you should be using sale 6.2.4 which contains the fix of the above mentioned issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.