Odoo Help


need some help with the module Iam building

eoin ahern
on 3/15/14, 5:34 PM 775 views

Iam currently creating a module and can get it working as Iam finding the developer manual wording hard to follow. basically i have a class called Products.py and I have a Webcall.py class that makes a GET request to my localhost to return to a json object. the json returns fine when I test the class. but when I try to run the whole module nothing happens. I want the module to prepopulate the database of products on load of the module, with the data from the GET request. Once this is done i want this data diplayed in a simple tree view. I have checked the server log but it does flag any errors. below is my Products.py module.

from openerp.osv import osv,fields
import WebCall

class Products(osv.Model):
    _name = "products.products",
    _columns = {
        "name": fields.text("Prod Name", size=100),
        "code": fields.text("Code"),
        "sku": fields.text("SKU"),
        "description": fields.text("Description"),
        "salepricewithvat": fields.float("Sale Price + VAT"),
        "group": fields.float("Group"),
        "id": fields.text("ID"),
        "applicationid": fields.text("App ID"),

    _defaults = {}

    def init(self,cr):

        webcall = WebCall("my web url goes here!!")

        if webcall.checkrequest():
            print "test"

     def uploaddictionary(self, dictionary):

        for item in dictionary:

then i have the WebCall.py class which is just a regular python class

import json import urllib2 import exceptions

class WebCall(object):

 def __init__(self,url):
    self.url = url
    self.attdictionary = {}
    self.response =""

 def makecall(self):

    request = urllib2.Request(self.url)

        self.response = urllib2.urlopen(request,  timeout=10)
    except urllib2.HTTPError, error :
    except urllib2.URLError, error :
    except IOError,  error:

    return self.response

 def  checkrequest(self):
    return len(self.errors) > 0

 def createdict(self):

     if self.dict  == "":
         self.dict = json.load(self.response)

     return self.dict

then I have the .xml view file. I think this is where i have the issue because I dont really understand how to use the view correctly yet.

<?xml version="1.0"?>

    <record id="products_tree" model="ir.ui.view">
    <field name = "name">products.products.treeview</field>
    <field name= "model"> products.products</field>
    <field name="arch" type="xml">
    <tree string="prods" version="7.0">
        <field name="Name"   />
        <field  name="Code" />
        <field  name="SKU" />
        <field  name="Description" />
        <field   name="Sale Price + VAT" />
        <field   name="Group" />
        <field   name="ID" />
        <field   name="Application ID" />

    <record   model="ir.actions.act_window"
        <field name="name">products.products.action</field>
        <field name="res_model">products.products</field>
        <field name="view_type">tree</field>
        <field name="view_mode">form,tree</field>


    <menuitem id="main_item"  name="List Of Products"/>
    <menuitem id="main_item_child"   name="Products" parent="main_item"/>
    <menuitem id="main_item_option"   name="Products List" parent="main_item_child" action="myaction" />


the module just doesnt display in installed modules Ive looked a the .log file and this is what is returned in the latest log

2014-03-15 20:26:35,809 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:35] "POST /web/dataset/call_kw HTTP/1.1" 200 - 2014-03-15 20:26:36,368 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:36] "POST /web/dataset/call_kw HTTP/1.1" 200 - 2014-03-15 20:26:36,719 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:36] "POST /web/dataset/call_kw HTTP/1.1" 200 - 2014-03-15 20:26:38,190 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:38] "POST /web/dataset/search_read HTTP/1.1" 200 - 2014-03-15 20:26:51,002 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:51] "POST /web/dataset/search_read HTTP/1.1" 200 - 2014-03-15 20:26:52,608 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:52] "POST /web/dataset/call_kw HTTP/1.1" 200 - 2014-03-15 20:26:53,191 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:53] "POST /web/dataset/call_kw HTTP/1.1" 200 - 2014-03-15 20:26:53,627 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:53] "POST /web/dataset/call_kw HTTP/1.1" 200 - 2014-03-15 20:26:54,153 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:54] "POST /web/dataset/call_kw HTTP/1.1" 200 - 2014-03-15 20:26:55,871 2872 INFO absyla werkzeug: - - [15/Mar/2014 20:26:55] "POST /web/dataset/search_read HTTP/1.1" 200 -

so essentially it doesnt show me that there is an error? Iam kind of lost with this so if anyone can help Id really appreciate it

What about your __init__.py and __openerp__.py files ?

Med Said BARA
on 3/15/14, 7:06 PM

didnt think the were as important TBH. here they are though

eoin ahern
on 3/15/14, 7:56 PM

{ 'name': 'Plugin', 'version': '1.0.0', 'author': 'me', 'description': ' Plugin written in python', 'category': 'plugin', 'website': '', 'depends': ['base'], 'data': ['Products_view.xml'], 'demo':[], 'installable': True,

eoin ahern
on 3/15/14, 7:56 PM

import Products,WebCall

eoin ahern
on 3/15/14, 7:58 PM

above are the __init__.py and __openerp__.py files. honestly i dont think thats where the issue is

eoin ahern
on 3/15/14, 8:00 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 3/15/14, 5:34 PM
Seen: 775 times
Last updated: 3/16/15, 8:10 AM