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

How to filter Area and Neighborhood options based on selected Region in Product (Property) model

Suscribirse

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

Se marcó esta pregunta
actiondevelopmentconfigurationsetupworkflow
2 Respuestas
537 Vistas
Avatar
Get 200 Limited

Hi everyone,

I'm working on a customization in Odoo Enterprise Edition(Standard)  where I've extended the product (property) model with additional location-related attributes:

  • Region – eg, Kenya, UAE
  • Area – eg, Nairobi, Mombasa (specific to a region)
  • Neighborhood – eg, Kilimani (specific to an area)

Here's what I want to achieve:

  • When I select Region = Kenya , I should only see Areas that belong to Kenya.
  • When I select Area = Nairobi , I should only see Neighborhoods within Nairobi.

Basically, I need cascading dropdowns (Region → Area → Neighborhood) inside the product.template model.

I already know how to write the Python and XML parts to define the relationships and domains — what I need guidance on is where exactly in the Odoo setup this kind of extension should be placed.

Should I create a small custom module to inherit product.template , or is there a better place within the existing product module structure to add these models and view modifications?

Any pointers or best practices on organizing this kind of dependency within the Odoo framework would be appreciated.

Thanks in advance!

0
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,


You are essentially implementing cascading selection fields in product.template for Region → Area → Neighborhood. Since this is a custom extension to the standard Product model, the recommended approach is to create a small custom module, rather than modifying the core product module directly. Modifying the core module is risky because updates could break your customizations.


Follow the steps


Create a new custom module


    Example: product_location_extension


    Place your Python models, fields, and relationships here.


    Example structure:


    product_location_extension/

    ├── __init__.py

    ├── __manifest__.py

    ├── models/

    │   ├── __init__.py

    │   └── product_template_extension.py

    └── views/

        └── product_template_views.xml


Python Models


    In models/product_template_extension.py, inherit product.template:


from odoo import models, fields


class ProductTemplate(models.Model):

    _inherit = 'product.template'


    region_id = fields.Many2one('res.region', string='Region')

    area_id = fields.Many2one('res.area', string='Area', domain="[('region_id','=',region_id)]")

    neighborhood_id = fields.Many2one('res.neighborhood', string='Neighborhood', domain="[('area_id','=',area_id)]")


XML Views


    Extend the product.template form view:


<record id="view_product_template_form_inherit_location" model="ir.ui.view">

    <field name="name">product.template.form.location</field>

    <field name="model">product.template</field>

    <field name="inherit_id" ref="product.product_template_only_form_view"/>

    <field name="arch" type="xml">

        <xpath expr="//sheet/notebook/page[@string='General Information']" position="inside">

            <group>

                <field name="region_id"/>

                <field name="area_id"/>

                <field name="neighborhood_id"/>

            </group>

        </xpath>

    </field>

</record>


* Always use a separate custom module to extend product.template.

* Use Many2one fields with domains for cascading dropdowns.

* Keep models, views, and Python logic together in the module for maintainability.


Hope it helps

0
Avatar
Descartar
Avatar
Get 200 Limited
Autor Mejor respuesta

Thanks @cybrosys,

Does this mean, I will have to download the Odoo Enterprise code and do the development locally?


0
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
Convert Consumable Product to Storable Product تحويل حالة المنتجات الى قابل للتخزين
action development configuration
Avatar
0
nov 25
20
How can I automatically send an email to customers when their order is confirmed in Odoo? I want to make sure they receive a confirmation without doing it manually every time. Resuelto
action development configuration
Avatar
1
sept 25
5272
API: Connect error: Connection refused (111)
action development workflow
Avatar
Avatar
2
mar 25
2229
How to best use multi-company, multi-domain websites.?
development configuration workflow
Avatar
0
nov 24
1755
Issue with Callback Not Updating Properly When Order is Open in Odoo 17
action configuration workflow
Avatar
0
nov 24
1619
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.

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