Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to inherit invoice view (list/tree and form)?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
treeviewinheritanceaccount.invoiceformview
1 Respondre
12577 Vistes
Avatar
Jean Donaires

Hello. I am creating a new module where I will inherit the tree view and form view from the account.invoice module.

So far I've found a lot of examples on how to inherit a form view. As far as i know I should be fine if I edit the my module's view.xml file and just do the following:

<record model="ir.ui.view" id="mymodule.list">
      <field name="name">mymodule list</field>
      <field name="model">mymodule.mymodule</field>
      <field name="inherit_id" ref="account.invoice_tree"/>
      <field name="mode">primary</field>
      <field name="arch" type="xml">
        <tree create="false" edit="false">
                    <field name="partner_id" groups="base.group_user" string="Customer"/>
                    <field name="date_invoice"/>
                    <field name="number"/>
                    ...
        </tree>
      </field>
    </record>

(I would do the same for the form view but with ref="account.invoice_form")


But when i try to do the tree view i get 2 errors.

1 of them regarding the create and delete records

Element '<tree create="false" edit="false">' cannot be located in parent view

The other one asking for partner_id (this one pops up when i delete "create=false" "edit=false" on the tree tag)

Field `partner_id` does not exist

The big picture in here is that. I want to extend fields on account.invoice (1 boolean and the other one string)

Then show the exact same account.invoice tree view on a custom module with the only difference that in this inherited custom tree view I will show those accounts with the boolean set on "true". So what I need right now is to inherit the account.invoice tree and form view, into my custom module. 

0
Avatar
Descartar
Avatar
Ray Carnes (ray)
Best Answer

When you inherit a View in Odoo, the XML in the arch field is expected to redefine, not define.

Review the documentation at \https://www.odoo.com/documentation/11.0/reference/views.html#inheritance


The error is Odoo's way of telling you - "I looked for a tree node matching create and false the way you list it, but I couldn't find it in the view you are inheriting".

The <tree> node in this case is defining an ANCHOR to which your changes will be made.  After locating the TREE node, you can REPLACE the node, change the ATTRIBUTES of the node, or put something AFTER or BEFORE the node.


Instead of defining tree:

<tree create="false" edit="false">

You redefine tree:

<tree position="replace">
<tree create="false" edit="false">
<field name="..."/>
</tree>
</tree>

or, even better:

<tree position="attributes">
<attribute name="create">false</attribute>
<attribute name="edit">false</attribute>
</tree>

<field name="partner_id" position="after">
<field name="..."/>
</field>
3
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
From tree view to dynamic form view
treeview formview
Avatar
Avatar
1
de set. 23
5369
Inheriting model new fields from res.partner model are not visible in the inherited form
inheritance formview delegation
Avatar
Avatar
Avatar
2
de jul. 23
4133
How to show children elements in parent form view?
treeview inheritance models
Avatar
0
d’abr. 23
3715
Its possible to add a tree view inside a form view with group_by filter applied
treeview group_by formview
Avatar
Avatar
2
de juny 22
4717
How to redirect to form view after clicking row in custom SQL tree view? (14.0)
views treeview formview
Avatar
0
de set. 21
3161
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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