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 use a computed field in a domain in the tree view?

Suscribirse

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

Se marcó esta pregunta
domainxmlcomputeodooV8
2 Respuestas
27211 Vistas
Avatar
Jesus Rojas

I need to use the values generated by a computed field in a domain, to hide specific lines in a tree view, I don't know if I'm using the domain in the wrong way. Exist other way to do what I need? Here's my code:

Python:

What I have done so far is to create a second field that stores the value of the computed field and apply it to the domain. Did not work

@api.one
def method_compute_invoice(self):

res = ''
if self.sale_id:
res = self.sale_id.state
_state = {'draft' : 'Draft Quotation', 'sent' : 'Quotation Sent', 'cancel' : 'Cancelled', 'waiting_date' : 'Waiting Schedule', 'progress' : 'Sales Order',
'manual' : 'Sale to Invoice', 'shipping_except' : 'Shipping Exception', 'done' : 'Done'}
res = _state.get( res, res )

if self.sale_id.invoiced:
res += '/invoiced'

if self.sale_id.shipped:
res += '/shipped'

self.compute_invoice = res
sql = "update visio_prepare_shipment_list set store_invoice = '%s' where id = %s" % (res, self.id)
self.env.cr.execute(sql)
# fields
compute_invoice = fields.Char('Current Odoo order Status', compute='method_compute_invoice')
store_invoice = fields.Char('Current Odoo order Status')

XML:

record id="action_prepare_shipment_tree" model="ir.actions.act_window">            <field name="name">Prepare For Shipment</field>            <field name="type">ir.actions.act_window</field>            <field name="res_model">visio.prepare.shipment.list</field>            <field name="view_type">form</field>            <field name="view_mode">tree,form</field>             <field name="search_view_id" ref="prepare_shipment_filter"/>            <field name="context">{'search_default_PackingList': 1}</field>            <field name="domain">[('store_invoice','!=','Done/invoiced/shipped')]</field>        </record>
1
Avatar
Descartar
Avatar
Niyas Raphy (Walnut Software Solutions)
Mejor respuesta

Hi,

For using computed field in the domain you have to give  store=True for the field . If you didn't give store=True, you cannot use the field for giving in the domain.

For more info you can check this link , https://www.odoo.com/forum/help-1/question/how-can-i-use-a-field-function-in-the-domain-filter-137

Eg:-

amount_total = fields.Monetary(compute=_amount_all, string='Total', store=True)

Thanks


2
Avatar
Descartar
Avatar
marocsys
Mejor respuesta
Hi,
You should add   store=True 

compute_invoice = fields.Char('Current Odoo order Status',  compute='method_compute_invoice',store=True)

and you should add your computed field to the tree view (even invisibble) like:

<field name="compute_invoice" invisible="1" />

and than you can use it in your domain inside the tree

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
How to show full size list view in a m2m selection Resuelto
xml odooV8
Avatar
Avatar
1
ene 23
3360
How to change domain using attributes?
domain xml openerp7 openerp odooV8
Avatar
Avatar
1
feb 22
13654
How to get the current user in XML
domain xml
Avatar
Avatar
Avatar
2
nov 25
9957
How to creare drill down tree view in odoo V8 ? Resuelto
xml odooV8
Avatar
Avatar
3
ago 20
5912
how i can create automatic in one2many field (gmat.dashboard), thos after change (click) date field (in gmat.board)
xml odooV8
Avatar
0
feb 18
3524
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