初次开发OE请假模块安装时报错了,求大神指导
-
从《笨办法学Python(完整书签)》了解Python,基于OE官方的《OpenERP_Technical_Memento_v0.7.3.pdf》、《openerp-technical-training-v7-exercises.pdf》、老肖的《OpenERP开发教程.pdf》再加上OE源码尝试开发老肖教程中的请假模块。。。
模块结构:
[attachimg=1]
openerp.py<br />{<br /> "name": "yx_qingjd",<br /> "version": "1.0",<br /> "depends": ["base"],<br /> "author": "zhaocjiang",<br /> "category": "other",<br /> "description": """<br /> 请假单<br /> """,<br /> "data": ['yx_qingj_view.xml',],<br /> "demo": [],<br /> "test": [],<br /> "installable": True,<br /> "auto_install": False,<br /> "license": "GPL-3"<br />}<br />
yx_qingj.py<br />from openerp.osv import osv, fields<br /><br />class yx_qingj_qingjd(osv):<br /> '''<br /> classdocs<br /> '''<br /> <br /> _name = 'yx_qingj.qingjd'<br /> _description = u'请假单'<br /> _columns = {<br /> 'shenqr': fields.many2one('res.users', u'申请人', required = True),<br /> 'tians': fields.float(u'天数',digits=(3,1), required = True),<br /> 'kaisrq': fields.date(u'开始日期', required = True),<br /> 'shiyou': fields.text(u'事由'),<br /> 'state': fields.selection([<br /> ('draft', u'草稿'),<br /> ('wait_prove', u'待批'),<br /> ('proved', u'已批'),<br /> ('rejected', u'被拒')<br /> ], u'状态', readonly = True)<br /> }<br /> _defauts = {'state': 'draft'}<br /><br />yx_qingj_qingjd()<br />
yx_qingj_view.xml<br /><?xml version="1.0" encoding="UTF-8"?><br /><br /><openerp><br /><br /> <data><br /> <br /> <!-- 顶部菜单 --><br /> <menuitem id = 'menu_yx_qingj_root' name = '请假单' sequence = '0'/><br /> <br /> <menuitem id = 'menu_yx_qingj_mgmt' name = '请假单' sequence = '1' parent = 'menu_yx_qingj_root'/><br /> <br /> <!-- menuitem --><br /> <menuitem id = 'menu_action_picking_tree' action = 'action_qingjd_form' sequence = '3' parent = 'menu_yx_qingj_mgmt'/><br /> <br /> <!-- actions --><br /> <record id = 'action_qingjd_form' model = 'ir.actions.act_windows'><br /> <br /> <field name = 'name'>请假单</field><br /> <br /> <field name = 'type'>ir.actions.act_windows</field><br /> <br /> <field name = 'res_model'>yx_qingj.qingjd</field><br /> <br /> <field name = 'view_type'>form</field><br /> <br /> <field name = 'view_model'>tree, form</field><br /> <br /> <field name = 'view_id' ref = 'yx_qingjd_tree'/><br /> <br /> </record><br /> <br /> <!-- form 视图 --><br /> <record id = "yx_qingjd_form" model="ir.ui.view"><br /> <br /> <field name = "name"> yx.qingjd.form </field><br /> <br /> <field name = "model"> yx_qingj.qingjd </field><br /> <br /> <field name = 'type'> form </field><br /> <br /> <field name = 'arch' type = 'xml'><br /> <br /> <form string = 'QingJiaDan' vision = '7.0'><br /> <br /> <header><br /> <br /> <button string = '送批' name = 'action_to_prove' states = 'draft'/><br /> <br /> <button string = '批准' name = 'action_proved' states = 'wait_prove'/><br /> <br /> <button string = '拒绝' name = 'action_rejected' sates = 'wait_prove'/><br /> <br /> <field name = 'state' widget = 'statusbar' statusbar_visible = 'draft,wait_prove,proved' statusbar_colors = '{"wait_prove":"red","proved":"blue"}'<br /> </header><br /> <br /> <sheet><br /> <br /> <group><br /> <br /> <group><br /> <br /> <field name = 'shenqr'/><br /> <br /> <field name = 'tians'/><br /> <br /> <field name = 'kaisrq'/><br /> <br /> </group><br /> <br /> <group><br /> <br /> <field name = 'shiyou'/><br /> <br /> </group><br /> </group><br /> <br /> </sheet><br /> <br /> </form><br /> <br /> </field><br /> <br /> </record><br /> <br /> <!-- tree 视图 --><br /> <record id = 'yx_qingjd_tree' model = 'ir.ui.view'><br /> <br /> <field name = 'name'>yx.qingjd.tree</field><br /> <br /> <field name = "model"> yx_qingj.qingjd </field><br /> <br /> <field name = 'type'> form </field><br /> <br /> <field name = 'priority' eval = '16' /><br /> <br /> <field name = 'arch' type = 'xml'><br /> <br /> <tree string = 'QingJiaDan'><br /> <br /> <field name = 'shenqr' select = '1'/><br /> <br /> <field name = 'tians'/><br /> <br /> <field name = 'kaisrq' select = '1'/><br /> <br /> <field name = 'shiyou'/><br /> <br /> <field name = 'state' select = '1'/><br /> <br /> </tree><br /> <br /> </field><br /> <br /> </record><br /> </data><br /><br /></openerp><br />
但是安装模块的时候出现了错误。<br />Client Traceback (most recent call last):<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\web\http.py", line 204, in dispatch<br /> response["result"] = method(self, **self.params)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\web\controllers\main.py", line 1129, in call_button<br /> action = self._call_kw(req, model, method, args, {})<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\web\controllers\main.py", line 1117, in _call_kw<br /> return getattr(req.session.model(model), method)(*args, **kwargs)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\web\session.py", line 42, in proxy<br /> result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\web\session.py", line 30, in proxy_method<br /> result = self.session.send(self.service_name, method, *args)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\web\session.py", line 103, in send<br /> raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)<br /><br /><br />Server Traceback (most recent call last):<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\web\session.py", line 89, in send<br /> return openerp.netsvc.dispatch_rpc(service_name, method, args)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\netsvc.py", line 292, in dispatch_rpc<br /> result = ExportService.getService(service_name).dispatch(method, params)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\service\web_services.py", line 626, in dispatch<br /> res = fn(db, uid, *params)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\osv\osv.py", line 188, in execute_kw<br /> return self.execute(db, uid, obj, method, *args, **kw or {})<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\osv\osv.py", line 131, in wrapper<br /> return f(self, dbname, *args, **kwargs)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\osv\osv.py", line 197, in execute<br /> res = self.execute_cr(cr, uid, obj, method, *args, **kw)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\osv\osv.py", line 185, in execute_cr<br /> return getattr(object, method)(cr, uid, *args, **kw)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\base\module\module.py", line 424, in button_immediate_install<br /> return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\addons\base\module\module.py", line 475, in _button_immediate_function<br /> _, pool = pooler.restart_pool(cr.dbname, update_module=True)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\pooler.py", line 39, in restart_pool<br /> registry = RegistryManager.new(db_name, force_demo, status, update_module)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\modules\registry.py", line 218, in new<br /> openerp.modules.load_modules(registry.db, force_demo, status, update_module)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\modules\loading.py", line 345, in load_modules<br /> processed = load_marked_modules(cr, graph, states_to_load, force, status, report, loaded_modules, update_module)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\modules\loading.py", line 256, in load_marked_modules<br /> loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\modules\loading.py", line 188, in load_module_graph<br /> load_data(module_name, idref, mode)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\modules\loading.py", line 76, in <lambda><br /> load_data = lambda *args: _load_data(cr, *args, kind='data')<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\modules\loading.py", line 124, in _load_data<br /> tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)<br /> File "E:\GreenOpenERP-7.0-20130628-231051\openerp\tools\convert.py", line 941, in convert_xml_import<br /> doc = etree.parse(xmlfile)<br /> File "lxml.etree.pyx", line 3196, in lxml.etree.parse (src\lxml\lxml.etree.c:64039)<br /> File "parser.pxi", line 1571, in lxml.etree._parseDocument (src\lxml\lxml.etree.c:91476)<br /> File "parser.pxi", line 1601, in lxml.etree._parseFilelikeDocument (src\lxml\lxml.etree.c:91798)<br /> File "parser.pxi", line 1484, in lxml.etree._parseDocFromFilelike (src\lxml\lxml.etree.c:90682)<br /> File "parser.pxi", line 1047, in lxml.etree._BaseParser._parseDocFromFilelike (src\lxml\lxml.etree.c:87736)<br /> File "parser.pxi", line 565, in lxml.etree._ParserContext._handleParseResultDoc (src\lxml\lxml.etree.c:83101)<br /> File "parser.pxi", line 656, in lxml.etree._handleParseResult (src\lxml\lxml.etree.c:84083)<br /> File "parser.pxi", line 596, in lxml.etree._raiseParseError (src\lxml\lxml.etree.c:83407)<br />XMLSyntaxError: error parsing attribute name, line 54, column 1<br />