Sales: status "waiting" - invoice: status"payed"

Hello friends,

I my sales list, there is one incident with invoice status “waiting”.
When I open it and look at the corresponding invoice, that one has status “payed”.

There is only that single sale, and only one single invoice, AFAIK no cancellations etc.
What could I have done wrong?

Cheers,
Wolf

Did you tried using the “Process” button of the sale? Does it show any error? Does it create a new invoice?

In fact you’re right - the “process” button still shows up. Sorry, I should have seen that.
When I press it, I get this error:

missing to_uom

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 110, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 47, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 77, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/kopen_web_shop_woocommerce-5.6.0-py3.8.egg/trytond/modules/web_shop_woocommerce/web.py", line 521, in process
    super().process(sales)
  File "/trytond/model/modelview.py", line 729, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/modules/sale/sale.py", line 958, in process
    sale.create_invoice()
  File "/trytond/modules/sale/sale.py", line 788, in create_invoice
    invoice_lines.append(line.get_invoice_line())
  File "/trytond/modules/sale/sale.py", line 1399, in get_invoice_line
    - self._get_invoiced_quantity())
  File "/trytond/modules/sale/sale.py", line 1473, in _get_invoiced_quantity
    quantity += Uom.compute_qty(invoice_line.unit,
  File "/trytond/modules/product/uom.py", line 198, in compute_qty
    raise ValueError("missing to_uom")
ValueError: missing to_uom

Fault: missing to_uom

HTH, Wolf

It seems there Sale uom is missing which causes the crash.

I guess there is some invoice line which was manually linked to some sale line without a product and this causes the issue.

Fixing the data should solve the issue.

Sorry but i can’t say more without seeing the data.

Right - do I need to edit the database for that? - I’ve got access to PGAdmin - it that the proper tool, and where would I have to dig into?

Thank you so much!
Wolf

If the sale is process and the invoice is already posted: yes you should update the data on the database.

But you can find the wrong line from the user interface.

Basically you need to search for sale lines without Unit set which have a related invoice line (using the origin refernece) that has a Unit set.

Right - I found one line without a unit in “sales”, the corresponding item in “invoices” has a unit set. What could I do? - In the “sales” section, I cannot make any changes, everything is grayed. So do I need to edit the database with pgadmin?

Thank you so much!

Yes, the only option is to update the sale unit by using a database tool.

Once you have set a value for it, using the process button should fix the states.

I looked into PgAdmin, but I’m not at all familiar with the database structure. Could you give me a hint in which table I have to look?

Thanks a lot in advance,
Wolf

You have to look in the sale_line table. You also need the ID of your sale order to find the lines.

To find the ID of your sale-order:

  1. Open the list of sale orders
  2. Select the right sale order
  3. Use that big button with triangular shape at the top
  4. Click on “View Logs …”

You will find the ID in the popup. That ID can be used to search in your sale_line table. Search for column sale and you will only get the lines which are on that particular sale.

Now you can easy change the uom which is just an integer to the underlying uom table.

I don’t have any experience with PgAdmin but the SQL-queries should be something like:

SELECT * FROM sale_line WHERE sale=<your sale ID>;
UPDATE sale_line SET uom=<uom ID> WHERE id=<sale line id>;

The first one is to get the lines of the sale order so you can look for the line without a uom. The second one is used to update that line and add a uom to it.

Just to mention, <your sale ID> is not the same as <sale line id>

1 Like

Eddy, you saved my life as so often before…

Being something of a sissy, I used PgAdmin which made it easy enough for me - I filled in the id “33” instead of “null” at “unit integer”, hit “save changes” - and that was it. Problem solved - I hope. Let’s see.

Thank you so much!
Wolf

1 Like

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