Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Create new module and new table in database

Odoberať

Get notified when there's activity on this post

This question has been flagged
modulesodoo8.0
1 Odpoveď
23260 Zobrazenia
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
Zrušiť
Avatar
Dr Obx
Best Answer

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
Zrušiť
Anchal
Autor

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'.

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

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
How can I create a Popup Message? Solved
modules custom odoo8.0
Avatar
Avatar
Avatar
Avatar
Avatar
4
okt 25
16353
how to inherit the timesheet view in my new modul.
modules inheritance odoo8.0
Avatar
1
jún 16
4153
How to import hr_timesheet_sheet in a new module
modules hr_timesheet odoo8.0
Avatar
Avatar
Avatar
2
jún 16
4369
how to add a navigation button in personal -> my timesheet
modules timesheet odoo8.0
Avatar
0
máj 16
4055
Install modules by default in multi databases Solved
modules databases odoo8.0
Avatar
Avatar
Avatar
3
jan 16
6732
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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