2017-04-09 72 views
0

我試圖解決openERP 6.1中自定義模塊上的安裝問題。openErp 6.1 AttributeError:'NoneType'對象在自定義模塊安裝時沒有屬性'_columns'

我得到這個錯誤:

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' 

我asume這是對我的模型定義的一個問題,但我沒能找到問題出在哪裏。

這是型號代碼:

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文件中的模塊依賴關係,並且一切似乎都沒有問題。

請問,有人可以幫助我嗎?

非常感謝。

+0

乍一看,這是正確的。 ** __ init __。py **包含你的模塊,是嗎? –

+0

是的,這是我的** __ init的內容__。py **文件: 'import adventure_sports' – Tricoman

回答

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> 
相關問題