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 a custom configuration page for custom module

Odoberať

Get notified when there's activity on this post

This question has been flagged
settings
3 Replies
18350 Zobrazenia
Avatar
Marco Antonio Cid Barreras

Hi!

How can I create a custom config. page for a module? A section where the user would fill some data, and that data would be retrieved in a module for its use

Thanks

1
Avatar
Zrušiť
Hardikgiri Goswami

can you describe this in brief with some example ?

Avatar
Andreas Stange
Best Answer

This changed very much in Odoo 11. To get an idea how to create Configuration pages in Odoo 11, my tip is to look for files named res_config_settings.py and res_config_settings.xml.

Here is a short example of a configuration in Odoo 11:

Example model

class Session(models.Model):
_name = 'openacademy.session'

name = fields.Char(required=True)
seats = fields.Integer(string="Number of seats")

The field 'seats' will get a default value configurable in the configuration that we will create. In odoo 11 all configuration is done in the same model, which we will extend via _inherit.

Configuration model res_config_settings.py

class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

default_seats = fields.Integer(default_model='openacademy.session')
my_setting = fields.Char(string='My Setting')

def get_values(self):
res = super(ResConfigSettings, self).get_values()
res.update(
my_setting=self.env['ir.config_parameter'].sudo().get_param('openacademy.my_setting')
)
return res

def set_values(self):
super(ResConfigSettings, self).set_values()
self.env['ir.config_parameter'].sudo().set_param('openacademy.my_setting', self.my_setting)
Fields with the prefix 'default_' will be handled automatically by Odoo
to provide default values for fields in some models.
Other configuration values need to be handled manually in get_values and set_values.

Finally there is the view for this model. It is quite a lot code,
to match the same style of the other Odoo config pages.
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="openacademy_settings_view2" model="ir.ui.view">
<field name="name">Openacademy Configuration</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<div class="app_settings_block" data-string="Open Academy Data-String" string="Open Academy" data-key="openacademy">
<h2>General Settings</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="my_setting"/>
<div class="text-muted">
Description text 1
</div>
<div class="content-group">
<div class="mt16">
<field name="my_setting" class="o_light_label"/>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="default_seats"/>
<div class="text-muted">
Description text 2
</div>
<div class="content-group">
<div class="mt16">
<field name="default_seats" class="o_light_label"/>
</div>
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>

<record id="openacademy_settings_action" model="ir.actions.act_window">
<field name="name">Openacademy Configuration</field>
<field name="res_model">res.config.settings</field>
<field name="view_id" ref="openacademy_settings_view2"/>
<field name="view_mode">form</field>
<field name="target">inline</field>
<field name="context">{'module' : 'openacademy'}</field>
</record>

<menuitem id="openacademy_settings_menu" name="Configuration"
parent="main_openacademy_menu" action="openacademy_settings_action"/>
</odoo>

5
Avatar
Zrušiť
Avatar
Qutechs, Ahmed M.Elmubarak
Best Answer

Hello,

You can check this question

also you can check the HR configuration in addons/hr check the res_config.py and res_config_view.xml it simple and straight forward one. also you can check the base res_config in /addons/base/res res_config.py check the res_config_settings class documentation

Regards

0
Avatar
Zrušiť
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
USUARIO DE LECTURA - ODOO
settings
Avatar
Avatar
Avatar
2
sep 25
792
Fiscal localizations
settings
Avatar
Avatar
2
apr 25
11078
Where is the "Translated Terms" Menu in Odoo 16? Solved
settings
Avatar
Avatar
Avatar
Avatar
Avatar
5
mar 25
21336
setting on v17 ce
settings
Avatar
1
jún 24
2621
I can't open setting Solved
settings
Avatar
1
máj 24
2819
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