Odoo Help

Welcome!

This community 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.

0

I can´t install my Module (My Module crash Odoo)

By
Patrick
on 11/29/16, 4:44 AM 113 views

Hi i have a Problem :
I made a Modul for Odoo (Ver. 9 ) , this Modul Imports Products over Itscope API and XMLRPC.
When i want to install this Modul , Odoo is only loading a long time.
This is the Loading Screen :
 https://picload.org/image/rarigcra/modul.png
The folder structure is:
     - ->demo:
         -->demo.xml
    -->models:
       -->__init__.py
       -->models.py
      -->models.xml
   -->security:
       -->ir.model.access.csv
   -->__init__.py
  -->__openerp__.py
This are the Files:
models.py

# -*- encoding: utf-8 -*-
#Description: ITScope Modul für Odoo
#Dev: Patrick Mitteregger
from openerp import osv, fields, api
from openerp.tools.translate import _
from httplib import *
from base64 import b64encode
import libxml2import
xmlrpcliburl = 'XXXXXXXXXXX'
username = 'XXXXXX'
pwd = 'XXXXXXXXXX'
dbname = 'XXXXXXXXX'
sock_common = xmlrpclib.ServerProxy('{}/xmlrpc/common'.format(url))
login = sock_common.login(dbname,username,pwd)
sock = xmlrpclib.ServerProxy('{}/xmlrpc/object'.format(url))
product = 'product.template'
accountID = "XXXXXX"
apiKey = "XXXXXXXX"
ean = 0
class product_search(osv.osv):
########################################################################
#Auswahl des Nutzers (Über Formular) auslesen und in Variablen speichern#
#########################################################################
_name = 'itscope_modul.itscope_modul'
eanumber = fields.Float('EAN',required=True,string="Ean")
language = fields.Char('Language',default="de",string="lang")
@api.one def
search_prod():
#########################################################################
#Mit der ItScope API verbinden und die Infos vom Produkt holen #
 #########################################################################
try:
headers = {'Authorization' : 'Basic %s' % base64.b64encode(accountID+ ':'+ apiKey), 'Accept-Language' : language}
url = "https://api.itscope.com/2.0" Get = "/products/ean/" + eanumber + "/standard." + "xml"
req = urllib2.Request(url + Get,headers=headers)
response = urllib2.urlopen(req)
itscope = response.read()
xmlread = libxml2.parseDoc(itscope)
# Antwort-XML Feld auswahl
eancode = xmlread.xpathEval('/products/product/ean')
prodname = xmlread.xpathEval('/products/product/supplierItems/supplierItem/productName')
manuf = xmlread.xpathEval('/products/product/supplierItems/supplierItem/manufacturerName ')
description = xmlread.xpathEval('/products/product/longDescription')
pricelist = xmlread.xpathEval('/products/product/price')
except Exception,e:
print str(e)
#########################################################################
#Die Infos zum Produkt in die Datenbank eintragen #
#########################################################################
try:
product_colum={ 'barcode': eancode[0].content, 'name' : prodname[0].content, 'list_price' : pricelist[0].content, 'manufacture': manuf[0].content, 'description_sale' : description[0].content }
prodimport = sock.execute(dbname,login,pwd,product,'create',product_colum)
print "Produkt wurde erfolgreich eingetragen"
except Exception ,e :
print str(e)

models.xml:

<?xml version='1.0' encoding='utf-8'?>
<openerp>
<data>
<record id="itscope_modul_wizard" model="ir.ui.view">
<field name="name">itscope.modul.wizard.form</field>
<field name="model">itscope.modul.wizard</field>
<field name="arch" type="xml">
<form string="Import Itscope" version="0.1">
<group col="4" colspan="4" attrs="{'invisible':[('state','=','done')]}">
<label string="Willkommen beim Itscope Import" colspan="4"/>
<field name="Ean"/><newline/>
<field name="Language"/><newline/>
 </group>
<group col="2" colspan="4">
<field name="state" invisible="1"/>
<button string="Cancel" special="cancel" icon="gtk-cancel" states="first"/>
<button string="import" name="search_prod" type="object" icon="gtk-ok" states="first"/>
<button string="Close" special="cancel" icon="gtk-ok" states="done"/>
</group>
</form>
</field>
</record>
<act_window name="Import Itscope" res_model="itscope.modul.wizard" src_model="product.product" view_mode="form" target="new" key2="client_action_multi" id="itscope_modul_act"/>
</data>
</openerp>
0
Patrick
On 11/30/16, 8:32 AM

I solved the Problem. The Problem was the installed Odoo not my Module.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/29/16, 4:44 AM
Seen: 113 times
Last updated: 11/30/16, 8:32 AM