0

我正在尝试解决 openERP 6.1 中自定义模块的安装问题。

我收到此错误:

    Server Traceback (most recent call last):
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\openerp\addons\web\common\http.py", line 593, in send
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\netsvc.py", line 360, in dispatch_rpc
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\service\web_services.py", line 586, in dispatch
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\osv\osv.py", line 186, in execute_kw
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\osv\osv.py", line 129, in wrapper
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\osv\osv.py", line 195, in execute
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\osv\osv.py", line 183, in execute_cr
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\openerp\addons\base\module\wizard\base_module_upgrade.py", line 101, in upgrade_module
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\pooler.py", line 39, in restart_pool
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\modules\registry.py", line 202, in new
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\modules\loading.py", line 338, in load_modules
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\modules\loading.py", line 253, in load_marked_modules
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\modules\loading.py", line 192, in load_module_graph
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\modules\loading.py", line 90, in <lambda>
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\modules\loading.py", line 138, in _load_data
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\tools\convert.py", line 998, in convert_xml_import
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\tools\convert.py", line 890, in parse
  File "C:\Archivos de programa\OpenERP 6.1-20140210-004940\Server\server\.\openerp\tools\convert.py", line 818, in _tag_record AttributeError: 'NoneType' object has no attribute '_columns'

我认为这是我的模型定义的问题,但我无法找到问题所在。

这是模型代码:

 from osv import osv, fields 
from tools.translate import _

from datetime import date

import time


class adventure_sports_sport_type(osv.osv):
    _name = 'adventure_sports.sport_type'
    _columns = {
        'name': fields.char('name', size=64, required=True, translate=True, help='The name of the sport'),
        'level': fields.selection([('aHigh', 'High'), ('aMedium', 'Medium'), ('cLow', 'Low')], 'level',
                                  required=True),
        'activities': fields.one2many('adventure_sports.activity', 'sport_type_id', 'Activities')
    }
    _defaults = {
        'level': lambda *a: 'medium',
    }
    _order = 'name, level'
adventure_sports_sport_type()


class adventure_sports_activity(osv.osv):
    _name = 'adventure_sports.activity'
    _columns = {
        'name': fields.char('Activity name', size=64, required=True, translate=True, help='The name of the activity'),
        'sport_type_id': fields.many2one('adventure_sports.sport_type', 'Sport type', ondelete='cascade',
                                         help='sport_type_id'),
        'current': fields.boolean('Current'),
        'is_available_monday': fields.boolean('Monday'),
        'is_available_tuesday': fields.boolean('Tuesday'),
        'is_available_wednesday': fields.boolean('Wednesday'),
        'is_available_thursday': fields.boolean('Thursday'),
        'is_available_friday': fields.boolean('Friday'),
        'is_available_saturday': fields.boolean('Saturday'),
        'is_available_sunday': fields.boolean('Sunday'),
        'start_time': fields.float('Start time'),
        'end_time': fields.float('End time'),
        'images': fields.one2many('adventure_sports.image', 'activity_id', 'Images'),
    }
    _defaults = {
        'is_active': True,
    }
adventure_sports_activity()


class adventure_sports_activity_image(osv.osv):
    _name = 'adventure_sports.activity_image'
    _columns = {
        'image': fields.binary('Image', filters='*.png,*.jpg,*.gif'),
        'description': fields.char('Description', size=500, required=True, translate=True),
        'activity_id': fields.many2one('adventure_sports.activity', 'Activity', readonly=True)
    }
adventure_sports_activity_image()

这是视图:

    <?xml version="1.0"?>
