Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I wanted to add a child task creation form. So I wan't this form to have all fields of default task form, but no header, and action to create the child.
So I made a wizard with a osv.Model class with inherit="project.task" and a method returning an action to open a form on a new task with well defined defaults in context. So far, so good.
For the form to use, I did want to use all fields from the task form, so first I inherit base form. That was a mistake, as inheriting, in fact modify the base form. My goal was to have yet another form, not modifying existing one.
So what I did is to get the arch field from original form using the search+model+use attributes on my field :
<openerp> <data> <!-- view to add child task, copying default task view --> <record id="view_amr_task_add_child_base" model="ir.ui.view"> <field name="name">amr_project.task.add_child_base</field> <field name="model">project.task</field> <field eval="16" name="priority"/> <!-- low --> <field name="arch" search='[("name", "like", u"project.task.form"), ("inherit_id", "=", None)]' model='ir.ui.view' use='arch'/> </record> <!-- view to add child task --> <record id="view_amr_task_add_child" model="ir.ui.view"> <field name="name">amr_project.task.add_child</field> <field name="model">project.task</field> <field name="inherit_id" ref="amr_project.view_amr_task_add_child_base" /> <field name="arch" type="xml"> <!-- remove header --> <xpath expr='//header' position="replace"> </xpath> <!-- remove chatter and add custom actions --> <xpath expr='//div[@class="oe_chatter"]' position="replace"> <footer> <button name="create_child" string="Create" type="object" class="oe_highlight"/> or <button string="Cancel" class="oe_link" special="cancel" /> </footer> </xpath> </field> </record> </data> </openerp>
Is that the right way ? Am I missing something ?
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 1/8/14, 12:59 PM|
|Seen: 953 times|
|Last updated: 3/16/15, 8:10 AM|