Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
4 Відповіді
9308 Переглядів

I would like to be able to create a new project from a template directly in Kanban view. The button in form view is this:

<button string="New Project Based on Template" name="duplicate_template"  type="object" states="template" context="{'parent_id':parent_id}" class="oe_highlight" groups="base.group_user"/>

I inherited the kanban view and can put the button in there, but I can't figure out how to insert the context parent_id correctly?

I googled a lot, looked at the code inside openerp but found no example. I am stuck at

<button string="New Project Based on Template" name="duplicate_template" states="template" type="object" t-att-context="{'parent_id' : record.parent_id.raw_value}" class="oe_highlight" groups="base.group_user" ><span>Create new Project</span></button>

which creates a new project, but without the parent_id set.

How can I define the context in there?

Аватар
Відмінити
Найкраща відповідь

Hi guys, I found a solution (odoo8) :

<button string="New Project Based on Template" name="duplicate_template" states="template" type="object" t-attf-data-context="{'parent_id' : {{record.parent_id.raw_value[0]}}}" class="oe_highlight" groups="base.group_user" ><span>Create new Project</span></button>

Аватар
Відмінити
Найкраща відповідь

I can confirm that the option from Remi still works in Odoo 11:

This works for both buttons and a

<a 
    name="action_you_want"
    type="object"
    t-attf-data-context="{'id' : {{record.id_field.raw_value}}}">
    Link string
</a>
Аватар
Відмінити
Автор Найкраща відповідь

Remi Francois:

Your solution does not work for me in v7. I receive an error

Error: QWeb2: Error evaluating template: SyntaxError: missing ) in parenthetical


Аватар
Відмінити
Найкраща відповідь

Same for me - it seems that there is no way to pass context in a kanban view to the called action :(


I did ask more or less the same question here: https://www.odoo.com/forum/help-1/question/how-to-pass-context-to-a-called-action-with-kanban-view-links-or-buttons-83722

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
квіт. 24
1320
3
квіт. 20
7560
0
лист. 19
4623
1
серп. 17
22614
3
лют. 17
8592