Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Getting Odoo (10.x) to work in Gentoo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 10251
Location: Córdoba (Spain)

PostPosted: Tue Nov 29, 2016 6:53 pm    Post subject: Getting Odoo (10.x) to work in Gentoo Reply with quote

Hello.

This will be, at least for now, a rough guide about what it takes to get Odoo (previously known as OpenERP if I am not mistaken) on Gentoo.

It took me a couple hours so here you are, in case you care ;)

FIRST, you need to download it from here, I used zip, you can use zip or git. Whatever suits you.

https://github.com/odoo/odoo

SECOND, you need to open requirements.txt and waste like 1 hour translating package names to Gentoo speech (easy enough) and picking some of them from overlays, since they are not in Gentoo. After that, you will come to the conclusion that you need to:

Code:

emerge -va dev-python/decorator dev-python/docutils dev-python/feedparser dev-python/gevent dev-python/greenlet dev-python/j
inja dev-python/lxml dev-python/mako dev-python/markupsafe dev-python/mock dev-python/passlib dev-python/pillow dev-python/p
sutil dev-python/psycogreen dev-python/psycopg media-gfx/pydot dev-python/pyparsing dev-python/pyPdf dev-python/pyserial dev
-python/pychart dev-python/python-dateutil dev-python/python-ldap dev-python/python-openid dev-python/pytz dev-python/pyusb
dev-python/pyyaml dev-python/qrcode dev-python/reportlab dev-python/requests dev-python/six dev-python/suds dev-python/vatnu
mber dev-python/vobject dev-python/werkzeug dev-python/wsgiref dev-python/xlsxwriter dev-python/xlwt psycogreen wsgiref media-gfx/wkhtmltopdf


I warn you that, a couple of these or three, are not in portage, particularly psycogreen and wsgiref. Probably there's some other I am forgetting about... emerge will tell you, just pay attention. When that happens, pick the missing ebuild from some random overlay and put it in your local overlay. You can use this to look for ebuilds:

https://gpo.zugaina.org/AdvSearch

THIRD, it works only with postgresql, so you emerge that, and while it compiles, you go here and follow instructions:

https://wiki.gentoo.org/wiki/PostgreSQL/QuickStart

After that, you need to create a role with your user exact linux user name letter-by-letter (Odoo will attempt to log into postgresql using that, and fail otherwise). You need password-less local login for postgresql. The guide above tells you how to set that up so, please, follow it. :lol:

I warn you that you'll also need to grant creation permissions to your user role, because, well, odoo likes to be able to create and destroy dbs itself. It's just too much fun! Google for the details since it's the first time I used postgres and probably I did it the wrong way and don't want to spread bad advise (it works, though). I am a mysql kind of guy...

FOURTH, you then launch odoo-bin and discover that it fails miserably, because you don't have nodejs, so you emerge net-libs/nodejs.

FIFTH, you then launch odoo-bin, it might boot or fail, I don't remember, but you'll soon notice that they didn't tell you in their how-tos that you this behemoth also depends upon ruby gems. So you go emerge rubygems. After that, by trial and errors, you also notice that it needs lessc and json, so you will no doubt do this, as root (or use sudo).

Code:
sudo gem install json
sudo gem install less


SIXTH, you will discover soon enough that, lessc, needs also therubyracer, so you control+c your odoo server, run "gem install therubyracer", and launch odoo-bin again. Now, it should boot, and by going to localhost:8069 (by default) you should be able to create your db and run into Odoo.

Take fun!
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
Eleazar Anzola
Veteran
Veteran


Joined: 17 Jul 2003
Posts: 1275
Location: Caracas / Venezuela

PostPosted: Sun Feb 12, 2017 8:58 pm    Post subject: Reply with quote

The most feasible solution I could find was to use Layman with the "zugaina" repository, which in advance was frozen in version 8 of odoo, so the final viable option was to edit the ebuild and change some options to fit the last version for today is 10, at the time of emerge I came up with an error with virtual dependency / python-imaging that according to law in some forum was replaced by his fork dev-python / pillow and should be done in the ebuild.

