hello guys!!!
please who can explain to me how to create a button that opens a new view please.
Thanks a lot in advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
hello guys!!!
please who can explain to me how to create a button that opens a new view please.
Thanks a lot in advance
Dear Abdelwahed,
Its very simple to create button in view.
Example
<button name="your_method_name" type="object" string="label"/>
Hope this helpfully for you
Thanks & Regards
Ankit H Gandhi
Hello,
For Example:- The action is defined like this,
<record id="calculate_marks_action" model="ir.actions.act_window">
<field name = "name">Result</field>
<field name = "res_model">calculate.marks</field>
<field name = "view_type">form</field>
<field name = "view_mode">form,tree</field>
</record>
Then to trigger this action and open its view you need to define the button as:-
<button type='action' name='%(calculate_marks_action)d' string="Button A" />
Hence the general syntax for the button to open a new view can be:-
<button type='action' name='%(your_action_id)d' string="Button Text" />
Hope this helps,
Thank You.
button name="%(action_account_invoice_payment)d" type="action" states="open" string="Register Payment" groups="account.group_account_invoice" class="oe_highlight"
Thanks a lot for your answer. But, my question was how to create a button that make you open a new view defined in an other class!!
Follow simple option:
Create Forms for Your Model and add like below code in xml
<record id="view_employee_form_loan" model="ir.ui.view">
<field name="name">hr.employee.loan.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<data>
<button name="%(act_hr_employee_loan_request)d" string="Check Loan" class="oe_inline oe_stat_button" icon="fa-book" type="action" groups="base.group_hr_user"/>
</data>
</field>
</record>
<record id="act_hr_employee_loan_request" model="ir.actions.act_window">
<field name="name">Loans</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.employee.loan</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_employee_id': [active_id], 'default_employee_id': active_id}</field>
</record>
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
0
mar 25
|
1414 | ||
|
0
gen 25
|
3493 | ||
|
1
ago 23
|
14851 | ||
change password
Risolto
|
|
1
ago 23
|
13502 | |
|
1
lug 23
|
10482 |