Odoo Help


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.


[V8]Api.multi: how to set attribute 'reload_page'?

on 7/7/15, 1:00 PM 391 views

I'm trying to have a reload button on a custom tree view, here is the code on my .py:

def reload_page(self):
model_obj = self.env['ir.model.data']
data_id = model_obj._get_id('module_name', 'view_id')
view_id = model_obj.browse(data_id).res_id
return {
'type': 'ir.actions.act_window',
'name': _('String'),
'res_model': 'rest.order',
'view_type' : 'form',
'view_mode' : 'tree',
'view_id' : kitchen_orders_action, # Kitchen_orders_tree_view raise the same error #
'target' : 'current',
'nodestroy' : True,

Caled on view by:

<button type="object" name="reload_page" string="Reload Page" />

And here is the error raised:

  File "/home/effe/odoo/addons/web/controllers/main.py", line 928, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
AttributeError: 'rest.order' object has no attribute 'reload_page'

Views on my xml source:

<record id= "Kitchen_orders_tree_view" model= "ir.ui.view">
<field name= "name">Kitchen_orders_tree</field>
<field name= "model">rest.order</field>
<field name= "field_parent" eval="False"/>
<field name= "arch" type= "xml">
<tree string = "Pedidos da Cozinha" colors="red:to_wait=='Sim'" create="false">
<field name= "date_order" on_change="on_change_kot_time(date_order,end_date)"/>
<field name = "partner_name"/>
<field name = "qty"/>
<field name = "product_name"/>
<field name = "instructions"/>
<field name= "end_date" on_change="on_change_kot_time(date_order,end_date)" invisible = "1"/>
<field name = "to_wait" invisible = "1"/>
<field name= "minutes" on_change="on_change_kot_time(date_order,end_date)" invisible = "1"/>
<field name = "status" />
<button name="640" string="Avançar" type="action" attrs="{'invisible':[('to_wait','=','Não')]}" />
<button name="643" string="Enviar" type="action" attrs="{'invisible':['|', ('status','=','Pronto'), ('to_wait','=','Sim')]}" />
<record model= "ir.actions.act_window" id= "kitchen_orders">
<field name= "name">kitchen_orders_action</field>
<field name= "type">ir.actions.act_window</field>
<field name= "res_model">rest.order</field>
<field name= "view_type">form</field>
<field name= "view_mode">tree</field>
<field name= "view_id" eval="False"/>
<field name= "domain">[]</field>
action= "kitchen_orders"
id= "kitchen_order_menu"
parent= "point_of_sale.menu_point_of_sale"
name= "Restaurant"
sequence= "10"/>

Any tips?

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)


Asked: 7/7/15, 1:00 PM
Seen: 391 times
Last updated: 7/7/15, 2:01 PM