分类 学习Odoo 下的文章

转载自:http://www.oejia.net/blog/2016/01/19/oejia_wx_v01.html
Odoo 的微信模块 Oejia_wx v0.1 发布!
Oejia on 2016-01-19 00:18:56
Oejia_wx

Odoo 的微信模块,提供了对微信公众号的接入与管理,实现了微信消息与Odoo聊天的无缝对接。

特性

用户、组同步管理
用户消息对接live_chat 一对一实时聊天
全功能自定义菜单配置
各种返回消息类型的支持
灵活配置自动回复及匹配方式
项目地址

https://github.com/JoneXiong/oejia_wx

界面效果

info
info
info
info
Information

Odoo 的微信模块 Oejia_wx v0.1 发布!
http://www.oejia.net/blog/2016/01/19/oejia_wx_v01.html
http://www.oejia.net/raw/2016/01/19/oejia_wx_v01.md
Oejia on 2016-01-19 00:18:56

Odoo多个二级域名对应多个Pgsql数据库访问【作业】

前段时间-福州小林在Jeffery群里问到说要多域名访问odoo对应多数据库,按照网上教程修改odoo源码找不到对应的修改的地方,网上教程的源码是旧源码,新版本odoo已经不需要修改源码,感谢南京CCDOS指点迷津!

举例:

想用aaa.odoo123.com访问odoo中的aaa数据库,
想用bbb.odoo123.com访问odoo中的bbb数据库。

1、修改openerp-server.conf文件,增加一行:dbfilter = ^%d$

如下图所示:

2、http://127.0.0.1:8069/web/database/manager并创建aaa和bbb两个(操作两次)数据库:

3、打开C:\WINDOWS\system32\drivers\etc\hosts在此文件中增加两行:

127.0.0.1 aaa.odoo123.com
127.0.0.1 bbb.odoo123.com

效果如下图:
4、访问aaa.odoo123.com

5、访问bbb.odoo123.com

6、如果访问了一个odoo里没有的数据库那么会跳转至新创建数据库的页面:

声明:

1、以上方法基于win2003server+步科绿色版GreenOdoo,以上方法成功。
2、在阿里云服务器+LNMP(启用nginx的gzip及反向代理了odoo的8069端口)前提下,以上方法失败。

修改Odoo(OpenERP) Server的默认端口8069
标签: OdooOpenERP8069
2014-10-27 10:06 3778人阅读 评论(0) 收藏 举报
分类:
Odoo(OpenERP)(34)

版权声明:本文为博主原创文章,未经博主允许不得转载。
方法1 - 启动server时指定端口号
./openerp-server --config=/etc/odoo-server.conf --xmlrpc-port=8888
方法2 - 在配置文件中指定端口号
打开配置文件openerp-server.conf,加入如下行:
xmlrpc_port = 8888
方法3 - 修改Server文件中的端口号
在openerp\tools目录下,打开config.py,找到
group.add_option("--xmlrpc-port", dest="xmlrpc_port", my_default=8069,
help="specify the TCP port for the XML-RPC protocol", type="int")
将8069端口改为想要的端口号即可。

补充,
方法4 - 端口重定向(Linux环境)
sudo nano /etc/rc.local #编辑rc.local文件
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8069 #在文件中加入此行
sudo reboot #重启机器使更改生效

Docker Pull Command

docker pull odoo

Tag Name Size

latest 268 MB
9 268 MB
9.0 268 MB
8 264 MB
8.0 264 MB

Full Description
Supported tags and respective Dockerfile links

8.0, 8 (8.0/Dockerfile)
9.0, 9, latest (9.0/Dockerfile)

For more information about this image and its history, please see the relevant manifest file (library/odoo). This image is updated via pull requests to the docker-library/official-images GitHub repo.

For detailed information about the virtual/transfer sizes and individual layers of each of the above supported tags, please see the odoo/tag-details.md file in the docker-library/docs GitHub repo.
What is Odoo?

Odoo, formerly known as OpenERP, is a suite of open-source business apps written in Python and released under the AGPL license. This suite of applications covers all business needs, from Website/Ecommerce down to manufacturing, inventory and accounting, all seamlessly integrated. It is the first time ever a software editor managed to reach such a functional coverage. Odoo is the most installed business software in the world. Odoo is used by 2.000.000 users worldwide ranging from very small companies (1 user) to very large ones (300 000 users).

