Monil's picture

Hello,

I have recently installed Odoo on my virtual machine but I cannot seem to find a way to pdf quotations , I get a error message saying "You need to start OpenERP with at least two workers to print a pdf version of the report." I've looked all over google and tried many ways to fix it but no success.

Has anyone come across this issue and can you assist?

Much appreciated

Forum: 
Jeremy Davis's picture

Hi there. Unfortunately I don't have an Odoo server handy just at the minute and from the Odoo appliance build code I can't see explicitly what the default Odoo config is.

On face value, it appears that either you are running in "multi-threaded" mode (i.e. 'workers=0') - which according to the error message is not supported if you wish to render PDFs. Another possibility is that you are running in "multi-process" mode (i.e. 'workers>=1') and either only have 1 worker defined, or have multiple workers defined but for some reason they are being killed or crashing (e.g. timing out due lack of CPU resources, or running out of RAM).

It's also possible that the error message is a complete red herring and something else entirely is going on...

First thing I suggest that you do is check how many workers you have configured. IIRC the config file should be /etc/odoo/odoo.conf. As a general rule, Odoo recommend setting 'workers=(cpu-threads x 2) +1' e.g. if you have 2 threads/cores; 'workers=3'. If you make any adjustments there, you'll need to restart Odoo to apply them. I.e. this should do the trick:

service odoo restart

FWIW her's the relevant section from the Odoo docs:


Worker number calculation
Rule of thumb : (#CPU * 2) + 1
Cron workers need CPU
1 worker ~= 6 concurrent users
memory size calculation
We consider 20% of the requests are heavy requests, while 80% are simpler ones
A heavy worker, when all computed field are well designed, SQL requests are well designed, … is estimated to consume around 1Go of RAM
A lighter worker, in the same scenario, is estimated to consume around 150MB of RAM
Needed RAM = #worker * ( (light_worker_ratio * light_worker_ram_estimation) + (heavy_worker_ratio * heavy_worker_ram_estimation) )

If that doesn't help and/or you already have multiple workers configured, then the next step is to check the logs to see if you can find more info about exactly what is going wrong (e.g. worker processes crashing due to insufficient memory). I'm not 100% sure, but I suspect that you should be able to find the Odoo log file in the normal place for logs (i.e. /var/log). If you're having problems interpreting it, please feel free to post the last few lines into a new post (or attach a separate file to your original post - only the first post in each thread can have an attachment).

If you get stuck or my instructions don't seem to assist, please let me know what/how/where and when I get time I can launch an Odoo server and try to see if I can reproduce the issue.

Monil's picture

Hey, I tried your solution but it didn't seem to work but I did a bit of troubleshooting and I got it to output in PDF format. I googled A bit until I came across this webpage "https://medium.com/@aadimator/odoo-wkhtmltopdf-installation-df0f47104c60" where it explains how to remove and install wkhtmltopdf, I followed it step by step but the version of wkhtmltopdf was outdated. It did give me a PDF output but the output was just plain text and looked nothing like the preview I was seeing on Odoo.

To fix this I simply went to "https://wkhtmltopdf.org/" and downloaded their latest version Debain 9 (stretch) from the following link "https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb" and copied the package into the root directory for Odoo. ( I used WinSCP to get into the folder directory of Odoo).

Then I installed the package from the console/terminal "{ip address}:12320" " dpkg -i wkhtmltox_0.12.5-1.stretch_amd64.deb" and restarted Odoo. After Odoo had sucessfully restarted my PDF's were coming out the way they were supposed to.

Just a side note I installed Odoo on my Proxmox Virtual Server to be avaliable over my internal network.

The hardware configuration I used on the Virtual Server are as follows:

Memory: 4.00GB

Processor: (1 socket, 4 cores) [SandyBridge]

Hard Disk: Virtio0 (500GB)

I hope this helps anyone who finds themselves in the same problem as me.

Sorry if what I wrote isn't as clear, let me know and i'll try my best to help.

Again Thank you Jeremy Davis for the assistance it was much appreciated.

Jeremy Davis's picture

Thanks heaps for reporting back on how you went. Bonus points for discovering a fix and sharing it! :)

Out of interest, when you say "I tried your solution but it didn't seem to work" did the error message change? Or did it continue to give the same "You need to start OpenERP with at least two workers to print a pdf version of the report."?

According to my very brief browsing of the Odoo source code, that message should only occur if you have 'workers=0' or 'workers=1' in your odoo.conf file. So I'm guessing that that was still a component in the issue (although obviously not all there was to it).

BTW I've opened a bug report on our issue tracker so we can apply your tweak (i.e. updated wkhtmltopdf) for the next build.

FWIW we had issues with wkhtmltopdf in previous (v14.x) builds of Odoo, but back then it was because the version we installed was too new...! :) Looks like now we need a newer version...

Monil's picture

Hi, I got the same error message even if I changed the values. I tried to giving it more CPU cores and Ram on the virtual server but it didn't either.

Jeremy Davis's picture

Thanks for the clarification. I'm not sure when I'll get a chance, but hopefully next week I'll have a closer look.

Regardless, great that you managed to work it out and get yourself going.

Jeremy Davis's picture

I think this is unlikely (as I would have expected others to complain sooner), but on other possibility that has just occurred to me is that perhaps the version of wkhtmltopdf that we preinstall from Debian repos) is sub-optimal when used with Odoo?

I also would have expected it to give a different error, or perhaps even a blank pdf if that was the issue.

The only reason that I note it is that I recall that we had issues with that back in the v14.x release of the Odoo appliance (which included Odoo 8). Although I was pretty sure that it was resolved for TurnKey v15.x...

Jeremy Davis's picture

There is a workaround documented in the bug report. Please note that the bug report is closed because the code is merged. We have not yet re-released the appliance as I've been flat out developing our new (upcoming) v16.0 release.

Please give that a try and let us know how it goes.

Add new comment