How can I add the standard header with "create button"(and in form view the standard save button) and search field to my module like in the image?
I creaded a module with a new model/object, tree and form view. but the tree view and the form view don't shows the header with the "create button"...
my xml:
<openerp>
<data>
<record id="background_task_form" model="ir.ui.view">
<field name="name">background.task.form</field>
<field name="model">background.task</field>
<field eval="7" name="priority"/>
<field name="arch" type="xml">
<form string="Background Tasks" version="7.0">
<header>
<button name="start" string="Start" type="object"/>
</header>
<sheet>
<h1>
<label string="Background Tasks"/>
<field name="id" class="oe_inline" readonly="1"/>
</h1>
<group>
<group>
<field name="model"/>
<field name="method"/>
<field name="arguments"/>
<field name="user_id"/>
<field name="priority"/>
<field name="status"/>
<field name="max_time"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="background_task_tree" model="ir.ui.view">
<field name="name">background.task.tree</field>
<field name="model">background.task</field>
<field eval="7" name="priority"/>
<field name="arch" type="xml">
<tree string="Background Tasks">
<field name="id"/>
<field name="model"/>
<field name="method"/>
<field name="arguments"/>
<field name="user_id"/>
<field name="priority"/>
<field name="status"/>
<field name="max_time"/>
</tree>
</field>
</record>
<record id="background_task_filter" model="ir.ui.view">
<field name="name">background.task.select</field>
<field name="model">background.task</field>
<field name="arch" type="xml">
<search string="Search Background Tasks">
<field name="model" string="Background Task Model" filter_domain="['|',('model','ilike',self)]"/>
</search>
</field>
</record>
<record id="action_background_task" model="ir.actions.act_window">
<field name="name">Background Tasks</field>
<!--<field name="type">ir.actions.act_window</field>-->
<field name="res_model">background.task</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
<field name="search_view_id" ref="background_task_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a quotation that can be converted into a sales
order.
</p><p>
OpenERP will help you efficiently handle the complete sales flow:
quotation, sales order, delivery, invoicing and payment.
</p>
</field>
</record>
<menuitem action="action_background_task" id="menu_background_task" parent="base.menu_config" sequence="16"/>
</data>
</openerp>
my py:
from openerp.osv import fields, osv
class background_task(osv.osv):
_name = 'background.task'
_columns = {
'model': fields.char('Model Name', size=64, help='E.g. "product.category"', required=True),
'method': fields.char('Method', size=64, help='Method to be called from model.', required=True),
'arguments': fields.text('Arguments', help='Arguments that will be passed to method.'),
'user_id': fields.many2one('res.users', 'User', required=True),
'priority': fields.integer('Priority', help='Higher will be processed first.'),
'status': fields.char('Current status'),
'max_time': fields.integer('Max execution time', help='Max execution time in seconds.'),
'cron_id': fields.integer('Cron ID', readonly=True),
}
_defaults = {
'priority': 100,
'status': 'new',
'max_time': 300,
}
_order = 'priority DESC, id'
background_task()
Can you post more details about how your module is done e.g. the codes of xml-file. Always when I create a module those create and import buttons appear automatically if you have connected menus and actions right way.
thank you very much. I updated my question.
Would you please publish one of your modules that shows those create button and import. So I can see if there is any difference. Is it possible for you to share one of your modules? Thank you very much.
Ok, I added my module codes on my answer.