Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

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

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
fieldsxmlproduct.productposition
1 Atsakyti
3875 Rodiniai
Portretas
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
Portretas
Atmesti
shubham shiroya

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

Portretas
shubham shiroya
Best Answer

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
Portretas
Atmesti
random_mai
Autorius

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
Autorius

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
Autorius

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

random_mai
Autorius

Can i use xpath to show the field?

shubham shiroya

yes,you can

random_mai
Autorius

how can i use xpath to show the invisible field?

random_mai
Autorius

<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
Autorius

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!

Registracija
Related Posts Replies Rodiniai Veikla
How make the values of a field dissappear in QWEB report?
xml product.product
Portretas
Portretas
1
geg. 20
2673
Pass field value to iframe src Solved
fields xml iframe
Portretas
Portretas
Portretas
2
rugp. 22
8660
Is it possible to use fa-icons in field string?
fields xml string v14
Portretas
Portretas
1
vas. 24
2433
View displays duplicate fields despite setting it as invisible Solved
field product.product position odoo16features
Portretas
Portretas
Portretas
2
birž. 23
3305
Calling res.partner field in pos receipt
javascript fields xml odoo10
Portretas
Portretas
1
birž. 23
4483
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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