Create new sale error

Hello all.

I call this code from and I have error at last command sale.process([sale])
The error is trytond.exceptions.UserError: There is no "Account Category" defined on the product "Product name"

Where is the fail ?
Any help ?

     ### Sale ###
    Sale = pool.get('')
    sale, = Sale.create([{
        'company': 1,
        'invoice_method': 'order',
        'shipment_method': 'order',
        'currency': currency,

    ### Lines ###
    for line in data['lines']:
        product =[('code', '=', line[1])])[0]

        Line = pool.get('sale.line')
        line, = Line.create([{
            'type': 'line',
            'unit': product.default_uom,
            'quantity': line[2],
            'unit_price': line[3],
            'note': line[0],
        LineTax = pool.get('')
        tax, = LineTax.create([{
            'tax': product.customer_taxes_used[0],


The problem is that your product is not correctly configured. You are missing an Account Category on it or the account category does not have any Receivable Account

Note that this is required to process the sale as in this case an invoice is created.
Another option is to use the invoice method based on shipment. This will fix the problem but it will be raised latter when finishing the shipment.

So the best is to configure the products properly.

Thanks pokoli for your answer but I have all them at product. Do I not have them?
Is there anything else I need to do?

I see you have the company hard coded. So I’m guessing that it is not set in the context.
So depending of the version, the code can not get the company-related multivalue where the account is stored.

I have the trytond __version__ = "5.0.18"

I changed the code with :


The same error again :slightly_frowning_face:
If I use the web interface (sao), all steps work fine. I have seen the code :

modules/sale/", line 885, in process
modules/sale/", line 724, in create_invoice
modules/sale/", line 1337, in get_invoice_line
modules/account_product/", line 49, in prop
modules/account_product/", line 38, in wrapper", line 74, in raise_user_error

but I can not figure out what the error is

I do not know what it means but you must set the company in the context in version 5.0 for sure. It is so old that multi-company was not really supported.

Thanks, I will try this because I do POST with other client (requests) and I will let you know what happened.
I’m currently doing my job with proteus.

I will come soon…

If you consider the option to upgrade to newer series, on 6.0 we implemented the multi-company support so with that version it will be easier to manage such cases.