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

Odoo 10 - Inherited template field appears depends upon position

Suscribirse

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

Se marcó esta pregunta
viewsfieldsinheritodoo10
2 Respuestas
5412 Vistas
Avatar
Carlos

Hi.

This is a very strange behaviour. Let me explain.

I need to add a fied to invoice form. To do that

1) I've created custom module to inherit account.invoice and added the field

2) I've created a view and inherited account.form_view

3) I've inserted the new field in the new view.

Stange behaviour:

If I put the field in the main body (not into a notebook element) of th invoice, all works fine. If I insert the field after invoice's secodary field (in my case this secondary field is "name" inside "Other info" notebook), a "field does not exist" error arises.

My model:

class InvoiceInherit (models.Model):
    _inherit = 'account.invoice'
ref2 = fields.Char(string='Reference2',readonly=True, states={'draft': [('readonly', False)]}, copy=False, help='It will appear in invoice doc under "Client order''s date')

My view ("invoice_form_ref2"):

<?xml version="1.0" encoding="UTF-8"?>
<odoo>

    <record id="view_partner_form_id" model="ir.ui.view">
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
            <field name="ref" position="after">
                <field name="provider_id"
                       placeholder="Provider ID"/>
            </field>
        </field>
    </record>

    <record id="invoice_form_ref2" model="ir.ui.view">
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_form"/>
        <field name="arch" type="xml">
            <field name="name" position="after"> <-- with this, raise an "field ref2 does not exist" error on update module
                <field name="ref2"/>
            </field>
        </field>
    </record>
</odoo>

if I use

<field name="payment_term_id" position="after">

All things work fine.

Please, note that both fields "name" and "payment_term_id" exists into account.invoce but are rendered in different positions:

"payment_term_id" is redered in the "main" invoice body, but

"name" is rendered inside "other info" notebook.

Thank yu for your help

0
Avatar
Descartar
Avatar
Carlos
Autor Mejor respuesta

¡SOLVED!

It has been my mistake.

In the account.invoice_form view there is another field "name", so the "field name="name" clause appears twice.

The error appears because Odoo does not know which of the two is referenced. I thought it was because of the position, but it was because of the name of the field.

I've used a xpath expression to replace the inside of the group ("other info") where I want to add the new field.


Anyway, thank you Niyas for your help.

0
Avatar
Descartar
Avatar
Niyas Raphy (Walnut Software Solutions)
Mejor respuesta

Hi, 

The problem is with the inherit_id , when you refer the field in original view (invoice_form ) , you can use inherit_id as account.invoice_form , that  is why the first case worked fine for you.

Later the field you referring will be coming from an inherited view, check and find that view and use it as the inherit_id .


Thanks


       
-1
Avatar
Descartar
¿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
Is there an option or method to auto select the value in a field when you click on it in edit mode?
views fields odoo10
Avatar
Avatar
1
mar 19
5148
How to add a field to existing tree view? Resuelto
views code fields inherit OdooV13
Avatar
Avatar
1
dic 22
7478
[CLOSED] I'm getting a validation error "Some fields are not set" set when using dynamic attributes. Resuelto
attrs views fields form_view odoo10
Avatar
Avatar
Avatar
8
dic 22
6527
How to use a new field added in a inherited model into a view?
views inherit
Avatar
Avatar
Avatar
3
ago 22
12804
odoo 10 : form for picking with only one field
views odoo10
Avatar
Avatar
Avatar
2
dic 19
3716
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