www.odoo.com

How to use this image

This image requires a running PostgreSQL server.
Start a PostgreSQL server

$ docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres

Start an Odoo instance

$ docker run -p 127.0.0.1:8069:8069 --name odoo --link db:db -t odoo

The alias of the container running Postgres must be db for Odoo to be able to connect to the Postgres server.
Stop and restart an Odoo instance

$ docker stop odoo
$ docker start -a odoo

Stop and restart a PostgreSQL server

When a PostgreSQL server is restarted, the Odoo instances linked to that server must be restarted as well because the server address has changed and the link is thus broken.

Restarting a PostgreSQL server does not affect the created databases.
Run Odoo with a custom configuration

The default configuration file for the server (located at /etc/odoo/openerp-server.conf) can be overriden at startup using volumes. Suppose you have a custom configuration at /path/to/config/openerp-server.conf, then

$ docker run -v /path/to/config:/etc/odoo -p 127.0.0.1:8069:8069 --name odoo --link db:db -t odoo

Please use this configuration template to write your custom configuration as we already set some arguments for running Odoo inside a Docker container.

You can also directly specify Odoo arguments inline. Those arguments must be given after the keyword -- in the command-line, as follows

$ docker run -p 127.0.0.1:8069:8069 --name odoo --link db:db -t odoo -- --db-filter=odoo_db_.*

Mount custom addons

You can mount your own Odoo addons within the Odoo container, at /mnt/extra-addons

$ docker run -v /path/to/addons:/mnt/extra-addons -p 127.0.0.1:8069:8069 --name odoo --link db:db -t odoo

Run multiple Odoo instances

$ docker run -p 127.0.0.1:8070:8069 --name odoo2 --link db:db -t odoo
$ docker run -p 127.0.0.1:8071:8069 --name odoo3 --link db:db -t odoo

Please note that for plain use of mails and reports functionalities, when the host and container ports differ (e.g. 8070 and 8069), one has to set, in Odoo, Settings->Parameters->System Parameters (requires technical features), web.base.url to the container port (e.g. 127.0.0.1:8069).
How to upgrade this image

Suppose you created a database from an Odoo instance named old-odoo, and you want to access this database from a new Odoo instance named new-odoo, e.g. because you've just downloaded a newer Odoo image.

By default, Odoo 8.0 uses a filestore (located at /var/lib/odoo/filestore/) for attachments. You should restore this filestore in your new Odoo instance by running

$ docker run --volumes-from old-odoo -p 127.0.0.1:8070:8069 --name new-odoo --link db:db -t odoo

You can also simply prevent Odoo from using the filestore by setting the system parameter ir_attachment.location to db-storage in Settings->Parameters->System Parameters (requires technical features).
License

View license information for the software contained in this image.
Supported Docker versions

This image is officially supported on Docker version 1.9.1.

Support for older versions (down to 1.6) is provided on a best-effort basis.

Please see the Docker installation documentation for details on how to upgrade your Docker daemon.
User Feedback Documentation

Documentation for this image is stored in the odoo/ directory of the docker-library/docs GitHub repo. Be sure to familiarize yourself with the repository's README.md file before attempting a pull request.
Issues

If you have any problems with or questions about this image, please contact us through a GitHub issue.

You can also reach many of the official image maintainers via the #docker-library IRC channel on Freenode.
Contributing

You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

一、需要docker的gui界面进行管理如下:
1、位置:https://github.com/crosbymichael/dockerui
执行命令:
$ docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock dockerui/dockerui

2、浏览器打开网址:http://:9000例如本机:http://localhost:9000即可ui界面管理docker。
3、docker运行参数有以下几种:

二、postgresql数据库的运行参数:
1、在odoo的官方docker里的参数:
$ docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres
$ docker run -p 127.0.0.1:8069:8069 --name odoo --link db:db -t odoo
将postgres以odoo用户名以odoo为密码以db为docker名字名称来运行一个images postgres。
随后将odoo以8069端口以link命令将db连网连接互相通讯交换数据互连起来。

参考:http://dockerpool.com/static/books/docker_practice/container/enter.html
摘录如下:

进入容器

