Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • होटल
    रियल एस्टेट
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    कंसल्टिंग
    • अकाउंटिंग फ़र्म
    • Odoo पार्टनर
    • मार्केटिंग एजेंसी
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • टेक्सटाइल
    • Metal
    • फ़र्नीचर
    • फ़ूड
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    अन्य
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

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

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

how to replace or override form view in xml

Subscribe

Get notified when there's activity on this post

This question has been flagged
xmlxpathodoo9.0
8 Replies
46055 Views
Avatar
Silviaa

I'm customizing Invoice task window in odoo 9

My existing form

<record id="view_account_analytic_account_form" model="ir.ui.view">

<field name="name">analytic.analytic.account.form</field>

<field name="model">account.analytic.account</field>

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

<form string="Analytic Account">

<sheet string="Analytic Account">

<field name="name" class="oe_inline" placeholder="e.g. Project XYZ"/>

<group>

<field name="account_type" invisible="1"/>

<field name="partner_id"/>

</group>

<group>

<field name="code"/>

<field name="tag_ids" widget="many2many_tags"/>

<field name="company_id"/>

<field name="currency_id"/>

</group>

</sheet>

</form>

</field>

</record>

Instead of above form I want to replace as below

<form string="Analytic Entry">

<sheet>

<group>

<group>

<field name="name" />

</group>

<group>

<field name="date" />

<field name="ref" />

<field name="company_id" groups="base.group_multi_company" />

</group>

<group string="Product Information">

<field name="product_id" domain="[('name_template','=','Service')]" />

<label for="unit_amount" />

<div>

<field name="unit_amount" class="oe_inline" />

<field name="product_uom_id" class="oe_inline" />

</div>

</group>

</group>

</sheet>

</form>

I tried with

 <xpath expr="//form[@string='Analytic Account']" position="replace" >

 <form>

<!-- my form view -->

</form>  </xpath>

 I don't want to replace my fileds I just want to replace my full form view by using id

can anyone please help me ?

1
Avatar
Discard
Premananth

Yes it will overwrite the existing form view

Avatar
Hilar Andikkadavath
Best Answer

HI,

To override the xml views, you just need to make exact id of view to be override following the modelname ie, id="modelname.id".

That will replace your previous view with the custom one .

Thanks

4
Avatar
Discard
Avatar
Wahab Ali Malik
Best Answer

Sorry for lateness But i think this is still an Issue and all above answer are not good.

If you want to completely replace a form.then you have to follow these steps.

1-Write your new form.

2- If you are not creating new action then skip this step otherwise write your action.

                <record id="module_name.action_all_owners"  model="ir.actions.act_window">

                        <field name="name">All Owners</field>

                        <field name="type">ir.actions.act_window</field>

                        <field name="res_model">res.partner</field>

                        <field name="view_type">form</field>

                        <field name="view_mode">tree,form</field>

                        <field name="context">{'search_default_customer':1,'default_owner':1}</field>

                        <field name="search_view_id" ref="view_res_partner_filter"/>

                        <field name="domain" eval="[('customer', '=', True)]"/>

                        <field name="help" type="html">

                                <p class="oe_view_nocontent_create">

                                        Click to add a contact in your address book.

                                </p>

                        </field>

                 </record>

3-If Action already exist or you write above action, define each view type you write in main action type.like


<record id="module_name.action_all_owners_tree" model="ir.actions.act_window.view">

    <field eval="1" name="sequence"/>

    <field name="view_mode">tree</field>

    <!--<field name="view_id" ref="module_name.view_partner_tree"/> -->

    <field name="act_window_id" ref="module_name.action_all_owners"/>

</record>


<record id="module_name.action_all_owners_form" model="ir.actions.act_window.view">

    <field eval="2" name="sequence"/>

    <field name="view_mode">form</field>

    <field name="view_id" ref="module_name.view_partner_form"/> 

    <field name="act_window_id" ref="module_name.action_all_owners"/>

</record>


ID -Must be unique.

eval - Sequence of view type 

view_mode - [form,tree,kanban,etc..]

view_id - ID of new form or tree view you want to replace.

act_window_id - ID of main action on which you want to perform stuff

IMPORTANT ::If you just want to add one new view type like form but not want to disturb sequence then write tree and kanban view with out view_id as you can see in tree view action i just comment view_id so it just only update form view without disturbing view sequence.


1
Avatar
Discard
Avatar
Dachi Darchiashvili
Best Answer

Try use this:

<xpath expr="//form" position="replace">

0
Avatar
Discard
Avatar
Mehul Patel
Best Answer

first you just need to give id of view that you want to override in model.

<record id='view_account_analytic_account_form' model='ir.ui.view'>

<field name="name">account.analytic.account.form</field>

<field name="model">account.analytic.account</field>

<field name="type">form</field>

<field name="inherit_id" ref="account.view_form_id"/> // give (view_from_id ) Id of Form View to override form view

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

<data> <xpath expr="//form" position="replace">

</xpath> 

</data>

</field>

</record>

0
Avatar
Discard
Levi Bensley

I tried this, but for the sale view, but then couldn't update the base sale module or modules such as sale_purchase do to a missing field (one that i added in my custom module)

Avatar
Premananth
Best Answer

Hi Silviaa


<record id="analytic.view_account_analytic_account_form" model="ir.ui.view">

<field name="name">analytic.analytic.account.form</field>

<field name="model">account.analytic.account</field>

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

    please place your code

</field>

</record>

0
Avatar
Discard
Premananth

I hope this will help you.

Silviaa
Author

It will hide old form fields too ?

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

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

Sign up
Related Posts Replies Views Activity
How to select an <xpath> element?
xml xpath
Avatar
Avatar
Avatar
Avatar
3
अप्रैल 21
9545
How to add notebook via xpath Solved
xml xpath
Avatar
Avatar
2
जून 20
6477
how i can use xpath for notebook in odoo 12 ? Solved
xml xpath
Avatar
Avatar
1
अक्तू॰ 19
5293
How to add image on each page in account invoice report in odoo9 ?
xml odoo9.0
Avatar
0
अक्तू॰ 17
3613
why xml code causing Unfinished literal error? Solved
xml xpath
Avatar
Avatar
1
मार्च 15
14673
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة 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, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

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