Skip to Content
Menu
This question has been flagged

I have a module that I've been developing (on a Windows 7 computer) that I've been testing on a Windows 7 Odoo 9 server. When I was satisfied enough with the module, I attempted to deploy to a Debian 8 Odoo 9 server, but was presented with a lovely "Model not found" error.

Files were copied directly from the Windows server (excluding the .pyc files) into the appropriate path on the Linux server and permissions are correctly applied. Both servers are also fully up to date.

This error happens when the module is updated and also when the module is installed fresh. 

The behavior that I want is for 'metrics.warehouse.crt' to have its own table and pull the _inherit-ed fields from both 'metrics.metrics' and 'metrics.warehouse' (as it is, it does this on the Windows server). I have also changed the order in the _inherit list; Though I doubt that has any cause as removing the _inherit list entirely (copying the needed fields from metrics.metrics and metrics.warehouse) results in the same error.


This is an excerpt from my log

2015-12-14 19:25:04,523 32223 INFO [Company] openerp.modules.loading: loading 1 modules...

2015-12-14 19:25:04,533 32223 INFO [Company] openerp.modules.loading: 1 modules loaded in 0.01s, 0 queries

2015-12-14 19:25:04,570 32223 INFO [Company] openerp.modules.loading: loading 58 modules...

2015-12-14 19:25:04,619 32223 INFO [Company] openerp.modules.module: module metrics: creating or updating database tables

2015-12-14 19:25:04,703 32223 INFO [Company] openerp.modules.loading: loading metrics/security/ir.model.access.csv

2015-12-14 19:25:04,799 32223 INFO [Company] openerp.modules.loading: loading metrics/security/metrics_security.xml

2015-12-14 19:25:04,803 32223 INFO [Company] openerp.modules.loading: loading metrics/templates.xml

2015-12-14 19:25:04,804 32223 INFO [Company] openerp.modules.loading: loading metrics/views.xml

2015-12-14 19:25:04,812 32223 INFO [Company] openerp.modules.loading: loading metrics/views/techroom.xml

2015-12-14 19:25:04,835 32223 WARNING [Company] openerp.models: ir.ui.view.write() with unknown fields: view_type

2015-12-14 19:25:04,875 32223 INFO [Company] openerp.modules.loading: loading metrics/views/sorting.xml

2015-12-14 19:25:04,878 32223 WARNING [Company] openerp.models: ir.ui.view.write() with unknown fields: view_type

2015-12-14 19:25:04,894 32223 WARNING [Company] openerp.models: ir.ui.view.write() with unknown fields: view_type

2015-12-14 19:25:04,934 32223 INFO [Company] openerp.modules.loading: loading metrics/views/inboundsales.xml

2015-12-14 19:25:04,953 32223 WARNING [Company] openerp.models: ir.ui.view.write() with unknown fields: view_type

2015-12-14 19:25:04,993 32223 INFO [Company] openerp.modules.loading: loading metrics/views/lister.xml

2015-12-14 19:25:05,011 32223 WARNING [Company] openerp.models: ir.ui.view.write() with unknown fields: view_type

2015-12-14 19:25:05,050 32223 INFO [Company] openerp.modules.loading: loading metrics/views/shipping.xml

2015-12-14 19:25:05,068 32223 WARNING [Company] openerp.models: ir.ui.view.write() with unknown fields: view_type

2015-12-14 19:25:05,108 32223 INFO [Company] openerp.modules.loading: loading metrics/views/warehouse/crt.xml

2015-12-14 19:25:05,129 32223 INFO [Company] openerp.addons.base.ir.ir_ui_view: Model not found: metrics.warehouse.crt

Error context:

View `metrics Warehouse CRT`

[view_id: 1486, xml_id: n/a, model: metrics.warehouse.crt, parent_id: n/a]

2015-12-14 19:25:05,134 32223 INFO [Company] werkzeug: 10.2.2.37 - - [14/Dec/2015 19:25:05] "POST /web/webclient/version_info HTTP/1.1" 500 -

2015-12-14 19:25:05,151 32223 INFO ? openerp.service.server: Initiating shutdown

2015-12-14 19:25:05,151 32223 INFO ? openerp.service.server: Hit CTRL-C again or send a second signal to force the shutdown.

2015-12-14 19:25:05,162 32223 ERROR [Company] werkzeug: Error on request:

Traceback (most recent call last):

File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi

execute(self.server.app)

File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute

application_iter = app(environ, start_response)

File "/usr/lib/python2.7/dist-packages/openerp/service/server.py", line 245, in app

return self.app(e, s)