在使用 -d 参数时,容器启动后会进入后台。 某些时候需要进入容器进行操作,有很多种方法,包括使用 docker attach 命令或 nsenter 工具等。
attach 命令

docker attach 是Docker自带的命令。下面示例如何使用该命令。

$ sudo docker run -idt ubuntu
243c32535da7d142fb0e6df616a3c3ada0b8ab417937c853a9e1c251f499f550
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
243c32535da7 ubuntu:latest "/bin/bash" 18 seconds ago Up 17 seconds nostalgic_hypatia
$sudo docker attach nostalgic_hypatia
root@243c32535da7:/#

但是使用 attach 命令有时候并不方便。当多个窗口同时 attach 到同一个容器的时候,所有窗口都会同步显示。当某个窗口因命令阻塞时,其他窗口也无法执行操作了。
nsenter 命令
安装

nsenter 工具在 util-linux 包2.23版本后包含。 如果系统中 util-linux 包没有该命令,可以按照下面的方法从源码安装。

$ cd /tmp; curl https://www.kernel.org/pub/linux/utils/util-linux/v2.24/util-linux-2.24.tar.gz | tar -zxf-; cd util-linux-2.24;
$ ./configure --without-ncurses
$ make nsenter && sudo cp nsenter /usr/local/bin

使用

nsenter 可以访问另一个进程的名字空间。nsenter 要正常工作需要有 root 权限。 很不幸,Ubuntu 14.04 仍然使用的是 util-linux 2.20。安装最新版本的 util-linux(2.24)版,请按照以下步骤:

$ wget https://www.kernel.org/pub/linux/utils/util-linux/v2.24/util-linux-2.24.tar.gz; tar xzvf util-linux-2.24.tar.gz
$ cd util-linux-2.24
$ ./configure --without-ncurses && make nsenter
$ sudo cp nsenter /usr/local/bin

为了连接到容器,你还需要找到容器的第一个进程的 PID,可以通过下面的命令获取。

PID=$(docker inspect --format "{{ .State.Pid }}" )

通过这个 PID,就可以连接到这个容器:

$ nsenter --target $PID --mount --uts --ipc --net --pid

下面给出一个完整的例子。

$ sudo docker run -idt ubuntu
243c32535da7d142fb0e6df616a3c3ada0b8ab417937c853a9e1c251f499f550
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
243c32535da7 ubuntu:latest "/bin/bash" 18 seconds ago Up 17 seconds nostalgic_hypatia
$ PID=$(docker-pid 243c32535da7)
10981
$ sudo nsenter --target 10981 --mount --uts --ipc --net --pid
root@243c32535da7:/#

更简单的,建议大家下载 .bashrc_docker,并将内容放到 .bashrc 中。

$ wget -P ~ https://github.com/yeasy/docker_practice/raw/master/_local/.bashrc_docker;
$ echo "[ -f ~/.bashrc_docker ] && . ~/.bashrc_docker" >> ~/.bashrc; source ~/.bashrc

这个文件中定义了很多方便使用 Docker 的命令,例如 docker-pid 可以获取某个容器的 PID;而 docker-enter 可以进入容器或直接在容器内执行命令。

$ echo $(docker-pid )
$ docker-enter ls

===================================
实际操作粘贴如下:

root@ubuntu:/tmp/util-linux-2.24/util-linux-2.24# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
69fca0fdb8b9 odoo:8.0 "/entrypoint.sh opene" 5 hours ago Up 5 hours 127.0.0.1:8069->8069/tcp, 8071/tcp odoo8
4b841f957014 6d6a71f8528e "/docker-entrypoint.s" 26 hours ago Up 26 hours 5432/tcp db
2a720ec044b4 b53cb035b2e4 "/dockerui" 27 hours ago Up 27 hours 0.0.0.0:9000->9000/tcp suspicious_swanson
============
得到69fca0fdb8b9

echo $(docker-pid 69fca0fdb8b9)
============
得到pid号为
root@ubuntu:/tmp/util-linux-2.24/util-linux-2.24# echo $(docker-pid 69fca0fdb8b9)
13538
============
root@ubuntu:/tmp/util-linux-2.24/util-linux-2.24# nsenter --target 13538 --mount --uts --ipc --net --pid
root@69fca0fdb8b9:/# ls
bin boot dev entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@69fca0fdb8b9:/#
============================================================
完成!