test004
-
官方的 travel 你们能用吗? -
官方的 travel 你们能用吗?官方怎么没有一个比较完整的 模块呢? 好奇怪.
-
官方的 travel 你们能用吗?谢谢 [color=#666666][size=99px][color=#666666][size=99px]
[color=#666666][size=99px]
[color=#666666][size=99px] -
官方的 travel 你们能用吗?doc.openerp.com/developer/2_First_Module/2_module.html#changing-the-main-module-file
我按这个做的.
建了个 terp.py
[code]
-- encoding: utf-8 --
{
"name" : "Travel agency module",
"version" : "1.0",
"author" : "Tiny",
"category" : "Generic Modules/Others",
"website": "www.openerp.com",
"description": "A module to manage hotel bookings and a few other useful features.",
"depends" : ["base"],
"init_xml" : [],
"update_xml" : ["custom_view.xml"],
"active": True,
"installable": True
}
[/code]init.py
[code]
-- encoding: utf-8 --
import custom
[/code]
custom.py
[code]-- encoding: utf-8 --
from osv import osv, fields
class travel_hostel(osv.osv):
_name = 'travel.hostel'
_inherit = 'res.partner'
_columns = {
'rooms_id': fields.one2many('travel.room', 'hostel_id', 'Rooms'),
'quality': fields.char('Quality', size=16),
}
_defaults = {
}
travel_hostel()
[/code]custom_view.xml
[code]
<openerp>
<data>
<record model="res.groups" id="group_compta_user">
<field name="name">grcompta</field>
</record>
<record model="res.groups" id="group_compta_admin">
<field name="name">grcomptaadmin</field>
</record>
<menuitem name="Administration" groups="admin,grcomptaadmin" icon="terp-stock" id="menu_admin_compta"/>
</data>
</openerp>
[/code]traval_view.xml
[code]
<openerp>
<data>
<record model="ir.actions.act_window" id="action_travel_hostel_form">
<field name="name">Hostel</field>
<field name="res_model">travel.hostel</field>
<field name="view_mode">form,tree</field>
</record>
<menuitem name="Travel Agency"
id="menu_travel"/>
<menuitem name="Hostels"
id="menu_travel_hostel_form"
action="action_travel_hostel_form" parent="menu_travel"/>
<record model="ir.actions.act_window" id="action_travel_room_form">
<field name="name">Room</field>
<field name="res_model">travel.room</field>
<field name="view_mode">form,tree</field>
</record>
<menuitem name="Rooms"
id="menu_travel_room_form"
action="action_travel_room_form" parent="menu_travel"/>
<record model="ir.actions.act_window" id="action_travel_room_form1">
<field name="name">Single Rooms</field>
<field name="res_model">travel.room</field>
<field name="domain">[('beds','=',1)]</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Single rooms"
id="menu_travel_room_form1"
action="action_travel_room_form1" parent="menu_travel_room_form"/>
<record model="ir.actions.act_window" id="action_travel_room_form2">
<field name="name">Double Rooms</field>
<field name="res_model">travel.room</field>
<field name="domain">[('beds','=',2)]</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Double rooms"
id="menu_travel_room_form2"
action="action_travel_room_form2" parent="menu_travel_room_form"/>
</data>
</openerp>
[/code]然后 安装 该模块时. 出现错误.
[code]
Traceback (most recent call last):
File "netsvc.pyo", line 231, in dispatch
File "netsvc.pyo", line 74, in call
File "serviceweb_services.pyo", line 537, in execute
File "serviceweb_services.pyo", line 517, in execute
File "wizard__init_.pyo", line 178, in execute
File "wizard__init__.pyo", line 74, in execute_cr
File "C:Program FilesOpenERP AllInOneServeraddonsbasemodulewizardwizard_module_upgrade.py", line 92, in upgrade_module
File "pooler.pyo", line 61, in restart_pool
File "pooler.pyo", line 40, in get_db_and_pool
File "addons__init_.pyo", line 704, in load_modules
File "addons__init__.pyo", line 605, in load_module_graph
File "toolsconvert.pyo", line 881, in convert_xml_import
File "toolsconvert.pyo", line 775, in parse
File "toolsconvert.pyo", line 573, in _tag_menuitem
File "toolsconvert.pyo", line 756, in id_get
File "toolsmisc.pyo", line 640, in cached_result
File "C:Program FilesOpenERP AllInOneServeraddonsbaseirir_model.py", line 416, in _get_id
IndexError: list index out of range[/code]
问下怎么解决? 谢谢大家.