Solved

Python Error - OpenERP Module

Posted on 2014-10-10
5
440 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

776 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