<openerp>
<data>

    <record model="ir.ui.view" id="view_activities_catalog_tree">
        <field name="name">view.activities.catalog.tree</field>
        <field name="model">adventure_sports.activity</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="view.activities.catalog.tree" editable="bottom">
                <field name="name"/>
                <field name="level"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="view_activities_catalog_search">
        <field name="name">view.activities.catalog.search</field>
        <field name="model">adventure_sports.activity</field>
        <field name="type">search</field>
        <field name="arch" type="xml">
            <search string="Catalog Activities">
                <group col="6" colspan="4">
                    <filter string="MONDAY" icon="terp-go-today" domain="[('is_available_monday', '=', True)]"/>
                    <filter string="TUESDAY" icon="terp-go-today" domain="[('is_available_tuesday', '=', True)]"/>
                    <filter string="WEDNESDAY" icon="terp-go-today" domain="[('is_available_wednesday', '=', True)]"/>
                    <filter string="THURSDAY" icon="terp-go-today" domain="[('is_available_thursday', '=', True)]"/>
                    <filter string="FRIDAY" icon="terp-go-today" domain="[('is_available_friday', '=', True)]"/>
                    <filter string="SATURDAY" icon="terp-go-today" domain="[('is_available_saturday', '=', True)]"/>
                    <filter string="SUNDAY" icon="terp-go-today" domain="[('is_available_sunday', '=', True)]"/>
                    <field name="sport_type_id" widget="selection"/>
                    <field name="name"/>
                    <field name="current" widget="selection"/>
                </group>
                <field name="images" select="1"/>
            </search>
        </field>
    </record>

    <record model="ir.actions.act_windows" id="action_activities_catalog">
        <field name="name">action.activities.catalog</field>
        <field name="res_model">adventure_sports.activity</field>
        <field name="view_type">form</field>
        <field name="view_mode">search,tree</field>
    </record>


    <record model="ir.ui.view" id="view_sport_types_tree">
        <field name="name">sport.type.tree</field>
        <field name="model">adventure_sports.sport_type</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="adventure_sports.sport_type" editable="bottom">
                <field name="name"/>
                <field name="level"/>
            </tree>
        </field>
    </record>

    <record model="ir.actions.act_window" id="action_sport_types">
        <field name="name">Sport Types</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="res_model">adventure_sports.sport_type</field>
    </record>

    <menuitem
            id="adventure_sports_menu"
            name="Adventure Sports"
            web_icon="icons/adventure_sports.png"
            web_icon_hover="icons/adventure_sports_hover.png"
    />
    <menuitem
        id="configuration_menu"
        name="Configuration"
        parent="adventure_sports_menu"
    />
    <menuitem
        id="sport_types"
        name="Sport Types"
        action="action_sport_types"
        parent="configuration_menu"
    />
    <menuitem
        id="catalog_activities"
        name="Catalog Activities"
        action="action_activities_catalog"
        parent="configuration_menu"
    />
</data>
</openerp>

这是我的 __openerp__.py 文件:

{
    'name': 'Adventure Sports',
    'version': '1.0',
    'category': 'Adventure Sports',
    'description': """Adventure Sports administration module""",
    'author': 'Unknow',
    'website': 'http://www.arnaubiosca.com',
    'depends': ['base'],
    'init_xml': [],
    'update_xml': ['adventure_sports.xml'],
    'demo_xml': [],
    'installable': True
}

我检查了 openerp.py 文件中的模块依赖关系,一切似乎都很好。

请问,有人可以帮我吗?

非常感谢。

4

1 回答 1

0

解决了!这是 xml 中的拼写问题:

我改变了这个:

<record model="ir.actions.act_windows" id="action_activities_catalog">
        <field name="name">action.activities.catalog</field>
        <field name="res_model">adventure_sports.activity</field>
        <field name="view_type">form</field>
        <field name="view_mode">search,tree</field>
 </record>

为了这:

<record model="ir.actions.act_window" id="action_activities_catalog">
        <field name="name">action.activities.catalog</field>
        <field name="res_model">adventure_sports.activity</field>
        <field name="view_type">form</field>
        <field name="view_mode">search,tree</field>
 </record>
于 2017-04-09T15:16:20.633 回答