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

context in ir.actions.act_window

By
Lucas Huber
on 2/19/16, 12:54 PM 964 views

I try to send from a button the context 'default_project_id' to a action view, but get an error. If I change the fields : [project_id] to active_id the view opens but ofcourse from the wrong project.

The Odoo Client error message is as follows:

Uncaught Error: , undefined as prefix
http://dev2.d2.xxxxx.eu/web/static/lib/py.js/lib/py.js:19
Traceback:

Error: , undefined as prefix

 <record id="act_project_task_sprint" model="ir.actions.act_window">
<field name="name">Tasks</field>
<field name="res_model">project.task</field>
<field name="view_mode">kanban,tree,form,calendar,pivot,graph</field>
<field name="context">{
'search_default_project_id': [project_id],
'default_project_id': project_id,
'search_default_sprint_id': [active_id],
'default_sprint_id': active_id,
}</field>


The Button code is like this (model: project.scrum.sprint):

<button  class="oe_inline oe_stat_button" type="action" icon="fa-tasks"
name="%(act_project_task_sprint)d" context="{'default_project_id': project_id}">
<field name="task_s_backlog_count" widget="statinfo"/>
</button>

In both models (project.task and sprint) the field 'project_id' exists. What's wrong?
In the end I wan't to have this search definition in the view:

Project Project_Name, Sprint Sprint Name

You cannot use any field in the context of the action definition, just in the context of the button and make sure that you have a value for the project_id

Axel Mendoza
on 2/19/16, 1:27 PM

Ok I did read the context section of Daniel Reis Odoo Book ones more. If I have understand correctly field values can only transported form the button context to the search view definition. But is the result the same? In the search definition field I need to have both Project Project_Name, Sprint Sprint Name.

Lucas Huber
on 2/20/16, 9: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: 2/19/16, 12:54 PM
Seen: 964 times
Last updated: 2/20/16, 9:29 AM