在win7下GreenOdoo9开发环境的建立

来源:互联网 发布:淘宝宝贝七天下架吗 编辑:程序博客网 时间:2024/05/19 13:20

1、准备工作:
a、pycharm专业版或社区版
b、GreenOdoo9.0-WBK-FSJ
安装pycharm和解压GreenOdoo
暂定Odoo解压目录为:E:\GreenOdoo9-WBK-FSJ

2、运行Pycharm,选择打开。
选择odoo目录(E:\GreenOdoo9-WBK-FSJ\source) ,确定
这里写图片描述

这时Pycharm需要分析建立文件结构,等几分种。

3、打开Pycharm的设置选项(按Ctrl+Alt+S),选择Plugins,搜索并安装NodeJS

4、在“设置”中的“语言和框架”里面,设置 Node interpreter
选择的路径为解压路径下runtime\win32\nodejs\node.exe

5、打开并修改source\openerp__init__.py
找到以下代码:

import sysevented = False    if sys.modules.get("gevent") is not None:        evented = True

后面两行代码注释掉:

import sysevented = False '''     if sys.modules.get("gevent") is not None:      evented = True '''

6、如果调试的时候,还有报错“AttributeError: ‘module’ object has no attribute ‘getppid’”。再修改source\openerp\service\server.py
本人测试发现新版本已无报这个错误。
参考(http://blog.csdn.net/zhangfeng1133/article/details/46627969)
在末尾处播入:

    import os    if not hasattr(os, 'getppid'):    import ctypes    TH32CS_SNAPPROCESS = 0x02L    CreateToolhelp32Snapshot = ctypes.windll.kernel32.CreateToolhelp32Snapshot    GetCurrentProcessId = ctypes.windll.kernel32.GetCurrentProcessId    MAX_PATH = 260    _kernel32dll = ctypes.windll.Kernel32    CloseHandle = _kernel32dll.CloseHandle    class PROCESSENTRY32(ctypes.Structure):        _fields_ = [            ("dwSize", ctypes.c_ulong),            ("cntUsage", ctypes.c_ulong),            ("th32ProcessID", ctypes.c_ulong),            ("th32DefaultHeapID", ctypes.c_int),            ("th32ModuleID", ctypes.c_ulong),            ("cntThreads", ctypes.c_ulong),            ("th32ParentProcessID", ctypes.c_ulong),            ("pcPriClassBase", ctypes.c_long),            ("dwFlags", ctypes.c_ulong),            ("szExeFile", ctypes.c_wchar * MAX_PATH)        ]    Process32First = _kernel32dll.Process32FirstW    Process32Next = _kernel32dll.Process32NextW    def getppid():        '''        :return: The pid of the parent of this process.        '''        pe = PROCESSENTRY32()        pe.dwSize = ctypes.sizeof(PROCESSENTRY32)        mypid = GetCurrentProcessId()        snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)        result = 0        try:            have_record = Process32First(snapshot, ctypes.byref(pe))            while have_record:                if mypid == pe.th32ProcessID:                    result = pe.th32ParentProcessID                    break                have_record = Process32Next(snapshot, ctypes.byref(pe))        finally:            CloseHandle(snapshot)        return result    os.getppid = getppid

7、在source下新增openerp-server.conf文件

[options]
; This is the password that allows database
operations:
; admin_passwd = admin
db_host = 127.0.0.1
db_port = 65432
db_user = openerp
db_password = openerp
pg_path = ../runtime/pgsql/bin
addons_path = ../source/addons
data_dir = ../data
;logfile = openerp-server.log
; logrotate = True
;dbfilter=^%d$

8、在source\openerp-server.py上右键调试运行。

9、在浏览器上打127.0.0.1:8069,测试是否成功

1 0
原创粉丝点击