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í
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

Element '<field name="invoice_policy">' cannot be located in parent view

Odebírat

Get notified when there's activity on this post

This question has been flagged
fieldsxmlproduct.productposition
1 Odpovědět
3907 Zobrazení
Avatar
random_mai

 I want to move the fields to a different notebook (or tab) in the view and hide the company field: invoice_policy (Invoice Policy), tic_category_id (TaxCloud Category), company_id (Company). However, I encountered an error, this is applicable to the fields mentions:

When i use "position=replace" the fields:

Element '' cannot be located in parent view

When i call the fields again to their new position:

Field "tic_category_id" does not exist in model "product.product"


Here's my code, i am inheriting the form view in Inventory module:




<record id="view_product" model="ir\.ui\.view\"\>


\ \ \ \ \ \ \ \ \<field\ name=\"name\"\>custom.product.product.form.inherit</field>


       <field name="model">product.product</field>


        <field name="priority" eval="6"/>


        <field name="inherit_id" ref="product.product_normal_form_view" />


        <field name="arch" type="xml">


            <!-- When i do this i don’t encounter an error —>


            <field name="barcode" position="replace"/>


            <!-- When i do this i encounter an error an error —>


            <field name="invoice_policy" position="replace"/>


            <group name="group_general" position="inside">


                <!— No error here whenever i call the field —>


                <field name="barcode"/>


                <!— Error when calling again the invoice_policy, saying that it does not exist in product.product —>


                <field name="invoice_policy"/>


            </group>           


        </field>


    </record>



I'm not sure why these 3 fields are experiencing an error and why i can't use the field again. As much as possible i don't want to use xpath. Although, i tried xpath, i still encountered the error above.


Please help. Thank you so much


0
Avatar
Zrušit
shubham shiroya

You can visible the invisible field
field name="field_name" invisible="0"/>

Avatar
shubham shiroya
Nejlepší odpověď

The error you're encountering when using position="replace" or calling the fields again in a different position is likely due to the fact that these fields are defined within a notebook (page or notebook) in the original view, and you're trying to replace or move them outside of that notebook.

To overcome this issue and move the fields to a different notebook or tab while hiding the company_id field, you can use the following approach:

record id="view_product" model=" rel="ugc">ir.ui.view">
fieldname="name">custom.product.product.form.inherit
field name="model">product.product
field name="priority" eval="6"/>
field name="inherit_id" ref="product.product_normal_form_view" />
field name="arch" type="xml">
data>
!-- Find the notebook/page where the fields are defined -->

xpath expr="//notebook/page[@name='page_general_information']" position="inside">
!-- Remove the company_id field -->
field name="company_id" position="replace">
field name="company_id" invisible="1"/>
/field>
-- Move the fields to a different notebook or tab -->
page string="Custom Tab">
group>
field name="invoice_policy"/>
field name="tic_category_id"/>
/group>
/page>
/xpath>
/data>
/field>
/record>

In the above code, we use an XPath expression to find the notebook (page_general_information) where the fields are defined. Then, we remove the company_id field by replacing it with a hidden version of itself ().

Next, we create a new page (or notebook tab) called "Custom Tab" and move the desired fields (invoice_policy and tic_category_id) inside this new page using the tag.

1
Avatar
Zrušit
random_mai
Autor

I'm still getting an error. For company id -> ERR: Cannot read properties of undefined (reading 'company_id')

And for moving the invoice_policy and tic_category_id -> ERR: Field "invoice_policy" does not exist in model "product.product"

shubham shiroya

he invoice_policy and tic_category_id fields might be defined in related models or inherited models.
To resolve these errors and successfully move or hide the fields, you need to find the correct model where these fields are defined and update your code accordingly. Here's an example of how you can modify the code:

record id="view_product" model="ir.ui.view">
field name="name">custom.product.product.form.inherit</field>
field name="model">product.template</field>
field name="priority" eval="6"/>
field name="inherit_id" ref="product.product_template_only_form_view"/>
field name="arch" type="xml">
xpath expr="//page[@name='general_information']" position="inside">
field name="barcode" position="replace"/>
/xpath>
xpath expr="//page[@name='general_information']/group[@name='general_info_group']" position="inside">
field name="invoice_policy" position="replace"/>
field name="tic_category_id" position="replace"/>
/xpath>
/field>
/record>

