콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
9421 화면

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

아바타
취소
관련 게시물 답글 화면 활동
0
4월 24
1442
3
4월 20
7687
0
11월 19
4728
1
8월 17
22769
3
2월 17
8699