continua a non funzionarmi
allora ho creato i tre file :
__init__.py
import ricette
__openerp__.py
{
"name" : "Ricettario",
"version" : "0.1",
"depends" : ["base"],
"author" : "Maila",
"description": """Un piccolo modulo per archiviare le ricette...
""",
'init_xml': [],
'update_xml': ["ricette.xml"],
'demo_xml': [],
'installable': True,
'active': False
}
ricette.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp >
<data >
<record id="view_ricette_ricetta_form" model="ir.ui.view" >
<field name="name" >ricette.ricetta.form</field >
<field name="model" >ricette.ricetta</field >
<field name="type" >form</field >
<field name="arch" type="xml" >
<form string="Ricette" >
<group col="1" colspan="2" >
<field name="titolo" select="1"/ >
<field name="tipo" select="1" / >
<field name="descrizione" select="1"/ >
<field name="difficolta" select="1"/ >
<field name="min_preparazione"/ >
</group >
<group col="3" colspan="2" >
<field name="immagine" widget="image"/ >
</group >
<separator colspan="4" string="Ingredienti"/ >
<field name="ingredienti" colspan="4"/ >
<separator colspan="4" string="Preparazione"/ >
<field name="preparazione" / >
</form >
</field >
</record >
<record model="ir.ui.view" id="view_ricette_ricetta_tree" >
<field name="name" >ricette.ricetta.tree</field >
<field name="model" >ricette.ricetta</field >
<field name="type" >tree</field >
<field name="arch" type="xml" >
<tree string="Ricette" >
<field name="tipo" select="1" / >
<field name="titolo" select="1"/ >
<field name="difficolta" select="1"/ >
<field name="min_preparazione"/ >
<field name="descrizione" select="1"/ >
</tree >
</field >
</record >
<record model="ir.actions.act_window" id="action_ricette_ricetta" >
<field name="name" >Ricettario</field >
<field name="res_model" >ricette.ricetta</field >
<field name="view_type" >form</field >
<field name="view_mode" >tree,form</field >
</record >
<menuitem name="Esempi" id="menu_esempi" / >
<menuitem name="Ricette" id="menu_ricette" parent="menu_esempi"/ >
<menuitem name="Ricetta" id="menu_ricetta_form" parent="menu_ricette" action="action_ricette_ricetta"/ > (questo era tutto sulla stessa riga)
</data >
</openerp >
ricette.py
from osv import fields, osv
class ricette_ricetta(osv.osv):
_name = "ricette.ricetta"
_description = "Ricetta"
_columns = {
'titolo': fields.char('Titolo', size=80, translate=True, required=True),
'descrizione': fields.char('Breve descrizione', size=150, translate=True, required=True),
'tipo': fields.selection([('antipasto', 'antipasto'), ('primo', 'primo piatto'),
('secondo', 'secondo piatto'), ('contorno', 'contorno'),
('dolce','dolce')], 'Tipo di piatto'),
'difficolta': fields.selection([(1, 'facile'), (2, 'media'),
(3, 'difficile'), (4, 'molto difficile')], 'Difficoltà'),
'min_preparazione': fields.integer('Tempo di preparazione (min)'),
'ingredienti': fields.text('Lista ingredienti', ),
'preparazione': fields.text('Descrizione', required=True),
'immagine': fields.binary('Immagine'),
}
ricette_ricetta()
l'errore è sempre
Traceback (most recent call last):
File "/home/maila/lp/openerp/server/bin/netsvc.py", line 489, in dispatch
result = ExportService.getService(service_name).dispatch(method, auth, params)
File "/home/maila/lp/openerp/server/bin/service/web_services.py", line 599, in dispatch
res = fn(db, uid, *params)
File "/home/maila/lp/openerp/server/bin/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/maila/lp/openerp/server/bin/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/maila/lp/openerp/server/bin/osv/osv.py", line 167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/maila/lp/openerp/server/bin/addons/base/module/wizard/base_module_upgrade.py", line 98, in upgrade_module
_db, pool = pooler.restart_pool(cr.dbname, update_module=True)
File "/home/maila/lp/openerp/server/bin/pooler.py", line 60, in restart_pool
return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
File "/home/maila/lp/openerp/server/bin/pooler.py", line 39, in get_db_and_pool
addons.load_modules(db, force_demo, status, update_module)
File "/home/maila/lp/openerp/server/bin/addons/__init__.py", line 883, in load_modules
processed_modules.extend(load_module_graph(cr, graph, status, report=report, skip_modules=processed_modules))
File "/home/maila/lp/openerp/server/bin/addons/__init__.py", line 748, in load_module_graph
load_init_update_xml(cr, m, idref, mode, kind)
File "/home/maila/lp/openerp/server/bin/addons/__init__.py", line 641, in load_init_update_xml
tools.convert_xml_import(cr, m, fp, idref, mode=mode, **kwargs)
File "/home/maila/lp/openerp/server/bin/tools/convert.py", line 961, in convert_xml_import
doc = etree.parse(xmlfile)
File "lxml.etree.pyx", line 2942, in lxml.etree.parse (src/lxml/lxml.etree.c:54187)
File "parser.pxi", line 1550, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:79703)
File "parser.pxi", line 1580, in lxml.etree._parseFilelikeDocument (src/lxml/lxml.etree.c:80012)
File "parser.pxi", line 1463, in lxml.etree._parseDocFromFilelike (src/lxml/lxml.etree.c:78908)
File "parser.pxi", line 1019, in lxml.etree._BaseParser._parseDocFromFilelike (src/lxml/lxml.etree.c:75905)
File "parser.pxi", line 564, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:71739)
File "parser.pxi", line 645, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:72614)
File "parser.pxi", line 585, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:71955)
XMLSyntaxError: XML declaration allowed only at the start of the document, line 1, column 7
certo qui le formattazioni si vanno a benedire..uff... sarà questo il problema ma non individuo