Add npm pckage in odoo

岁酱吖の 提交于 2019-12-14 03:35:27

问题


I want to use a npm package in odoo so that I can use that in odoo widget. I have seen that odoo web add on somehow uses underscore js and query. But I am not able to use npm package in odoo.

I have tried to load it by creating package.json file inside the addon folder but it is not working. Please Help!!


回答1:


The common pattern is to put all dependencies directly copied in the static/src/lib/ folder of the addon, and enable them in a templates/assets.xml file. Using npm would be theoretically nice, but it is probably going to give you more problems than benefits, and you will need to do all the plumbing yourself manually. Check https://github.com/OCA/web/issues/842 for more background on the matter.




回答2:


You can do this as below:

Odoo Web Dependencies

sudo apt-get install -y npm

sudo ln -s /usr/bin/nodejs /usr/bin/node

sudo npm install -g less less-plugin-clean-css

sudo apt-get install node-less

sudo python3 -m pip install libsass


来源:https://stackoverflow.com/questions/52589195/add-npm-pckage-in-odoo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!