File "/usr/lib/python2.7/dist-packages/openerp/service/wsgi_server.py", line 184, in application

return application_unproxied(environ, start_response)

File "/usr/lib/python2.7/dist-packages/openerp/service/wsgi_server.py", line 170, in application_unproxied

result = handler(environ, start_response)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1422, in __call__

return self.dispatch(environ, start_response)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1396, in __call__

return self.app(environ, start_wrapped)

File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__

return self.app(environ, start_response)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1571, in dispatch

ir_http = request.registry['ir.http']

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 360, in registry

return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None

File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 354, in get

update_module)

File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 385, in new

openerp.modules.load_modules(registry._db, force_demo, status, update_module)

File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 333, in load_modules

force, status, report, loaded_modules, update_module)

File "/usr/lib/python2.7/dist-packages/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 "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 156, in load_module_graph

_load_data(cr, module_name, idref, mode, kind='data')

File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 98, in _load_data

tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)

File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 852, in convert_file

convert_xml_import(cr, module, fp, idref, mode, noupdate, report)

File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 939, in convert_xml_import

obj.parse(doc.getroot(), mode=mode)

File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 802, in parse

self.parse(rec, mode)

File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 805, in parse

self._tags[rec.tag](self.cr, rec, de, mode=mode)

File "/usr/lib/python2.7/dist-packages/openerp/tools/convert.py", line 709, in _tag_record

id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_model.py", line 1101, in _update

res_id = model_obj.create(cr, uid, values, context=context)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_ui_view.py", line 351, in create

context=context)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 342, in old_api

