콘텐츠로 건너뛰기
메뉴
신고된 질문입니다
2 답글
1716 화면

how to call wizard in button with position after field in a menu and that using xpath ? it stil wrong



<xpathexpr="//field[@name='taxes_id']"position="after">                    <buttonname="%(equip3_accounting_stockoperation.action_product_warehouse_cost)d"string="Cost List Price"type="action"/>            xpath>
아바타
취소
베스트 답변

To call a wizard from a button in a form view in Odoo, you can use the ir.actions.act_window model and the ir.ui.view model.

First, you need to create an action that will open the wizard when the button is clicked. You can do this by creating a new record in the ir.actions.act_window model, like this:

action = self.env['ir.actions.act_window'].create({
    'name': 'Wizard',
    'res_model': 'my.wizard',
    'view_mode': 'form',
    'target': 'new',
})

Next, you need to create a button that will trigger the action when it is clicked. You can do this by using the ir.ui.view model to create a new button in the form view, like this: 

view = self.env['ir.ui.view'].create({
    'name': 'My Button',
    'model': 'my.model',
    'type': 'form',
    'arch': """
        

""" % action.id, })

This will create a button at the top of the form view that will open the wizard when it is clicked.

To add the button after a specific field, you can use the xpath attribute of the button element to specify the position of the button in the form view. For example, to add the button after the name field, you could use the following arch:


    
    
    

아바타
취소
베스트 답변

Hi Saeful Abdulloh Sayuti,

Below is the example to adding the button in the form view and open wizard.

Please find code in comment.

I hope This will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

아바타
취소

<xpath expr="//field[@name='partner_id']" position="after">
<!-- If button type is object -->
<button name="action_post" type="object" string="POST" class="btn-link mb-1 px-0"/>
<!-- If button type is action -->
<button name="%(account.action_account_moves_all_a)d" icon="fa-book" string="Journal Entries" type="action"
class="btn-link mb-1 px-0"/>
</xpath>

관련 게시물 답글 화면 활동
1
12월 22
3247
0
4월 20
3562
What is wizard ? 해결 완료
3
11월 23
32103
1
8월 19
6266
4
7월 25
4819