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

How to store Boolean value in res.config.settings?

Odoberať

Get notified when there's activity on this post

This question has been flagged
configurationsettingsv14
2 Replies
10496 Zobrazenia
Avatar
Nikita

Hello,

I created several fields for res.config.settings and added them to the view. For Float fields, I was able to configure the ability to enter and save new values, and also figured out how to set default values.

However, I do not know how to make sure that the Boolean field is saved when changing and clicking Save.

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

    field_name = fields.Float(string='Im float field')

    boolean_field = fields.Boolean(string='I want the checkmark set here to be saved')

For enter and save new values in Float fields I use:

def set_values(self):
        res = super(ResConfigSettings, self).set_values()
        self.env['ir.config_parameter'].set_param('module_name.field_name', self.field_name)

        return res
    @api.model
    def get_values(self):
        res = super(ResConfigSettings, self).get_values()
        ICPSudo = self.env['ir.config_parameter'].sudo()
        res.update(
            field_name= ICPSudo.get_param('module_name.field_name'),
        )

        return res

Do you know how you can save the state of a Boolean field?

0
Avatar
Zrušiť
Nikita
Autor

I tried to make a new class with a Boolean field and add it from there, but this field became not clickable

class Settings_holder(models.Model):

_name = 'module_name.settings_holder'

field_name= fields.Boolean('Hello Odoo!')

class ResConfigSettings(models.TransientModel):

_inherit = 'res.config.settings'

test_field = fields.Many2one('module_name.settings_holder', string='hmmmm')

covid_tax = fields.Boolean(related='test_field.field_name')

Nikita
Autor

I forgot the comma when listing in res.update() inside get_values​​(). Don't forget the commas :D

Jaiswal Shivam

From Odoo 17.0 You can do like this

sale_invoice_id = fields.Many2one('sale.order', string='Sale Invoice', config_parameter='current_module_name.sale_invoice_id')

You can use this for all type field in v17.0 (Note:- Only for setting value in res.config.setting')

Avatar
cabrejua
Best Answer

Why are you using ICPSudo in get_values, and not in set_values ?

You should add sudo() in self.env['ir.config_parameter'].set_param('module_name.field_name', self.field_name):

self.env['ir.config_parameter'].sudo().set_param('module_name.field_name', self.field_name)

or

ICPSudo = self.env['ir.config_parameter'].sudo()
so that you can use ICPSudo

1
Avatar
Zrušiť
Avatar
Jaiswal Shivam
Best Answer

In Odoo 17.0 You can do like this

sale_invoice_id = fields.Many2one('sale.order', string='Sale Invoice', config_parameter='current_module_name.sale_invoice_id')

You can use this for all type field in v17.0 (Note:- Only for setting value in res.config.setting')

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
disable delete and edit options in conversations Odoo 15
configuration settings
Avatar
Avatar
Avatar
2
apr 24
5336
After click Settings I get a Error: field_utils.format[(intermediate value)] is not a function
settings v14
Avatar
0
dec 22
4075
What are the things to watch out for before my OpenERP goes live? Version 7.
configuration settings
Avatar
0
mar 15
8150
Reserve Profit and Loss Account
configuration settings
Avatar
Avatar
1
mar 15
7483
'method' object is not subscriptable
settings orm v14
Avatar
Avatar
1
apr 24
6024
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