Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Field does not exist error on inherited view

Odebírat

Get notified when there's activity on this post

This question has been flagged
moduleserrorfieldsinherit
8 Odpovědi
49724 Zobrazení
Avatar
o.chris

Hi,

I'm trying to add a custom field to a view but I gettting this error

raise ValidationError('\n'.join(errors)) ParseError: "Invalid view definition
Field `company_contact_id` does not exist
Error context :
View `view_form_sale_order_custom`
[view_id: 1316, xml_id: custom.view_form_sale_order_custom, model: sale.order, parent_id: 883]
None" while parsing custom/custom/sale_view.xml:4

The field exists in table "sale_order".


Here's my view:

<?xml version="1.0" encoding="utf-8"?>

<openerp>
    <data>
        <record id="view_form_sale_order_custom" model='ir.ui.view'>
            <field name="name">view_form_sale_order_custom</field>
            <field name="model">sale.order</field>
            <field name="priority" eval="2000" />
            <field name="inherit_id" ref="sale.view_form_sale_order" />
            <field name="arch" type="xml"> <xpath expr="//field[@name='company_id']" position="after"> <field name="company_contact_id" />
                </xpath>
            </field>
        </record>
    </data>
</openerp>


Field declaration (sale.py) :

company_contact_id = fields.Many2one('res.partner', string='Company contact', required=False, ondelete='restrict')


 __init__.py


...
import sale
...


__openerp.py

...
'depends' :['sale']
...


Any clue of what's going wrong ?


Thanks







0
Avatar
Zrušit
Yenthe Van Ginneken (Mainframe Monkey)

Are you importing the models folder too? I don't see it in your initial answer, so double checking. You import models in the __init__.py and then import sale.py from the __init__.py file which is in the models folder. Did you do that?

o.chris
Autor

@Yenthe sorry i'm not sure to understand what you mean by "import the model folder"

my module directory looks like this :

custom/custom

-__init__.py --> import sale

- __openerp__.py --> depends [sale]

- sale.py --> field declaration

- sale_view.xml --> view

o.chris
Autor

@Yenthe

here's my module (sale.py)

from openerp import models, fields, api

class sale_order(models.Model):

_inherit = 'sale.order'

company_contact_id = fields.Many2one('res.partner',

string='Contact',

required=False,

ondelete='restrict',

)

Yenthe Van Ginneken (Mainframe Monkey)

No worries - this is the same logic but just done otherwise. This looks fine. :-)

Avatar
o.chris
Autor Nejlepší odpověď

@Eli the field is created in 'sale_order'. I tried to upgrade and uninstall/reinstall the  module with

no success.


Thanks


EDIT:

I can't say why but I changed my xpath query

//field[@name='company_id'] position="after"

by

/form/group[1]/group[1]/notebook/page[2]/group[1] position="inside"


And now it's works


Thanks

1
Avatar
Zrušit
Avatar
Manuel A. Márquez
Nejlepší odpověď

@o.chris The same thing happened to me. The workaround was change the xpath expression.

0
Avatar
Zrušit
Avatar
Eliseo Tehuitzil
Nejlepší odpověď

Check if you can see company_contact_id in sales (postgresql) table, if you don't see this column, you need to restart the server and reinstall your app.

0
Avatar
Zrušit
Avatar
Zbik
Nejlepší odpověď

You execute from command line:

>/usr/bin/odoo -d YOUR_DATABASE_NAME -u all --stop-after-init --config="/etc/odoo/odoo.conf"

and look at the erros.  In many cases, there may be some error in the language of python, in a different place than you are search it. For example, I named one of the classes

class aaa-BBB (self):


instead


class aaa_BBB (self):


and the effect was similar to yours (in addition no any log!!! and console!!! errors).



0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Field does not exist error Vyřešeno
error fields inherit Odoo13
Avatar
Avatar
1
bře 23
7977
Error while trying to create new field for sale subscription Vyřešeno
modules error fields subscription constraints
Avatar
Avatar
2
led 19
5104
odoo custom modul update problem Vyřešeno
modules error fields install odoo10
Avatar
Avatar
Avatar
7
říj 18
11651
fields not saving problem
fields inherit
Avatar
Avatar
2
bře 15
10974
No module named pooler Vyřešeno
modules error
Avatar
Avatar
Avatar
Avatar
Avatar
5
pro 23
20316
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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