Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Create a custom configuration page for custom module

Subscribe

Get notified when there's activity on this post

This question has been flagged
settings
3 Replies
18473 Views
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
Discard
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
Discard
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
Discard
Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
USUARIO DE LECTURA - ODOO
settings
Avatar
Avatar
Avatar
2
Sep 25
890
Fiscal localizations
settings
Avatar
Avatar
2
Apr 25
11191
Where is the "Translated Terms" Menu in Odoo 16? Solved
settings
Avatar
Avatar
Avatar
Avatar
Avatar
5
Mar 25
21590
setting on v17 ce
settings
Avatar
1
Jun 24
2721
I can't open setting Solved
settings
Avatar
1
May 24
2910
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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