Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

attribute error in inherited view?

Naroči se

Get notified when there's activity on this post

This question has been flagged
viewinheritanceres.partner
2 Odgovori
9672 Prikazi
Avatar
evon_dun

I added a new module that depends on base module, and my model inherits res.partner, i need to add two fields: customer reference and reference type, i did that the way it should be but there is an error that has really irritated me. The error is:

`AttributeError: View definition error for inherited view 'reference.customer_reference_form' on model 'res.partner': Element '<field name="reference_name">' not found in parent view '%(parent_xml_id)s'.`

My reference.py file:

from osv import osv,fields
import decimal_precision as dp
import netsvc
import time
from datetime import date
import pooler

class res_partner_reference(osv.osv):
    _name = 'res.partner'
    _inherit = 'res.partner'
    _columns = {
                'reference_name':fields.char('Reference',required=True,size=64,help="Name of the person who refered the customer"),
                'category':fields.selection([('none','None'),('painter','Painter'),('carpenter','Carpenter'),('supplier','Supplier')],'Type of Reference', required=True, help="To describe Reference"),
                }
res_partner_reference()

and my view:

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <record id="customer_reference_form" model="ir.ui.view">
            <field name="name">res.partner.form.inherit</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form" />
            <field name="arch" type="xml">
                <data>
                    <field name="name" position="after"/>
                    <field name="reference_name"/>
                    <field name="category"/>
                </data>
            </field>
        </record>
        <!-- <record id="customer_reference_tree" model="ir.ui.view">
            <field name="name">res.partner.tree.inherit</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_tree" />
            <field name="arch" type="xml">            
                <data>
                    <field name="name" position="after"/>
                    <field name="ref_name"/>                    
                    <field name="category"/>
                </data>
            </field>
        </record> -->
        <record model="ir.actions.act_window" id="action_reference_form">
            <field name="name">Customer References</field>
            <field name="res_model">res.partner</field>
        </record>

        <menuitem name="References" id="menu_sale_references" parent="base.menu_sales" sequence="5" action="action_reference_form" />
        <menuitem name="Customer References" id="menu_account_references" parent="account.menu_finance" sequence="3" action="action_reference_form" />
    </data>
</openerp>

Kindly help its urgent.

1
Avatar
Opusti
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

Problem is in your syntax while giving position.

Try this:

    <record id="customer_reference_form" model="ir.ui.view">
        <field name="name">res.partner.form.inherit</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="arch" type="xml">
            <data>
                <field name="name" position="after">
                    <field name="reference_name"/>
                    <field name="category"/>
                </field>
            </data>
        </field>
    </record>

This will work for sure.

5
Avatar
Opusti
evon_dun
Avtor

Thank you

Avatar
Francesco OpenCode
Best Answer

This code:

<data>
    <field name="name" position="after"/>
    <field name="reference_name"/>
    <field name="category"/>
</data>

Must be:

<data>
    <field name="name" position="after">
        <field name="reference_name"/>
        <field name="category"/>
    </field>
</data>
0
Avatar
Opusti
evon_dun
Avtor

Thanks a lot i couldn't figure this out even i made a same kind of module earlier.

Francesco OpenCode

If the answer is the correct one please cheack it as correct to help future user searches!

evon_dun
Avtor

One more question I want to use these two fields in sale order view too, do i need to create a new sales order view in my view or i can do it in sale.py and sales_view.xml??

Francesco OpenCode

If you want the some fields in sale order you must inherith sale.order class, insert the some field and inherit sale_order view, too. The some field can't be used in different classes.

Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
inherited form does not display correctly?
view inheritance res.partner look
Avatar
Avatar
Avatar
3
okt. 20
6621
view inherit from res.partner appears all one page with no styling or formatting
view inheritance res.partner appearance
Avatar
Avatar
1
mar. 15
7427
How can I create a new model inherite from res.partner? Solved
inheritance res.partner
Avatar
Avatar
Avatar
2
mar. 23
5043
View inheritance Solved
view inheritance
Avatar
Avatar
1
mar. 20
4553
How do I remove fields from a view in a custom module? Solved
view inheritance
Avatar
Avatar
Avatar
Avatar
12
dec. 18
36470
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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