user5109824 user5109824 - 3 months ago 38
Python Question

Odoo Server Error ubuntu

When try install any module get this error.

Odoo Server Error

Traceback (most recent call last):
File "/home/nolimit/git/odoo/openerp/http.py", line 648, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/nolimit/git/odoo/openerp/http.py", line 685, in dispatch
result = self._call_function(**self.params)
File "/home/nolimit/git/odoo/openerp/http.py", line 321, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/nolimit/git/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/nolimit/git/odoo/openerp/http.py", line 314, in checked_call
result = self.endpoint(*a, **kw)
File "/home/nolimit/git/odoo/openerp/http.py", line 964, in __call__
return self.method(*args, **kw)
File "/home/nolimit/git/odoo/openerp/http.py", line 514, in response_wrap
response = f(*args, **kw)
File "/home/nolimit/git/odoo/addons/web/controllers/main.py", line 892, in call_button
action = self._call_kw(model, method, args, {})
File "/home/nolimit/git/odoo/addons/web/controllers/main.py", line 880, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/home/nolimit/git/odoo/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/nolimit/git/odoo/openerp/addons/base/module/module.py", line 459, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "/home/nolimit/git/odoo/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/nolimit/git/odoo/openerp/addons/base/module/module.py", line 533, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "/home/nolimit/git/odoo/openerp/modules/registry.py", line 386, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/nolimit/git/odoo/openerp/modules/loading.py", line 338, in load_modules
loaded_modules, update_module)
File "/home/nolimit/git/odoo/openerp/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/home/nolimit/git/odoo/openerp/modules/loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/home/nolimit/git/odoo/openerp/modules/loading.py", line 98, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/home/nolimit/git/odoo/openerp/tools/convert.py", line 851, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/home/nolimit/git/odoo/openerp/tools/convert.py", line 917, in convert_xml_import
doc = etree.parse(xmlfile)
File "lxml.etree.pyx", line 3239, in lxml.etree.parse (src/lxml/lxml.etree.c:69955)
File "parser.pxi", line 1769, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:102257)
File "parser.pxi", line 1789, in lxml.etree._parseFilelikeDocument (src/lxml/lxml.etree.c:102516)
File "parser.pxi", line 1684, in lxml.etree._parseDocFromFilelike (src/lxml/lxml.etree.c:101442)
File "parser.pxi", line 1134, in lxml.etree._BaseParser._parseDocFromFilelike (src/lxml/lxml.etree.c:97069)
File "parser.pxi", line 582, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:91275)
File "parser.pxi", line 683, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:92461)
File "parser.pxi", line 622, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:91757)
XMLSyntaxError: StartTag: invalid element name, line 8, column 4


Any solution how fix this problem?

Structure of module

Folder: daily_transaction

init.py

daily_transaction


openerp.py

{
'name': 'Daily Transaction Manager',
'version': '1.0',
'author': 'Lionel Messi',
'complexity': 'normal',
'description': 'New module',
'category': '',
'depends': [],
'data': ['daily_transaction_view.xml'],
'auto_install': False,
'installable': True,
'external_dependencies': {
'python': [],
},
}


daily_transaction.py

from openerp.osv import fields, osv

class daily_transaction(osv.osv):
_name = "daily.transaction"
_description = "Daily Transaction"

_colums = {
'subject': fields.char('Subject', size=128, required=True),
'date': fields.date('Date', required=True),
'note': fields.text('Notes'),
'amount': fields.float('Amount', required=True),
'type': fields.selection([
('transport', 'Transport'),
('household','Household'),
('personal', 'Personal'),
],'Type', required=True),
}


daily_transaction_view.xml



<openerp>
<data>
<!--Daily Transaction List View-->
<record id="view_daily_transaction_tree" model="ir.ui.view">

<!– here id is the external id for this tree view which must be unique and will be used for accessing this record -->
<field name="name">daily.transaction.tree</field>

<!– this will be our name of record in ir.ui.view -->
<field name="model">daily.transaction</field>

<!– this will map out tree view with our daily transaction model -->
<field name="arch" type="xml">
<!-- this will be our title of list/tree view -->
<tree string="Daily Transaction"> <!-- these will automatically map table headers for our list view, so we’ll select out column names of our model here -->
<field name="name"/>
<field name="date"/>
<field name="type"/>
<field name="amount"/>
</tree>
</field>
</record>

<!--Daily Transaction Form View-->

<record id="view_daily_transaction_form" model="ir.ui.view">
<field name="name">daily.transaction.form.view</field>
<field name="model">daily.transaction</field>
<field name="arch" type="xml">
<!-- this will be our title of list/tree view -->
<form string="Daily Transaction" version="7.0">
<group>
<field name="name"/>
<field name="date"/>
<field name="type"/>
<field name="amount"/>
<field name="note"/>
</group>
</form>
</field>
</record>

<record id="action_daily_transaction" model="ir.actions.act_window">
<field name="name">Daily Transaction</field>
<!– name of action -->
<field name="res_model">daily.transaction</field>
<!– this action will be mapped to model specified -->
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<!-- these are type of view our module will show for our daily transaction mode -->
<field name="search_view_id" eval="False"/>
<!– here we specify id of our search view -->
<field name="context">{}</field>
<field name="help">Create new daily transaction.</field>
<!– help text for our model -->
</record>

</data>
</openerp>


What is that? https://postimg.cc/image/csxssd7tx/

Module --> https://postimg.cc/image/gk1uyb0vn/

Answer

It seems like you forget to declare name field on your Class.

You can resolve it with following two option:

  1. Add name field on your class daily_transaction OR
  2. You may change field definition like

    'name': fields.char('Subject', size=128, required=True), 
    

Afterwards, restart your reserver and upgrade module.