Solved

Python Error - OpenERP Module

Posted on 2014-10-10
5
433 Views
Last Modified: 2014-10-24
Hi,

  I am new to Python and Openerp module creation.   I am learning from a tutorial, but can not install the first module because of an error.   Below is the error and the contents of all the files of the module.

 Please help to find out what i am doing wrong.

File :
__init__.py
import vetclinic

Open in new window

File :
__openerp__.py
{
    'name' : 'VetClinic',
    'version': '1.0',
    'description': """
	Vet Clinic Application
  	   - List of Animals
   	   - List of Breeds
           - Create appointments
  """,

     'author' : ' Greg',
     'website' : 'www.mysite.com',
     'depends' :['base_setup'],
     'data' : ['vetclinic_view.xml'],
     'demo' : [],
     'installable' : True,
     'auto_install' : False,
} 

Open in new window

File :
vetclinic.py
from osv import osv, fields
class vetclinic_animal(osv.Model):
    _name = "vetclinic.animal"
    _columns = {
 	'name':fields.char('Name',size=64),
        'birthdate' : fields.date('Birth Date'),
  }

Open in new window

File :
vetclinic_view.xml
<?xml version="1.0" encoding="utf-8"?>
 <openerp>
   <data> 
 	<record id="vetclinic_animal_action" model="ir.actions.act_window">
          <field name="name">Animals</field>
          <field name="res_model">vetclinic.animal</field<
          <field name="view_type">form</field>
          <field name="view_mode">tree,form</field>
          <field name="help" type="html">
 		<p class="oe_view_nocontent_create">Click create to add a new animal record</p>
	  </field>
	   
        </record>	


	 <menuitem id="vetclinic" name="Vet Clinic"/> 
         <menuitem id="vetclinic_menu"  name="Vet Clinic" parent = "vetclinic" />
         <menuitem id="vetclinic_animal_menu" 
		 name="Animals" 
	         parent="vetclinic_menu 
	         action="vetclinic_animal_action"
          />    

   </data>

</openerp>

Open in new window




Error:

Client Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\web\http.py", line 204, in dispatch
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\web\controllers\main.py", line 1132, in call_button
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\web\controllers\main.py", line 1120, in _call_kw
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\web\session.py", line 42, in proxy
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\web\session.py", line 30, in proxy_method
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\web\session.py", line 103, in send


Server Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\web\session.py", line 89, in send
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\netsvc.py", line 296, in dispatch_rpc
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\service\web_services.py", line 626, in dispatch
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\osv\osv.py", line 190, in execute_kw
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\osv\osv.py", line 132, in wrapper
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\osv\osv.py", line 199, in execute
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\osv\osv.py", line 187, in execute_cr
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\base\module\wizard\base_module_upgrade.py", line 90, in upgrade_module
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\pooler.py", line 39, in restart_pool
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\modules\registry.py", line 233, in new
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\modules\loading.py", line 354, in load_modules
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\modules\loading.py", line 256, in load_marked_modules
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\modules\loading.py", line 159, in load_module_graph
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\modules\module.py", line 405, in load_openerp_module
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\.\openerp\modules\module.py", line 133, in load_module
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\vetclinic\__init__.py", line 1, in <module>
  File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\vetclinic\vetclinic.py", line 3, in <module>
AttributeError: 'module' object has no attribute 'model'
0
Comment
Question by:joe_echavarria
  • 3
5 Comments
 
LVL 1

Author Comment

by:joe_echavarria
ID: 40399929
This is the error i am receiving

AttributeError: 'module' object has no attribute 'model'

 when installing the module.  It is OpenERP 7
0
 
LVL 1

Author Comment

by:joe_echavarria
ID: 40399939
This is the error i am receiving

AttributeError: 'module' object has no attribute 'model'
 File "C:\Program Files (x86)\OpenERP 7.0-20140622-231040\Server\server\openerp\addons\vetclinic\vetclinic.py", line 3, in <module>


When installing the module.  It is OpenERP 7.

I can not find the erro in that file, on that line.
0
 
LVL 1

Accepted Solution

by:
joe_echavarria earned 0 total points
ID: 40402932
I solved the problem.

I found the information in this link :

http://stackoverflow.com/questions/456867/attributeerror-module-object-has-no-attribute-model
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
This video teaches users how to migrate an existing Wordpress website to a new domain.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now