Web client 的 addons 样例模块...
-
不多说, 一个最小化的 web client addons 样例. 于附件
init.py<br />import test<br />
openerp.py<br /><br />{<br /> "name" : "OpenERP Web client Addons Sample",<br /> "version" : "1.0",<br /> "depends" : [],<br /> "author" : "mrshelly",<br /> "description": """OpenERP Web client. Addons Sample moudle<br /> """,<br /> 'website': 'http://www.mrshelly.com/',<br /> 'active': True,<br />}<br /><br />
logo.gif
请下载任意 图片文件
test.py<br />import base64,os,re<br /><br />import cherrypy<br />from openerp.controllers import SecuredController<br />from openerp.utils import rpc, common, TinyDict, TinyForm, expr_eval<br />import openobject<br />from openobject.tools import expose, redirect, validate, error_handler, exception_handler<br /><br />class TestForm(SecuredController):<br /><br /> _cp_path = "/openerp/test"<br /><br /> @expose(content_type='image/png')<br /> def show_test_image(self, **kw):<br /> return open(openobject.paths.addons('test','logo.gif'),'rb').read()<br /><br /> # /openerp/test/show_test_image<br />
模块下载[attachurl=1]
解压到 web client addons 路径, 并重启 web client 服务即可.
上个效果图:
[attachimg=2]