Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

Create new module and new table in database

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
modulesodoo8.0
1 Rispondi
23255 Visualizzazioni
Avatar
Anchal

Hello,

I can create new module by inheriting other models and fields data saved in existing table but I want to create new module which data will save in new table in database.

can anyone help me or give me a sample model please.

1
Avatar
Abbandona
Avatar
Dr Obx
Risposta migliore

To create new module you must:

1. Create a folder in Addons

2. Create __init__.py

3. Create __openerp__.py

4. Create your module.py file

5. Create your module_view.xml file

6. Security folder and inside of this folder ir.model.access.csv where you can put some information about access etc

__init__.py should contain: import your_module/s_name/s

example:

# -*- coding: utf-8 -*-

import your_module_name


__openerp__.py should contain: a description of your module, dependencies, vews etc

example:

{

'name': 'Base',

'version': '1.3',

'category': 'Hidden',

'description': """

The kernel of OpenERP, needed for all installation.

===================================================

""",

'author': 'OpenERP SA',

'maintainer': 'OpenERP SA',

'website': 'http://www.openerp.com',

'depends': [],

'data': [

'base_data.xml',

'res/res_currency_data.xml',

'res/res_country_data.xml',

'security/base_security.xml',

'module/module_report.xml',

'module/wizard/base_module_update_view.xml',

'res/res_company_view.xml',

'res/res_security.xml',

'security/ir.model.access.csv',

],

'demo': [

'base_demo.xml',

'res/res_partner_demo.xml',

'res/res_partner_demo.yml',

'res/res_partner_image_demo.xml',

],

'test': [

'tests/base_test.yml',

'tests/test_osv_expression.yml',

'tests/test_ir_rule.yml', # <-- These tests modify/add/delete ir_rules.

],

'installable': True,

'auto_install': True,

}

your_module_view.xml should contain your_module_view_definition:

example:

<?xml version="1.0" encoding="utf-8"?>

<openerp>

<data>

<record model="ir.actions.act_window" id="base.action_res_groups">

<field name="name">Groups</field>

<field name="context">{'search_default_no_share': 1}</field>

</record>

<record id="view_groups_form_share" model="ir.ui.view">

<field name="name">res.groups.form</field>

<field name="model">res.groups</field>

<field name="inherit_id" ref="base.view_groups_form"/>

<field name="arch" type="xml">

<field name="users" position="attributes">

<attribute name="context">{'search_default_no_share':1}</attribute>

</field>

<field name="name" position="after">

<field name="share"/>

</field>

</field>

</record>

</data>

</openerp>

your_module.py should contain:

#class with _columns will create your table with your columns

class your_class(osv.osv):

_name = 'your.class'#your new table

_description = 'Your class description'

_columns = {

'your_field_1': fields.type_of_field('Field name'),

'your_field_2': fields.type_of_field('Field name'),

'your_field_3': fields.type_of_field('Field name'),

'your_field_4': fields.type_of_field('Field name'),

}

    def your_def(self, cr, uid, args, fields, context=None):#check manual in case you need some special args o kwargs etc

        do something

Of course it's just a basics but .... that's all you need to build your own module. :)


4
Avatar
Abbandona
Anchal
Autore

Thank you so much Obx.... I appreciate your help.

Ankit H Gandhi(AHG)

Nice answer @Dr. Obx +1

Dr Obx

Your'e welcome :)

Michael Watchorn

While Dr Obx's answer is pretty thorough, might I point out: 1) it's missing the import statement in your_module.py 2) We should be helping new people learn the new API

Michael Watchorn

@Anchal: The key to creating a new table is the line: '_name = your.class'.

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
How can I create a Popup Message? Risolto
modules custom odoo8.0
Avatar
Avatar
Avatar
Avatar
Avatar
4
ott 25
16339
how to inherit the timesheet view in my new modul.
modules inheritance odoo8.0
Avatar
1
giu 16
4151
How to import hr_timesheet_sheet in a new module
modules hr_timesheet odoo8.0
Avatar
Avatar
Avatar
2
giu 16
4366
how to add a navigation button in personal -> my timesheet
modules timesheet odoo8.0
Avatar
0
mag 16
4051
Install modules by default in multi databases Risolto
modules databases odoo8.0
Avatar
Avatar
Avatar
3
gen 16
6731
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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