Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How can I add the standard header with create button to my module?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
createheaderbuttonstandard
2 Răspunsuri
19939 Vizualizări
Imagine profil
Stefan Reisich

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?

image description

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()
1
Imagine profil
Abandonează
Laura Jarvenpaa

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.

Stefan Reisich
Autor

thank you very much. I updated my question.

Stefan Reisich
Autor

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.

Laura Jarvenpaa

Ok, I added my module codes on my answer.

Imagine profil
Laura Jarvenpaa
Cel mai bun răspuns

Couldn't spot any problem from your code but remembered another thing you may need: access rules.

So create folder security in your module folder and create a csv file named ir.model.access.csv and put there following two lines and add path security/ir.model.access.csv to your __openerp__.py file:

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_backgound_task,background.task,model_background_task,base.group_user,1,1,1,1

of course if you don't want to provide access to your background task to every one in group "user" you can define more limited group and if there is different levels of access to your module you can create different rules for different rules.

If you don't want to define these rules on csv file you can create the in Settings/Security/Access Control list however if you create them this way you have to redefine them every time you install your module with csv file they will be automatically created when your module is installed.

Hope this helps...

Edit: Here is code for one module that shows the create and edit buttons.

xml file only difference I noticed compared to your file is that I had added a group for my menu action but removing that group specification didn't hide create buttons so that's not a problem.

    <record model="ir.ui.view" id="balance_tree_view">
      <field name="name">hr.attendance.balance.tree</field>
      <field name="model">hr.attendance.balance</field>
      <field name="type">tree</field>
      <field name="arch" type="xml">
        <tree string="Balance Overtimes">
          <field name="name"/>
          <field name="employee_id"/>
          <field name="balance"/>
          <field name="description" />
        </tree>
      </field>
    </record>

    <record model="ir.ui.view" id="balance_form_view">
      <field name="name">hr.attendance.balance.form</field>
      <field name="model">hr.attendance.balance</field>
      <field name="type">form</field>
      <field name="arch" type="xml">
        <form string="Balance Overtimes">
          <field name="name"/>
          <field name="employee_id"/>
          <field name="balance"/>
          <field name="description" />
        </form>
      </field>
    </record>

    <record id="open_view_balance" model="ir.actions.act_window">
        <field name="name">Balance Overtimes</field>
        <field name="res_model">hr.attendance.balance</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="view_id" ref="balance_tree_view"/>
    </record>


    <menuitem action="open_view_balance" id="menu_open_view_balance" parent="hr_attendance.menu_hr_attendance" sequence="20" groups="base.group_hr_manager"/>

python file:

import time

from openerp.osv import fields, osv
from openerp.tools.translate import _


class hr_attendance_balance(osv.osv):
_name = "hr.attendance.balance"
_description = "Balance attendances by adding removing hours"

_columns = {
    'name': fields.datetime('Date', required=True, select=1),
    'description': fields.char('Description', size=64),
    'employee_id': fields.many2one('hr.employee', "Employee", required=True, select=True),
    'balance': fields.float('Balance', required=True)
}
_defaults = {
    'name': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}

and access rules file:

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_attendance_balance,hr.attendance.balance,model_hr_attendance_balance,base.group_hr_user,1,1,1,1
0
Imagine profil
Abandonează
Stefan Reisich
Autor

Thank you very much for your help, but I already have the ir.model.access.csv identical yours... I don't understand why the header don't shows... :-(

Stefan Reisich
Autor

I compared my module with yours and since everything is right on my module I installed it on a fresh OpenERP database and now it's showing the header! Thank you very much for your help :-)

Laura Jarvenpaa

Ok good that it is working for you now. :)

Imagine profil
Simplify it!
Cel mai bun răspuns

Try with this:

<record id="action_background_task" model="ir.actions.act_window">
        <field name="name">Background Tasks</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="view_id" ref="background_task_tree"/>
        <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 id="menu_background_task_config" name="Background Tasks Configuration" parent="base.menu_custom"  groups="base.group_no_one" sequence="16"/>
    <menuitem id="menu_background_task" action="action_background_task" parent="menu_background_task_config"/>
1
Imagine profil
Abandonează
Stefan Reisich
Autor

the only difference is that the menu moved to the technical part and has a submenu now. Still no header with standard buttons... :-( I'm going crazy.......

Stefan Reisich
Autor

Since everything is right on my module I installed it on a fresh OpenERP database and now it's showing the header! Thank you very much for your help :-)

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Override create button function
create button
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
iul. 22
3690
How to add new button in sales invoice form Rezolvat
form header button
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
nov. 18
15993
Show button under tree view column with a column header
treeview header column button
Imagine profil
0
iul. 17
5760
How to hide the create button dynamical tree view in Odoo ?
treeview create hide button
Imagine profil
Imagine profil
1
oct. 15
11535
Link a view to the top "create" button in order to add an entry Rezolvat
wizard view create button
Imagine profil
Imagine profil
1
mai 15
4412
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now