Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Food & Hospitality
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Guest House
    • Distribuidor de bebidas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consulting
    • Accounting Firm
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Trades
    • Handyman
    • Hardware y asistencia informática
    • Solar Energy Systems
    • Zapatero
    • Servicios de limpieza
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

[12.0] enable features in the res.config.settings

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
settingsxmlres.config
6 Respuestas
24736 Vistas
Avatar
Alexander

Hello!

I want to enable some features ​​in the res.config.settings model through a .xml file, but apparently, something is missing because after upgrading my custom module, the group_multi_company and group_use_lead fields remain unchecked. This is my sample code:

file: res_config_data.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="my_config_settings" model="res.config.settings">
        <field name="paperformat_id" ref="base.paperformat_us"/>
        <field name="snailmail_duplex" eval="True"/>
        <field name="group_multi_company" eval="True"/>
        <field name="group_use_lead" eval="True"/>
    </record>
</odoo>

file: __manifest__.py
...
'data': [ 'data/res_config_data.xml',
],
...

Any suggestion? Thanks in advance.

0
Avatar
Descartar
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Mejor respuesta

res.config.setting is actually a TransientModel (wizard) which does not store the data for long time. Normally this object set / get the value to or from Company / ir.config.parameter

If you want to set these values, check where these fields are getting the value (company or ir.config.parameter) and then create your data xml accordingly.

5
Avatar
Descartar
Avatar
Sugeesh Ps
Mejor respuesta

To save the data in res.config.settings you have to use get_values/set_values methods,

field_name = fields.Selection([

        ('field1', 'FIELD1  '),

        ('field2', 'FIELD2')],required=True, default='field1')


@api.multi

def set_values(self):

        super(ResConfigSettings, self).set_values()

        select_type = self.env['ir.config_parameter'].sudo()

        select_type.set_param('module_name.field_name', self.field_name)


    @api.model

    def get_values(self):

        res = super(ResConfigSettings, self).get_values()

        select_type = self.env['ir.config_parameter'].sudo()

        sell = select_type.get_param('module_name.field_name')

        res.update({ 'field_name' : sell})

return res

6
Avatar
Descartar
Avatar
Alexander
Autor Mejor respuesta

Hello! Just for the record, I solved this as follows:

file: res_config_data.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="my_config_settings" model="res.config.settings">
<field name="group_multi_company" eval="True"/>
<field name="company_share_partner" eval="False"/>
<field name="group_use_lead" eval="True"/>
...
</record>
<function model="res.config.settings" name="execute">
<value model="res.config.settings"
search="[('id', '=', ref('my_config_settings'))]"/>
</function>
</odoo>

file: __manifest__.py
...
'data': [
'data/res_config_data.xml',
],
...
5
Avatar
Descartar
Paulo Matos

Great!!!

You save the "Christmas" :o)

Yenthe Van Ginneken (Mainframe Monkey)

Great solution Alexander :)

Tom Lo

In case you found the solution proposed by Alexander is working fine on the first installable but not when you try to update any settings later on.

You are probably missed to list related dependencies in __manifest__.py

See https://stackoverflow.com/questions/62316562/how-odoo-store-res-config-settings-it-looks-it-saved-but-not-presented-in-re/62317099#62317099

Avatar
Hugo De la Cadena
Mejor respuesta

Alexander,

I've tried to do your example to check the "group_uom" but I receive the error: "odoo.tools.convert.ParseError: "null value in column "company_id" violates not-null constraint"

I have 2 companies. Where can I set the company_id?



0
Avatar
Descartar
Tom Lo

```

<?xml version="1.0" encoding="utf-8"?>

<odoo>

<record id="my_config_settings" model="res.config.settings">

<!-- Here -->

<field name="company_id" ref="base.main_company"/>

<field name="group_multi_currency" eval="True"/>

<field name="group_product_variant" eval="True"/>

<field name="group_stock_multi_warehouses" eval="True"/>

<field name="group_stock_multi_locations" eval="True"/>

<!-- Delivery Packages -->

<field name="group_stock_tracking_lot" eval="True" />

<field name="module_stock_picking_batch" eval="True" />

<!-- Display Lots & Serial Numbers: Lots & Serial numbers will appear on the delivery slip -->

<field name="group_lot_on_delivery_slip" eval="True" />

<!-- Multi-Step Routes: Use your own routes and putaway strategies -->

<field name="group_stock_adv_location" eval="True" />

<field name="po_order_approval" eval="True" />

<!-- Quantities billed by vendors -->

<field name="default_purchase_method">purchase</field>

<field name="multi_sales_price" eval="True" />

<!-- Multiple prices per product -->

<field name="multi_sales_price_method">percentage</field>

<field name="group_analytic_tags" eval="True" />

<field name="group_analytic_accounting" eval="True" />

<!-- Set specific billing and shipping addresses -->

<field name="group_sale_delivery_address" eval="True" />

<!-- Consignment -->

<field name="group_stock_tracking_owner" eval="True" />

<!-- Prepayment -->

<field name="prepayment_account_id" ref="hbx_chart_of_account.hbx_account_prepayments" />

<!-- Multi-company-->

<field name="group_multi_company" eval="False" />

</record>

<function model="res.config.settings" name="execute">

<value model="res.config.settings"

search="[('id', '=', ref('my_config_settings'))]"/>

</function>

</odoo>

```

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
"'30' is not an integer or a virtual id" when updating a custom module setting Resuelto
settings module res.config
Avatar
Avatar
Avatar
Avatar
4
abr 23
7771
How to change language settings using XML? Resuelto
language settings xml
Avatar
Avatar
Avatar
Avatar
3
ene 19
12365
How to change settings on module installation? Resuelto
settings module xml
Avatar
Avatar
Avatar
2
oct 17
12503
How to update language settings using xml? Resuelto
settings xml update
Avatar
Avatar
1
abr 15
5610
how to set default module configuration with xml? [Closed]
configuration v8 xml res.config
Avatar
0
jun 15
5489
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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