I have a wizard defined. I am able to open the wizard with a menu item, as seen on the screenshot below (Quick Create Project). But how can I override the New button (circled)?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Бухоблік
- Склад
- PoS
- Project
- MRP
Це запитання позначене
I tried something like that:
<!-- Sample Analysis Projects List View -->
<record id="view_sample_analysis_project_list" model="ir.ui.view">
<field name="name">project.project.translab.list</field>
<field name="model">project.project</field>
<field name="arch" type="xml">
<list string="Projects" multi_edit="1" create="false">
<field name="project_code" />
<field name="name" readonly="true"/>
<field name="user_id" />
<field name="partner_id" />
<field name="customer_project_manager_id" />
<field name="customer_reference" readonly="true"/>
<field name="progress_analysis" widget="progressbar"/>
</list>
<header>
<button name="%(action_sample_analysis_project_wizard)d"
type="action"
string="New sample analysis project"
class="oe_highlight"/>
</header>
</field>
</record>
But that gives me:
odoo.tools.convert.ParseError: while parsing /mnt/odoo-translab/translab_samples/views/sample_analysis_project_views.xml:87
Error while validating view near:
<data __validate__="1"><list string="Projects" multi_edit="1" create="false">
<field name="project_code"/>
<field name="name" readonly="true"/>
<field name="user_id"/>
The root node of a list view should be a <list>, not a <data>
View error context:
{'file': '/mnt/odoo-translab/translab_samples/views/sample_analysis_project_views.xml',
'line': 2,
'name': 'project.project.translab.list',
'view': ir.ui.view(1226,),
'view.model': 'project.project',
'view.parent': ir.ui.view(),
'xmlid': 'view_sample_analysis_project_list'}
Hi,
You can hide the default “New” button and replace it with your own button that opens the wizard.
<record id="view_project_tree_inherit" model="ir.ui.view">
<field name="name">project.project.tree.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.view_project_tree"/>
<field name="arch" type="xml">
<!-- Hide default "New" button -->
<xpath expr="//tree" position="attributes">
<attribute name="create">false</attribute>
</xpath>
<!-- Add custom button to trigger wizard -->
<xpath expr="//tree" position="after">
<header>
<button name="%(your_wizard_action)d"
type="action"
string="New"
class="oe_highlight"/>
</header>
</xpath>
</field>
</record>
Hope it helps.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
РеєстраціяRelated Posts | Відповіді | Переглядів | Дія | |
---|---|---|---|---|
|
1
вер. 25
|
93 | ||
|
1
вер. 25
|
220 | ||
|
3
вер. 25
|
418 | ||
|
1
вер. 25
|
404 | ||
|
2
серп. 25
|
599 |