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

Why getting error while trying to open a editable tree view from clicking a button?

By
Rokon Uddin
on 10/15/14, 2:32 AM 1,087 views

 def form_view(self, cr, uid, ids, context=None):
          """Method is used to show form view in new windows"""
          view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'hr.attendance.calendar', 'hr.attendance.calendar.editable.tree')
          view_id = view_ref and view_ref[1] or False,
          this = self.browse(cr, uid, ids, context=context)[0]
          return {
               'type': 'ir.actions.act_window',
               'name': 'Form heading',
               'view_mode': 'tree,form',
               'view_type': 'form',
               'view_id': view_id,
               'res_model': 'hr.attendance.calendar',
               'nodestroy': True,
               # 'res_id': this.id, # assuming the many2one
               'target':'new',
               'context': context,
    }

 <record model="ir.ui.view" id="view_hr_attendance_calendar_editable_tree">
            <field name="name">hr.attendance.calendar.editable.tree</field>
            <field name="model">hr.attendance.calendar</field>
            <field name="arch" type="xml">
                <tree editable="top" string="Attendance calendar">
                    <field name="is_all"/>
                    <field name="employee" attrs="{'invisible':[('is_all','=',True)]}"/>
                    <field name="date_from"/>
                    <field name="date_to"/>

                    <field name="sign_in_time"/>
                    <field name="sign_out_time"/>

                </tree>
            </field>
        </record>

Server Traceback (most recent call last): File "C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\web\session.py", line 89, in send File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\netsvc.py", line 292, in dispatch_rpc File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\service\web_services.py", line 626, in dispatch File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\osv\osv.py", line 188, in execute_kw File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\osv\osv.py", line 131, in wrapper File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\osv\osv.py", line 197, in execute File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\osv\osv.py", line 185, in execute_cr File "C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\hr_auto_attendance\hr_auto_attendance.py", line 568, in form_view File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\tools\cache.py", line 18, in lookup File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\tools\cache.py", line 46, in lookup File "C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\base\ir\ir_model.py", line 869, in get_object_reference File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\tools\cache.py", line 18, in lookup File "C:\Program Files (x86)\OpenERP 7.0\Server\server\.\openerp\tools\cache.py", line 46, in lookup File "C:\Program Files (x86)\OpenERP 7.0\Server\server\openerp\addons\base\ir\ir_model.py", line 862, in _get_id ValueError: No such external ID currently defined in the system: hr.attendance.calendar.hr.attendance.calendar.editable.tree

0
Anup Kandalkar
On 10/15/14, 9:10 AM

Hi Rokon,

Please replace this statement: 

view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'hr.attendance.calendar', 'hr.attendance.calendar.editable.tree')

By

view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'module_name', 'tree_view_id')

i.e. tree_view_id='view_hr_attendance_calendar_editable_tree' not tree view name

I tired that bro but did not work. same error remains.....!!!

Rokon Uddin
on 10/16/14, 1:11 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/15/14, 2:32 AM
Seen: 1087 times
Last updated: 3/16/15, 8:10 AM