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

Custom made module / ir.cron inheritance

By
Fabien REMY
on 10/26/15, 12:41 PM 898 views

Hi all,

I wish to add a custom field on the cron module (a description field, in order to describe the goal of the cron).

I can add the field on the table ir_cron, but when I try to add that field on the view, the error message is :

openerp.addons.base.ir.ir_ui_view: Can't render view for model: ir.cron

Here is the XML code :

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

<openerp>

    <data>

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

             <field name="name">view.ir.cron.extended</field>

             <field name="model">ir.cron</field>

             <field name="inherit_id" ref="base.ir_cron_view"/>

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

                 <xpath expr="/form/sheet/page[@string='Information']/field@name='doall']" position="after">

                     <field name="description" />

                 </xpath>

             </field>

        </record>

     </data>    

</openerp>


Thank you for your help.

please give more details about error log for better understanding

Baiju
on 10/26/15, 1:14 PM

Hi, My custom module seems to be very simple: __init__.py (empty) __openerp__.py (depends on base) ir_cron.py (add the field description to the ir.cron entity) ir_cron_view.xml (add the field on the form view) Here is the full stack when I try to install it : 2015-10-27 08:16:44,038 2216 ERROR openerp_bdd openerp.osv.orm: Can't find field 'description' in the following view parts composing the view of object model 'ir.cron': * view.ir.cron.extended Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model 2015-10-27 08:16:44,039 2216 ERROR openerp_bdd openerp.addons.base.ir.ir_ui_view: Can't render view for model: ir.cron Traceback (most recent call last): File "D:\workspace_luna\openerp_server\openerp-7\openerp\addons\base\ir\ir_ui_view.py", line 126, in _check_render_view fvg = self.pool.get(view.model).fields_view_get(cr, uid, view_id=view.id, view_type=view.type, context=context) File "D:\workspace_luna\openerp_server\openerp-7\openerp\osv\orm.py", line 2260, in fields_view_get xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx) File "D:\workspace_luna\openerp_server\openerp-7\openerp\osv\orm.py", line 1937, in __view_look_dom_arch raise except_orm('View error', msg) except_orm: ('View error', u"Can't find field 'description' in the following view parts composing the view of object model 'ir.cron':\n * view.ir.cron.extended\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model") 2015-10-27 08:16:44,055 2216 ERROR openerp_bdd openerp.tools.convert: Parse error in file:///D:/workspace_luna/git_repos/openerp_addons_spec/isg_ir_cron_extended/view/ir_cron_view.xml:5: view.ir.cron.extended ir.cron Traceback (most recent call last): File "D:\workspace_luna\openerp_server\openerp-7\openerp\tools\convert.py", line 847, in parse self._tags[rec.tag](self.cr, rec, n) File "D:\workspace_luna\openerp_server\openerp-7\openerp\tools\convert.py", line 814, in _tag_record id = self.pool.get('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 "D:\workspace_luna\openerp_server\openerp-7\openerp\addons\base\ir\ir_model.py", line 963, in _update res_id = model_obj.create(cr, uid, values, context=context) File "D:\workspace_luna\openerp_server\openerp-7\openerp\addons\base\ir\ir_ui_view.py", line 103, in create return super(view, self).create(cr, uid, values, context) File "D:\workspace_luna\openerp_server\openerp-7\openerp\osv\orm.py", line 4470, in create self._validate(cr, user, [id_new], context) File "D:\workspace_luna\openerp_server\openerp-7\openerp\osv\orm.py", line 1544, in _validate raise except_orm('ValidateError', '\n'.join(error_msgs)) except_orm: ('ValidateError', u'Une erreur est apparue lors de la validation du/des champ(s) arch: Invalid XML for View Architecture!') 2015-10-27 08:16:44,058 2216 ERROR openerp_bdd openerp.netsvc: ValidateError Une erreur est apparue lors de la validation du/des champ(s) arch: Invalid XML for View Architecture! Traceback (most recent call last): File "D:\workspace_luna\openerp_server\openerp-7\openerp\netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "D:\workspace_luna\openerp_server\openerp-7\openerp\service\web_services.py", line 626, in dispatch res = fn(db, uid, *params) File "D:\workspace_luna\openerp_server\openerp-7\openerp\osv\osv.py", line 188, in execute_kw return self.execute(db, uid, obj, method, *args, **kw or {}) File "D:\workspace_luna\openerp_server\openerp-7\openerp\osv\osv.py", line 144, in wrapper raise except_osv(inst.name, inst.value) except_osv: ('ValidateError', u'Une erreur est apparue lors de la validation du/des champ(s) arch: Invalid XML for View Architecture!') > d:\workspace_luna\openerp_server\openerp-7\openerp\osv\osv.py(144)wrapper() -> raise except_osv(inst.name, inst.value) (Pdb) Cheers.

Fabien REMY
on 10/27/15, 4:21 AM

Sorry for the text formating :-)

Fabien REMY
on 10/27/15, 4:23 AM
1

Temur

--Temur--
2896
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 10/27/15, 5:11 AM

per your description of module structure, __init__.py can NOT be empty, it should contain following line:

import  ir_cron

(add this line to __init__.py, also make sure you restart odoo after this change)

0
Fabien REMY
On 10/27/15, 5:26 AM

Hi Temur,

You're right ! I've tried to put from . import ir_cron in my __init__.py but the result was the same.

Thank you for your reactivity (again) ! :-)


For the "from . import ir_cron" syntax to work, I believe you need to enable absolute imports first, by "from __future__ import absolute_import" and then do your absolute import of "from . import ir_cron".

Thinkwell Designs, Dave Burkholder
on 10/27/15, 7:33 AM

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: 10/26/15, 12:41 PM
Seen: 898 times
Last updated: 10/27/15, 5:26 AM