Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivoustarvikkeet
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Tutoriaalit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

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

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

How to change settings on module installation?

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
settingsmodulexml
2 Vastaukset
12475 Näkymät
Avatar
Christoph

I want to change a value in the settings of sale.config.settings. For this I created a XML file which I added to the __openerp__.py:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <record model="sale.config.settings" id="activate_dropshipping_sale">
      <field name="group_route_so_lines">True</field>
    </record>
  </data>
</openerp>

The problem is that this value is not changed in the settings. Maybe it's the problem that there is no entry in that table because the settings were not changed at this time.

How can I change a settings value like this?

2
Avatar
Hylkää
Avatar
Temur
Paras vastaus

 

xml ===================

<?xml version="1.0"?>
<openerp>
<data>

<function model="my.model.init" name="_init_settings" />

</data>
</openerp>

 

python ======================

class my_model_init(osv.osv_memory):

    _name = ''my.model.init"
    _columns = {}
    _defaults = {}

    def _init_settings(self, cr, uid, ids=None, context=None):
        sale_settings_pool = self.pool.get('sale.config.settings')
        sale_settings_id = sale_settings_pool.create(cr, uid, {'group_route_so_lines':True}, context=context)
        sale_settings_obj = sale_settings_pool.browse(cr, uid, sale_settings_id, context=context)
        sale_settings_obj.execute()  # this call is actually changes the setting, you're missing this step @Yenthe ...
        return True

 

2
Avatar
Hylkää
Temur

You can add "_init_settings" function to an existing class in your module, rather than make separate class for it. But then you must adjust "function" entry in XML, by changing the "model" property accordingly.

Yenthe Van Ginneken (Mainframe Monkey)

@Temur what exactly do you mean with return True? Where exactly should this come then? :o

Temur

Just convention for successful termination, You can omit that, if the rest of code works for you ))

Audrius

The same principle works also in odoo 10

Avatar
Bole
Paras vastaus

The reason nothing happens is : sale.config.settings is a transient model,
so no values stored there are permanenet. It works a bit different with application settings

If you want something like setting some choices ... you should check yml files.. 
It can be done that way.. 

In your case you shold look at sale_stock module, res_config.py 
In your xml you can achieve desired solution with adding a new property to your company default_picking_policy 
( take a look at method set_sale_defaults )

hope this will help a bit...
Here is some resurce links for yaml usage:
odoo / openerp documentation
zbeanztech-blog: how-effective-yaml-testing-openerp
slideshare presentation from camp to caml

0
Avatar
Hylkää
Yenthe Van Ginneken (Mainframe Monkey)

Hey Bole could you add an example? I'm trying to do the same as Cristoph at the moment but without succes. I was thinking like this: !python {model: account.config.settings}: | value_obj = self.pool.get('account.config.settings') if value_obj: vals = { 'module_account_followup': 'True', } value_obj.write(cr, uid, vals, context) But that does not seem to work.

Yenthe Van Ginneken (Mainframe Monkey)

Note: I'm doing it for a checkmark on the account module, Christoph is trying it for the sale module, but the concept is identical.

Bole

Your idea (from linkedin) is good example... The rest is in correct usage and understanding how res.config works... here is mentioned sales module... so why not check res_config.py in sales module.... you will find out that there is few types of settings: boolean values are sometimes related to res_company properites, and some of them trigger module instalation... so for every value in congif you want to automate first check how it is defined in rec_config of module... from there... yml method can provide an easy tool to do the job... hope this helps... will post some examples as soon as i get the time to write and test them on v8...

OdooBot
Hi Bole

i've tried this in two ways and both did not work sadly.. I tried id 0 and id 1 too. I've been looking at the .py file too but I'm not quite sure exactly what I should trigger to get everything going though!

    !python {model: account.config.settings}: |
     value_obj = self.pool.get('account.config.settings')
     if value_obj:
       vals = {
        'module_account_followup': 'True',
       }
       value_obj.write(cr, uid, vals, context)
-
    test
-
    !python {model: account.config.settings}: |
     user_ids = self.pool.get('account.config.settings').search(cr, uid, [('id', '=', '1')], limit=1, context=context)
     if user_ids:
       self.write(cr, uid, user_ids, {
       'module_account_followup': 'True',
       }, context)

Any more ideas / guidance please? I'm still learning a lot in this!
Yenthe

2015-01-09 14:35 GMT+01:00 Bole <bole-dajmi5-com@mail.odoo.com>:

Your idea (from linkedin) is good example... The rest is in correct usage and understanding how res.config works... here is mentioned sales module... so why not check res_config.py in sales module.... you will find out that there is few types of settings: boolean values are sometimes related to res_company properites, and some of them trigger module instalation... so for every value in congif you want to automate first check how it is defined in rec_config of module... from there... yml method can provide an easy tool to do the job... hope this helps... will post some examples as soon as i get the time to write and test them on v8...

--
Bole
Sent by Odoo S.A. using Odoo about Forum Post False

Bole

well some hints... 1. there is no id=0 in any table.. all tables are indexed from 1. 2. res_config is transiend model and writing to it means nothing... 3. writing to res_config usualy triggers some other actions like: instaling module ( fileds named module_xxx ) , or setting some properties or defaults ( usualy on res_company object) ... try debugging save action on some config files and see what happens... and how odoo handes "saved" data... in fact.. what odoo DOES when you push SVAE on config view...

Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
how to manage this 2 modules
module xml
Avatar
0
maalisk. 15
4272
error while parsing inherit view
module xml custom
Avatar
Avatar
1
kesäk. 23
4307
How to change the Your Company record with XML Ratkaistu
module xml initialization
Avatar
Avatar
2
huhtik. 23
18454
"'30' is not an integer or a virtual id" when updating a custom module setting Ratkaistu
settings module res.config
Avatar
Avatar
Avatar
Avatar
4
huhtik. 23
7762
[12.0] enable features in the res.config.settings Ratkaistu
settings xml res.config
Avatar
Avatar
Avatar
Avatar
6
maalisk. 24
24693
Yhteisö
  • Tutoriaalit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Tavaramerkki
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة 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 on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

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