result = method(recs, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4132, in create

record = self.browse(self._create(old_vals))

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper

return new_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 478, in new_api

result = method(self._model, cr, uid, *args, **old_kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4323, in _create

recs._validate_fields(vals)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper

return new_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 1272, in _validate_fields

raise ValidationError('\n'.join(errors))

ParseError: "Invalid view definition

Error details:

Model not found: metrics.warehouse.crt

Error context:

View `metrics Warehouse CRT`

[view_id: 1486, xml_id: n/a, model: metrics.warehouse.crt, parent_id: n/a]

None" while parsing /usr/lib/python2.7/dist-packages/openerp/addons/metrics/views/warehouse/crt.xml:6, near

<record model="ir.ui.view" id="metrics.listWarehouseCRT">

<field name="name">metrics Warehouse CRT</field>

<field name="model">metrics.warehouse.crt</field>

<field name="arch" type="xml">

<tree>

<field name="id"/>

<field name="m_row"/>

<field name="m_date"/>

<field name="m_item"/>

<field name="m_scrap"/>

<field name="m_value"/>

<field name="m_employee_id"/>

</tree>

</field>

</record>


Excerpt from models.py showing relivant parts

from openerp import models, fields, api

def select_task(task):

# Wrapper for fields.Selection

# Takes dictionary and returns it as a tuple

# Errors gracefully if dictionary is defined wrong

error = {

'wrong': 'Wrong task selected',

'error': 'Contact your Administrator',

}

if isinstance(task, dict):

return task.items()

else:

return error.items()

class metrics(models.Model):

_name = 'metrics.metrics'

# Main fields

m_value = fields.Integer(string='Total', required=True)

m_date = fields.Datetime(string='Date', required=True)

m_employee_id = fields.Many2one('res.users', "Employee", required=True, readonly=True, select=True)

_defaults = {

'm_employee_id': lambda self, cr, uid, ctx=None: uid

}

[snip] - This is not part of the code, this indicates classes above this model that work

# Begin Warehouse Extension

class warehouse(models.Model):

_name = 'metrics.warehouse'

tasks = {

'commodity': 'Commodity',

'scrap': 'Scrap',

}

m_scrap = fields.Selection(select_task(tasks), string='Commodity or Scrap', required=True)

m_row = fields.Integer(string='Row', required=True)

m_value = fields.Integer(string='Weight', required=True)

# Disallow numbers greater than 60 or any negative numbers

@api.onchange('m_row')

def onchange_row(self):

if (self.m_row <= -1):

self.m_row = 0

if (self.m_row >= 61):

self.m_row = 60

class whcrt(models.Model):

# CRT Material

_name = 'metrics.warehouse.crt'

_inherit = ['metrics.warehouse', 'metrics.metrics']

tasks = {

'monitor': 'Monitors',

'tube': 'CRT Tubes',

'tv': 'CRT TVs',

'nctube': 'CRT Tubes - No Cones',

'imac': 'CRT iMacs',

'secmon': 'Security Monitors',

'terminal': 'Terminals',

'blcdtv': 'Bad LCD TVs',

'blcdmon': 'Big LCD Monitors'

}

m_item = fields.Selection(select_task(tasks), string='CRT Material', required=True)

crt.xml - Handles display for warehouse sub-form

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<!-- explicit list view definition -->

<record model="ir.ui.view" id="metrics.listWarehouseCRT">

<field name="name">metrics Warehouse CRT</field>

<field name="model">metrics.warehouse.crt</field>

<field name="arch" type="xml">

<tree default_order="id,m_employee_id,m_date,m_row,m_scrap,m_item,m_value">

<field name="id"/>

<field name="m_row"/>

<field name="m_date"/>

<field name="m_item"/>

<field name="m_scrap"/>

<field name="m_value"/>

<field name="m_employee_id"/>

</tree>

</field>

</record>

<record model="ir.ui.view" id="metrics.formWarehouseCRT">

<field name="name">metrics Warehouse CRT</field>

<field name="model">metrics.warehouse.crt</field>

<field name="view_type">form</field>

<field name="arch" type="xml">

<form string="Warehouse CRT Form">

<sheet>

<center><h1>CRT Materials Pallet</h1></center>

<table style="width:100%;margin-top:5em">

<style>

label.oe_form_label {

font-weight: bold !important;

}

</style>

<tr>

<td style="padding-bottom:0.5em"><label for="m_item" string="CRT Material"/> <field name="m_item"/></td>

<td><label for="m_value" string="Weight (lbs)"/> <field name="m_value"/></td>

<td><label for="m_row" string="Row in Warehouse"/> <field name="m_row"/></td>

</tr>

<tr>

<td><label for="m_scrap" string="Commodity or Scrap"/> <field name="m_scrap"/></td>

<td><label for="m_date" string="Date"/> <field name="m_date"/></td>

<td><label for="m_employee_id" string="Employee"/> <field name="m_employee_id"/></td>

</tr>

</table>

</sheet>

</form>

</field>

</record>

<!-- actions opening views on models -->

<record model="ir.actions.act_window" id="metrics.ActionCRT">

<field name="name">Metrics Reports - Warehouse - CRT</field>

<field name="res_model">metrics.warehouse.crt</field>

<field name="view_mode">tree,form</field>

</record>

<!-- Define fields to search for - Default is only name -->

<record model="ir.ui.view" id="view_searchWarehouseCRT">

<field name="name">metrics search</field>

<field name="model">metrics.warehouse.crt</field>

<field name="arch" type="xml">

<search>

<field name="m_employee_id"/>

<field name="m_date"/>

<field name="m_scrap"/>

<field name="m_value"/>

<field name="id"/>

<field name="m_row"/>

<field name="m_item"/>

<!-- Begin Time filters -->

<filter string="Today" domain="[('m_date','&lt;=', ((context_today()-datetime.timedelta(days=0)).strftime('%Y-%m-%d')))]" help="Tasks submitted today" />

<filter string="Current Week" domain="[('m_date','&lt;=', (context_today() + relativedelta(weeks=0,day=7, weekday=-1)).strftime('%Y-%m-%d')),('m_date','&gt;=',(context_today() - relativedelta(weeks=1, weekday=0)).strftime('%Y-%m-%d'))]" help="Tasks submitted this week" />

<filter string="Current Month" domain="[('m_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%Y-%m-%d')),('m_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%Y-%m-%d'))]" help="Tasks submitted this month" />

<filter string="Previous Week" domain="[('m_date', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%Y-%m-%d'))),('m_date', '&lt;=', ((context_today()+relativedelta(weeks=-1,weekday=6)).strftime('%Y-%m-%d')))]" help="Tasks submitted last week" />

<filter string="Previous Month" domain="[('m_date','&gt;=',(context_today()-relativedelta(months=1)).strftime('%Y-%m-01')),('m_date','&lt;',time.strftime('%Y-%m-01'))]" help="Tasks submitted last month" />

<!-- End Time filters -->

<separator/>

<filter string="My Reports" domain="[('m_employee_id','=',uid)]" help="Tasks submitted by you" />

<!--<filter string="My Team's Reports" domain="[]" help="Tasks submitted by a member of your team" />--> <!-- Incomplete function -->

</search>

</field>

</record>

<!-- Sidebar Menu -->

<menuitem name="CRT Material" id="metrics.menuWarehouseCRT" parent="metrics.menuWarehouse" action="metrics.ActionCRT"/>

</data>

</openerp>

Avatar
Discard
Best Answer

Hi,
Check warning information:

WARNING [Company] openerp.models: ir.ui.view.write() with unknown fields: view_type

view_type is in model ir.actions.act_window, and not in model ir.ui.view:
Please, could you try that :


<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<!-- explicit list view definition -->

<record model="ir.ui.view" id="metrics.listWarehouseCRT">

<field name="name">metrics Warehouse CRT</field>

<field name="model">metrics.warehouse.crt</field>

<field name="arch" type="xml">

<tree default_order="id,m_employee_id,m_date,m_row,m_scrap,m_item,m_value">

<field name="id"/>

<field name="m_row"/>

<field name="m_date"/>

<field name="m_item"/>

<field name="m_scrap"/>

<field name="m_value"/>

<field name="m_employee_id"/>

</tree>

</field>

</record>

<record model="ir.ui.view" id="metrics.formWarehouseCRT">

<field name="name">metrics Warehouse CRT</field>

<field name="model">metrics.warehouse.crt</field>

<field name="arch" type="xml">

<form string="Warehouse CRT Form">

<sheet>

<center><h1>CRT Materials Pallet</h1></center>

<table style="width:100%;margin-top:5em">

<style>

label.oe_form_label {

font-weight: bold !important;

}

</style>

<tr>

<td style="padding-bottom:0.5em"><label for="m_item" string="CRT Material"/> <field name="m_item"/></td>

<td><label for="m_value" string="Weight (lbs)"/> <field name="m_value"/></td>

<td><label for="m_row" string="Row in Warehouse"/> <field name="m_row"/></td>

</tr>

<tr>

<td><label for="m_scrap" string="Commodity or Scrap"/> <field name="m_scrap"/></td>

<td><label for="m_date" string="Date"/> <field name="m_date"/></td>

<td><label for="m_employee_id" string="Employee"/> <field name="m_employee_id"/></td>

</tr>

</table>

</sheet>

</form>

</field>

</record>

<!-- actions opening views on models -->

<record model="ir.actions.act_window" id="metrics.ActionCRT">

<field name="name">Metrics Reports - Warehouse - CRT</field>

<field name="res_model">metrics.warehouse.crt</field>

<field name="view_type">form</field>

<field name="view_mode">tree,form</field>

</record>

<!-- Define fields to search for - Default is only name -->

<record model="ir.ui.view" id="view_searchWarehouseCRT">

<field name="name">metrics search</field>

<field name="model">metrics.warehouse.crt</field>

<field name="arch" type="xml">

<search>

<field name="m_employee_id"/>

<field name="m_date"/>

<field name="m_scrap"/>

<field name="m_value"/>

<field name="id"/>

<field name="m_row"/>

<field name="m_item"/>

<!-- Begin Time filters -->

<filter string="Today" domain="[('m_date','&lt;=', ((context_today()-datetime.timedelta(days=0)).strftime('%Y-%m-%d')))]" help="Tasks submitted today" />

<filter string="Current Week" domain="[('m_date','&lt;=', (context_today() + relativedelta(weeks=0,day=7, weekday=-1)).strftime('%Y-%m-%d')),('m_date','&gt;=',(context_today() - relativedelta(weeks=1, weekday=0)).strftime('%Y-%m-%d'))]" help="Tasks submitted this week" />

<filter string="Current Month" domain="[('m_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%Y-%m-%d')),('m_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%Y-%m-%d'))]" help="Tasks submitted this month" />

<filter string="Previous Week" domain="[('m_date', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%Y-%m-%d'))),('m_date', '&lt;=', ((context_today()+relativedelta(weeks=-1,weekday=6)).strftime('%Y-%m-%d')))]" help="Tasks submitted last week" />

<filter string="Previous Month" domain="[('m_date','&gt;=',(context_today()-relativedelta(months=1)).strftime('%Y-%m-01')),('m_date','&lt;',time.strftime('%Y-%m-01'))]" help="Tasks submitted last month" />

<!-- End Time filters -->

<separator/>

<filter string="My Reports" domain="[('m_employee_id','=',uid)]" help="Tasks submitted by you" />

<!--<filter string="My Team's Reports" domain="[]" help="Tasks submitted by a member of your team" />--> <!-- Incomplete function -->

</search>

</field>

</record>

<!-- Sidebar Menu -->

<menuitem name="CRT Material" id="metrics.menuWarehouseCRT" parent="metrics.menuWarehouse" action="metrics.ActionCRT"/>

</data>

</openerp>

Regards,

FTK

Avatar
Discard
Author

Thanks your input worked. Would you have any idea why my code worked on the Windows server, but not on the Linux one?

I don't know. Did you get same warning in WIndows server ?

Related Posts Replies Views Activity
1
Mar 20
9601
2
Jan 17
3801
3
Aug 15
10124
1
Dec 15
3300
0
Sep 23
497