I copy the modified ebuild as it has worked for me and remember that the local overlay (in my case / usr / local / portage / app-office / odoo) should be added and once I do not forget to do the ebuild odoo (version) .ebuild (for version 10 odoo-10.0.20161005.ebuild) digest the command would be
Code:
ebuild odoo-10.0.20161005.ebuild digest
to generate the necessary files in the local portage tree.

Do not forget to save the ebuild under the name: odoo-10.0.20161005.ebuild

Once you have completed all the necessary steps to get to this point you only have to do the
Code:
emerge odoo
and ready we crossed our fingers and wait for the installation to finish successfully.


Code:
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-office/odoo/odoo-7.0.20130219-r5.ebuild,v 1.2 2013/03/11 03:10:59 patrick Exp $
#   virtual/python-imaging[jpeg] fue reemplazado por dev-python/pillow
# Odoo versión 10 odoo-10.0.20161005.ebuild

EAPI="5"

inherit eutils distutils user versionator

BASE_VERSION="$( get_version_component_range 1-2 )"

DESCRIPTION="Open Source ERP & CRM"
HOMEPAGE="http://www.odoo.com/"
SRC_URI="http://nightly.odoo.com/${BASE_VERSION}/nightly/src/${PN}_${PV}.tar.gz"

SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="mirror"
IUSE="+postgres ldap ssl"

CDEPEND="postgres? ( dev-db/postgresql[server] )
   dev-python/pytz
   dev-python/simplejson
   dev-python/requests
   dev-python/pyPdf
   dev-python/pyparsing
   dev-python/passlib
   dev-python/decorator
   dev-python/psutil
   dev-python/docutils
   dev-python/lxml
   dev-python/psycopg:2
   dev-python/pychart
   dev-python/reportlab
   media-gfx/pydot
   dev-python/vobject
   dev-python/mako
   dev-python/pyyaml
   dev-python/pillow
   dev-python/Babel
   ldap? ( dev-python/python-ldap )
   dev-python/python-openid
   dev-python/werkzeug
   dev-python/xlwt
   dev-python/feedparser
   dev-python/python-dateutil
   dev-python/pywebdav
   ssl? ( dev-python/pyopenssl )
   dev-python/vatnumber
   dev-python/mock
   dev-python/unittest2
   dev-python/jinja
   dev-libs/libxslt
   media-gfx/wkhtmltopdf
"

RDEPEND="${CDEPEND}"
DEPEND="${CDEPEND}"

ODOO_USER="odoo"
ODOO_GROUP="odoo"

S="${WORKDIR}/${PN}"

pkg_setup() {
   python_set_active_version 2
   python_pkg_setup
}

src_unpack() {
   unpack ${A}

   mv ${WORKDIR}/${PN}-* $S
}

src_install() {
   distutils_src_install

   newinitd "${FILESDIR}/odoo.initd" "${PN}"
   newconfd "${FILESDIR}/odoo.confd" "${PN}"
   keepdir /var/log/odoo

   insinto /etc/logrotate.d
   newins "${FILESDIR}"/odoo.logrotate odoo || die
   
   dodir /etc/odoo
   insinto /etc/odoo
   newins "${FILESDIR}"/odoo.cfg odoo.cfg || die

   dodir /var/lib/odoo
   keepdir /var/lib/odoo
}

pkg_preinst() {
   enewgroup ${ODOO_GROUP}
   enewuser ${ODOO_USER} -1 -1 -1 ${ODOO_GROUP}

   fowners ${ODOO_USER}:${ODOO_GROUP} /var/log/odoo
   fowners ${ODOO_USER}:${ODOO_GROUP} /var/lib/odoo

   use postgres || sed -i '6,8d' "${D}/etc/init.d/odoo" || die "sed failed"
}

pkg_postinst() {
   elog "In order to create the database user, run:"
   elog " emerge --config '=${CATEGORY}/${PF}'"
   elog "Be sure the database is started before"
   elog
   elog "Use odoo web interface in order to create a "
   elog "database for your company."
}