In this modified code:

The model field is changed to product.template to match the correct model where the fields are defined.

The inherit_id is set to product.product_template_only_form_view to inherit the form view specific to the product.template model.

The <xpath> expressions are adjusted to target the correct locations within the view hierarchy, considering the new model and view.

random_mai
Autor

sorry, now i'm getting this error -> Field "invoice_policy" does not exist in model "product.template"

apparently it still doesn't exist. this is odoo16v if it helps

shubham shiroya

model in Odoo 16, you can use the following approach:
record id="view_product_template_form" model="ir.ui.view">
field name="name">custom.product.template.form.inherit</field>
field name="model">product.template</field>
field name="inherit_id" ref="product.product_template_only_form_view"/>
field name="arch" type="xml">
xpath expr="//field[@name='barcode']" position="replace">
!-- Your modified barcode field -->
/xpath>
xpath expr="//field[@name='tic_category_id']" position="replace">
<!-- Your modified tic_category_id field -->
/xpath>
xpath expr="//field[@name='company_id']" position="attributes">
attribute name="invisible">1</attribute>
/xpath>
/field>
/record>
In this example, I have assumed that the barcode and tic_category_id fields exist in the product.template model. You can modify the code inside the <xpath> tags to define the modifications you want to make to these fields.

Make sure to update the model attribute in the <record> tag to match the target model for your customization.

random_mai
Autor

the fields are now hidden, thank you for that. however, i still can't use invoice_policy and tic_category_id

random_mai
Autor

Can i use xpath to show the field?

shubham shiroya

yes,you can

random_mai
Autor

how can i use xpath to show the invisible field?

random_mai
Autor

<style type="text/css">
p.p1 {
margin: 0.0px 0.0px 0.0px 0.0px;
font: 13.0px 'Helvetica Neue'
}

p.p2 {
margin: 0.0px 0.0px 0.0px 0.0px;
font: 13.0px 'Helvetica Neue';
min-height: 15.0px
}
</style>
<style type="text/css">
p.p1 {
margin: 0.0px 0.0px 0.0px 0.0px;
font: 11.0px 'Helvetica Neue'
}

p.p2 {
margin: 0.0px 0.0px 0.0px 0.0px;
font: 11.0px 'Helvetica Neue';
min-height: 12.0px
}
</style>
<style type="text/css">
p.p1 {
margin: 0.0px 0.0px 0.0px 0.0px;
font: 13.0px 'Helvetica Neue'
}

p.p2 {
margin: 0.0px 0.0px 0.0px 0.0px;
font: 11.0px 'Helvetica Neue';
min-height: 12.0px
}

p.p3 {
margin: 0.0px 0.0px 0.0px 0.0px;
font: 11.0px 'Helvetica Neue'
}
</style>
<p>&nbsp;&lt;xpath expr=&quot;//field[@name=&apos;invoice_policy&apos;]&quot; position=&quot;attributes&quot;&gt;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;attribute name=&quot;invisible&quot;&gt;0&lt;/attribute&gt;</p>
<p>&lt;/xpath&gt;</p>

This code doesn't display the invoice_policy

random_mai
Autor

i need to use xpath instead of field since i am having an error that the field doesnt exist

shubham shiroya

xpath expr="//field[@name='invoice_policy']" position="attributes">
attribute name="invisible">0</attribute>
/xpath>

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
How make the values of a field dissappear in QWEB report?
xml product.product
Avatar
Avatar
1
kvě 20
2689
Pass field value to iframe src Vyřešeno
fields xml iframe
Avatar
Avatar
Avatar
2
srp 22
8667
Is it possible to use fa-icons in field string?
fields xml string v14
Avatar
Avatar
1
úno 24
2447
View displays duplicate fields despite setting it as invisible Vyřešeno
field product.product position odoo16features
Avatar
Avatar
Avatar
2
čvn 23
3321
Calling res.partner field in pos receipt
javascript fields xml odoo10
Avatar
Avatar
1
čvn 23
4497
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