Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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

Easy way to transfer Settings from one database to another. Can I export them? Can I programmatically "configure" a database?

Suscribirse

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

Se marcó esta pregunta
configurationdatabasetransferportabilityautomate
2 Respuestas
8871 Vistas
Avatar
Community Question

Prior to configuring a production database, I am performing several manual configuration steps in development and staging branches.

It seems like I have to repeat all of these manual steps .

It is possible to export settings between databases?

Is it possible to programmatically configure a database?


1
Avatar
Descartar
Avatar
Ray Carnes (ray)
Mejor respuesta

Yes, you can script the configuration of a database and reuse the script.


Note: You need to (a) understand this is an advanced technique and (b) be familiar / fluent in using Python to set values for different types of data structures. Configuration options can be represented in different ways - check boxes, radio buttons, fields to enter text, fields to enter numbers, fields to select dates, fields to select related records, etc. - which translate to model fields of different types: boolean, selection, char, integer, date, many2one, etc. - and each needs a different method to set and/or change the value.


We do this in our test scripts, so you can also do it in your own scripts.  (Please test and verify what you think is happening is actually happening!).


In the code at https://github.com/odoo/odoo/blob/17.0/addons/base_setup/tests/test_res_config.py#L40 you can see these lines configure a database to support multiple currencies (res.config.settings is a transient model):

# get access to the configuration model
ResConfig = self.env['res.config.settings']

# get a copy of the default values
default_values = ResConfig.default_get(list(ResConfig.fields_get()))

# update the default values
default_values.update({'group_multi_currency': True})

# persist the updated defaults
ResConfig.create(default_values).execute()


Example:

Let's say we want to change the default currency of a database to $USD and also configure the database to support multi-currency, and the current configuration looks like this:



First, hover over each of the fields to see their technical name, since these are the fields you will need to update:

                   


Next, you can script.  This example uses a Scheduled Action configured as inactive so the only time it runs is when the RUN MANUALLY button is clicked.  You may prefer to write an XML-RPC based script. 




default_values = model.default_get(list(model.fields_get()))

default_values.update({
'currency_id': env.ref('base.USD').id,
'group_multi_currency': True
})

model.create(default_values).execute()


After the script is run:



You can also install modules:

for app in ['stock','account_consolidation','contacts','helpdesk','sale_purchase','sale_management','crm','web_studio']:
    env['ir.module.module'].search([('name','=',app)],limit=1).button_immediate_install()


Populate company data:

coname = 'ACME'
 
# ↓↓↓ add details to the main Company, "ACME USA Inc."
us_company = env.ref('base.main_company')
us_company.update({'name': coname + ' USA Inc.', 'street': '100 Main Street', 'city': 'Springfield', 'state_id': env.ref('base.state_us_5').id, 'zip': '90123'})


Activate currencies:

# ↓↓↓ Activate Currencies and rename prefixes
env.ref('base.AUD').update({'active': True,'symbol': '$AUD'})
env.ref('base.EUR')['active'] = True
env.ref('base.GBP')['active'] = True
env.ref('base.JPY')['active'] = True


Create fake historic data:

# ↓↓↓ Create CRM Teams
env.ref('sales_team.team_sales_department').update({'name': 'Farmers', 'company_id': 1})
farmers = env.ref('sales_team.team_sales_department').id
hunters = env['crm.team'].create({'name': 'Hunters'}).id

# ↓↓↓ Sort Sales Teams alphabetically
sorted_teams = env['crm.team'].search([]).sorted(key=lambda r: r.name)
for i in range(len(sorted_teams)):
  sorted_teams[i].update({'sequence': i})

# ↓↓↓  mediums for historic data
web = env.ref('utm.utm_medium_website').id
phone = env.ref('utm.utm_medium_phone').id

# ↓↓↓  historic data
for i in range(1,142):
  env.cr.execute("insert into crm_lead (create_date,active,name,medium_id,team_id,type) values ('%s','f','l',%d,%d,'lead')" % \
(datetime.datetime.today() - datetime.timedelta(weeks=52),phone,farmers))


If you are writing a module for this, you can also use the function tag to call model methods in your XML files.  See https://www.odoo.com/documentation/master/developer/reference/backend/data.html#function

9
Avatar
Descartar
Ray Carnes (ray)

install module xml install app xml configure app xml configure module xml

Avatar
Agung Sepruloh
Mejor respuesta

You can use this module https://apps.odoo.com/apps/modules/16.0/export_import_settings

-1
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
How to transfer database from one account to another Odoo account?
database transfer
Avatar
Avatar
1
mar 24
3522
transfer a database
database transfer
Avatar
0
nov 23
2305
Set up a database from a configuration file
configuration database
Avatar
0
oct 25
4016
How to select one database by default ? Resuelto
configuration database v7
Avatar
Avatar
Avatar
Avatar
Avatar
6
jul 24
85143
Internal Transfer error - Missing required account on accountable invoice line Resuelto
configuration transfer internal
Avatar
Avatar
Avatar
Avatar
3
ago 24
7183
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar totalmente integrado.

Sitio web hecho con

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