psqlquery() {
   psql -q -At -U postgres -d template1 -c "$@"
}

pkg_config() {
   einfo "In the following, the 'postgres' user will be used."
   if ! psqlquery "SELECT usename FROM pg_user WHERE usename = '${ODOO_USER}'" | grep -q ${ODOO_USER}; then
      ebegin "Creating database user ${ODOO_USER}"
      createuser --username=postgres --createdb --no-adduser ${ODOO_USER}
      eend $? || die "Failed to create database user"
   fi
}

_________________
Salu2
Eleazar Anzola
Linux User : # 216232
__________________________________________
Por un foro ordenado y un buscador más útil:
[TEMA] Descripción problema (estado)
Back to top
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 373
Location: Estonia

PostPosted: Mon Feb 13, 2017 9:32 pm    Post subject: Reply with quote

I work with Odoo in a virtualenv from a github clone of odoo; the python stuff was installed into virtualenv via pip after removing all the version restrictions in their requirements.txt (and ldap as a whole, as it's optional for one stock module); working with unpinned package versions seems a recipe for disaster (and security I guess :-D). Though I always run it from command line for development and don't run it as a service.
lessc I got via emerge -va nodejs;npm install lessc inside the clone, which made a node_modules subdirectory, and then I just symlinked to node_modules/less/bin/lessc from virtualenvs bin/.
I don't recall any ruby gem needs whatsoever, so not sure what's that about. I guess that's because you got lessc from some ruby thing instead of the nodejs and npm path I went with.
I wasn't aware people are interested in an ebuild for this..
_________________
GNOME team lead; GStreamer; MIPS/ARM64
Back to top
View user's profile Send private message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 10251
Location: Córdoba (Spain)

PostPosted: Wed Feb 15, 2017 9:37 am    Post subject: Reply with quote

Hi, and thanks for sharing.

Leio wrote:
I wasn't aware people are interested in an ebuild for this..


Well, I just wanted to test it, and (speaking for myself) don't truly need an ebuild for anything.

I discarded Odoo because there seem to be no easy way to delete a bill. That alone is a no-go for me. I have been dealing with accounting in a big enterprise, and there are lots of situations when you need to do that.

I found 3 or 4 more no-go's, but I can't remember the details. I remember that under some circumstances, the setup screwed itself badly and I had to crean the DB and start afresh. As said, can't remember the details, but I was able to reproduct consistently, and that scared the hell out of me. I am not making my shop dependent on that thing.

Odoo is grown with a "you pay or you'll regret mentality, even if it's open source". Not truly adequate for a small/medium sized business.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 373
Location: Estonia

PostPosted: Wed Feb 15, 2017 5:25 pm    Post subject: Reply with quote

The problem with ebuild would be that you don't want to just get it upgraded without reserving time and testing to upgrade the databases as well for the upgrade. So the ebuild would be maybe one for each major version with as a dated version e.g _p20170215 and then advertised that this is a base version and everyone should symlink to it from an overlay with the date they need or something.

Regarding bills/invoices, they can be deleted when there are no accounting entries behind them. If there are, these need to be deleted first, etc. In proper accounting, you would be rather making credit invoices or so. There are some extra modules to let you more automatically get rid of the dependent accounting entries or at least reverse them, etc. At least in v8 I have one company just reset an invoice to draft, make fixes and confirm it again; for this the relevant accounting journals have cancelling allowed in their configuration.
Odoo module development is what mostly pays my bills right now and it is used by various companies for whom we do extra modules development for custom needs; small and big companies, using and being (mostly) happy for years, including heavy use of the accounting functionality.
_________________
GNOME team lead; GStreamer; MIPS/ARM64
Back to top
View user's profile Send private message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 10251
Location: Córdoba (Spain)

PostPosted: Wed Feb 15, 2017 6:50 pm    Post subject: Reply with quote

Leio wrote:
The problem with ebuild would be that you don't want to just get it upgraded without reserving time and testing to upgrade the databases as well for the upgrade. So the ebuild would be maybe one for each major version with as a dated version e.g _p20170215 and then advertised that this is a base version and everyone should symlink to it from an overlay with the date they need or something.


I think it's just better to manage this outside your package manager, just like I manage kernels outside the PM as well. It's not worth the effort to use the PM for this just like it's not worth the effort to use a hammer to screw.

There might be someone who will think otherwise, of course. But I wouldn't put a single minute on that.

Quote:
Regarding bills/invoices, they can be deleted when there are no accounting entries behind them. If there are, these need to be deleted first, etc.


No doubt it should be doable. I didn't manage to do it, though. I have experience with several ERPs so I am familiar with the concepts, even if the implementations vary. There was some problem I can't remember. Maybe I screwed something or did things in the wrong order and that prevented me from getting to the end. But I just can't afford to risk that happening in a real shop, and screwing up my accounting.

Quote:
In proper accounting, you would be rather making credit invoices or so. There are some extra modules to let you more automatically get rid of the dependent accounting entries or at least reverse them, etc. At least in v8 I have one company just reset an invoice to draft, make fixes and confirm it again; for this the relevant accounting journals have cancelling allowed in their configuration.


In proper accounting, bugs and strange situations should ideally not happen, ever. But you know they do, if you truly used any ERP in production. As for any Odoo module that can do anything complex, they all seem to be payed.

That reminds me that importing stuff was also a nightmare, so, continuing with the above, I am not investing anything in software that I have no idea if/how it will meet my requirements.

Quote:
Odoo module development is what mostly pays my bills right now and it is used by various companies for whom we do extra modules development for custom needs; small and big companies, using and being (mostly) happy for years, including heavy use of the accounting functionality.


That's quite nice, for a might-medium/big enterprise, I know because I worked for a big company for some years, and I was the first person in that enterprise which recommended and endorsed such a inversion, and it certainly was worth every penny. Investing in support for your ERP can truly mean a big difference if you can afford it. On the opposite, a small shop, at least where I live, can't certainly afford that investment. Maybe in some years... but not when you are starting and you don't know if you'll be able to pay the bills.

My impression is that I would easily break things that wouldn't be able to fix myself (not on a reasonable schedule to keep the business working, anyway). So I wen't with something simpler with an much smaller codebase that I can handle and fix myself if things break.

It's far from perfect, but, such is the way to world domination! :lol:
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
med01
n00b
n00b


Joined: 12 Mar 2017
Posts: 3
Location: Tunisia

PostPosted: Sat Apr 08, 2017 1:17 pm    Post subject: Reply with quote

Hi guys,

I have a problem with lessc.

I installed postgres, odoo, and all python dependencies in requirements.txt.
I started odoo the first time and created the database. Then, I got the home page with ugly content with message "Could not execute command 'lessc'" in the top left.
I did : npm install -g less, then restart odoo, but the problem persists.
I can't find any package named lessc.

Please, could anyone help me ?
Back to top
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 373
Location: Estonia

PostPosted: Sat Apr 08, 2017 1:39 pm    Post subject: Reply with quote

npm install -g lessc probably installed the binary in some location that isn't found in $PATH by odoo?
_________________
GNOME team lead; GStreamer; MIPS/ARM64
Back to top
View user's profile Send private message
med01
n00b
n00b


Joined: 12 Mar 2017
Posts: 3
Location: Tunisia

PostPosted: Sat Apr 08, 2017 5:43 pm    Post subject: Reply with quote

Thank you Leio,
I fixed this by following this thread
The problem was with the prefix of node_modules directory. I fixed it then I did :
Code:
npm install -g less


So, the lessc binary is given by the package less :
Code:
# ls -l /usr/bin/lessc
/usr/bin/lessc -> ../lib/node_modules/less/bin/lessc
Back to top
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 373
Location: Estonia

PostPosted: Sat Apr 08, 2017 7:16 pm    Post subject: Reply with quote

I would try to at least get all this into /usr/local, not /usr. Outside Gentoo stuff has no business with /usr.
_________________
GNOME team lead; GStreamer; MIPS/ARM64
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum