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

Problem with inheritance of a view.

Subscribe

Get notified when there's activity on this post

This question has been flagged
viewinheritance
1 Reply
8701 Views
Avatar
Luis Filipe Castanheira

In order to show some workflow buttons to members of a group and hide them from all others, I am trying to inherit a view of a custom module that I am developing in OpenERP 7.0

In my original view I have the following code:

<?xml version="1.0"?>
<openerp>
    <data>
(...)
        <!-- ### GENERIC REQUEST ### -->
        <record model="ir.ui.view" id="view_generic_request_form">
            <field name="name">generic_request.form</field>
            <field name="model">generic.request</field>
            <!-- ####### F O R M   V I E W  ###### -->        
            <field name="arch" type="xml">
                <form string="generic_request" version="7.0">
                    <header>
     (...)                   
                        <!-- treatment (authorized & approved)-->

                        <button name="wtv" invisible="1" />
                        <button name="close_request" class="oe_highlight oe_view_mode_only" string="Close Request Process" help="This will close the request and end the process here" type="workflow" attrs="{'invisible':['|', ('state', 'not in', ['treatment', 'authorized', 'approved']), ('ami_owner', '=', False)]}"  />
                        <button name="%(action_auth_generic_request)d" class="oe_view_mode_only" string="Ask for authorization wiz" help="" type="action" attrs="{'invisible':['|', '|', ('state', 'not in', ['treatment', 'authorized', 'approved']), ('authorized','=', True), ('ami_owner', '=', False)]}" />
                        <button name="%(action_appr_generic_request)d" class="oe_view_mode_only" string="Ask for approval wiz" help="" type="action"  attrs="{'invisible':['|', '|', '|', ('state', 'not in', ['treatment', 'authorized', 'approved']), ('authorized','=', True), ('approved','=', True), ('ami_owner', '=', False)]}"  />
                        <button name="%(action_reformulate_generic_request)d" class="oe_view_mode_only" string="Send to be reformulated w2" help="Send request back to requester to be reformulated" type="action"  attrs="{'invisible': ['|',('state', 'not in', ['treatment', 'authorized', 'approved']), ('ami_owner', '=', False)]}"/>

                            <!-- give and take buttons -->                    
                            <button name="take_request" string="Take request" help="Take this request to your responsability" attrs="{'invisible': ['|',('ami_owner', '=', True), ('state', 'not in', ['treatment', 'authorized', 'approved']),]}" />
                            <button name="%(action_give_request)d" string="Give request wiz" help="Give this request to someone else's responsability" type="action" attrs="{'invisible': ['|',('ami_owner', '=', False),'|', ('state', 'not in', ['treatment', 'authorized', 'approved']),]}"  />

    (...)             

    
In my inherited view XML I have this:

<?xml version="1.0"?>
<openerp>
    <data>
<!-- ###  SHOW WTV BUTTON ONLY TO HR MEMBERS  ### -->
<record model="ir.ui.view"  id="view_generic_request_form_hr">
    <field name="name">view.generic.request.form.hr</field>
    <field name="model">generic.request</field>
    <field name="inherit_id" ref="processos_uc.view_generic_request_form"/>
    <field name="groups_id" eval="[(6, 0, [ref('processos_uc.group_processos_hr') ])]"/>
    <field name="arch" type="xml">
        <field name="wtv" position="attributes">
            <attribute name="invisible">0</attribute>
        </field>
    </field>
</record>
    </data>
</openerp>

And I get this error:

AttributeError: View definition error for inherited view '' on model 'generic.request': Element '<field name="wtv">' not found in parent view 'processos_uc.view_generic_request_form'

I've seen other examples of inheritance and can't figure out what I'm doing wrong. Can anyone help?

Here is the full (and now correct) trace :

2014-05-27 14:16:52,567 4156 INFO may_9 openerp.modules.loading: module processos_uc: loading inherit_view.xml
2014-05-27 14:16:52,596 4156 ERROR may_9 openerp.addons.base.ir.ir_ui_view: Can't render view  for model: generic.request
Traceback (most recent call last):
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_ui_view.py", line 126, in _check_render_view
    fvg = self.pool.get(view.model).fields_view_get(cr, uid, view_id=view.id, view_type=view.type, context=context)
  File "/opt/openerp/v7/server/openerp/osv/orm.py", line 2237, in fields_view_get
    arch=apply_view_inheritance(cr, user, source, sql_res['id']),
  File "/opt/openerp/v7/server/openerp/osv/orm.py", line 2195, in apply_view_inheritance
    source = apply_inheritance_specs(source, view_arch, view_id)
  File "/opt/openerp/v7/server/openerp/osv/orm.py", line 2179, in apply_inheritance_specs
    raise_view_error("Element '%s' not found in parent view '%%(parent_xml_id)s'" % tag, inherit_id)
  File "/opt/openerp/v7/server/openerp/osv/orm.py", line 2072, in raise_view_error
    %  (child_view.xml_id, self._name, error_msg))
AttributeError: View definition error for inherited view '' on model 'generic.request': Element '<field name="wtv">' not found in parent view 'processos_uc.view_generic_request_form'
2014-05-27 14:16:52,598 4156 ERROR may_9 openerp.tools.convert: Parse error in /home/lfc/openerp/v7/addons/processos_uc/inherit_view.xml:5:
<record model="ir.ui.view" id="view_generic_request_form_hr">
    <field name="name">view.generic.request.form.hr</field>
    <field name="model">generic.request</field>
    <field name="inherit_id" ref="processos_uc.view_generic_request_form"/>
    <field name="groups_id" eval="[(6, 0, [ref('processos_uc.group_processos_hr') ])]"/>
    <field name="arch" type="xml">
        <field name="wtv" position="attributes">
            <attribute name="invisible">0</attribute>
        </field>
    </field>
</record>
Traceback (most recent call last):
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 847, in parse
    self._tags[rec.tag](self.cr, rec, n)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 814, in _tag_record
    id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 964, in _update
    res_id = model_obj.create(cr, uid, values, context=context)
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_ui_view.py", line 103, in create
    return super(view, self).create(cr, uid, values, context)
  File "/opt/openerp/v7/server/openerp/osv/orm.py", line 4472, in create
    self._validate(cr, user, [id_new], context)
  File "/opt/openerp/v7/server/openerp/osv/orm.py", line 1546, in _validate
    raise except_orm('ValidateError', '\n'.join(error_msgs))
except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')
2014-05-27 14:16:52,599 4156 ERROR may_9 openerp.netsvc: ValidateError
Error occurred while validating the field(s) arch: Invalid XML for View Architecture!
Traceback (most recent call last):
  File "/opt/openerp/v7/server/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp/v7/server/openerp/service/web_services.py", line 622, in dispatch
    security.check(db,uid,passwd)
  File "/opt/openerp/v7/server/openerp/service/security.py", line 40, in check
    pool = pooler.get_pool(db)
  File "/opt/openerp/v7/server/openerp/pooler.py", line 49, in get_pool
    return get_db_and_pool(db_name, force_demo, status, update_module)[1]
  File "/opt/openerp/v7/server/openerp/pooler.py", line 33, in get_db_and_pool
    registry = RegistryManager.get(db_name, force_demo, status, update_module)
  File "/opt/openerp/v7/server/openerp/modules/registry.py", line 192, in get
    update_module)
  File "/opt/openerp/v7/server/openerp/modules/registry.py", line 218, in new
    openerp.modules.load_modules(registry.db, force_demo, status, update_module)
  File "/opt/openerp/v7/server/openerp/modules/loading.py", line 350, in load_modules
    force, status, report, loaded_modules, update_module)
  File "/opt/openerp/v7/server/openerp/modules/loading.py", line 256, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/opt/openerp/v7/server/openerp/modules/loading.py", line 187, in load_module_graph
    load_update_xml(module_name, idref, mode)
  File "/opt/openerp/v7/server/openerp/modules/loading.py", line 74, in <lambda>
    load_update_xml = lambda *args: _load_data(cr, *args, kind='update_xml')
  File "/opt/openerp/v7/server/openerp/modules/loading.py", line 124, in _load_data
    tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 954, in convert_xml_import
    obj.parse(doc.getroot())
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 847, in parse
    self._tags[rec.tag](self.cr, rec, n)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 814, in _tag_record
    id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 964, in _update
    res_id = model_obj.create(cr, uid, values, context=context)
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_ui_view.py", line 103, in create
    return super(view, self).create(cr, uid, values, context)
  File "/opt/openerp/v7/server/openerp/osv/orm.py", line 4472, in create
    self._validate(cr, user, [id_new], context)
  File "/opt/openerp/v7/server/openerp/osv/orm.py", line 1546, in _validate
    raise except_orm('ValidateError', '\n'.join(error_msgs))
except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')
2014-05-27 14:16:52,607 4156 INFO may_9 werkzeug: 193.136.201.121 - - [27/May/2014 14:16:52] "POST /web/dataset/call_button HTTP/1.1" 200 -

 

0
Avatar
Discard
Luis Filipe Castanheira
Author

Question / Error and trace updated (I was trying to simplify and I guess I complicated things a bit)

Ludo - 21South

I edited my comment below.

Avatar
Ludo - 21South
Best Answer

This often happens when developing different versions and switching back and forth between them. The view that is causing the crash (view_generic_request_form_hr) still refers to a field called "close_request". Make sure you are updating/editing the right view.

If you are 100% sure you are updating the right view and it is linked correctly, then look for this field "close_request" on the form you try to inherit. I don't see it in the top view that you posted, but you left out some information on purpose as well.

[EDIT]

Oke, I read your comment. In that case, it is trying to alter a field, while you are trying to alter a button.

So you have:

<field name="close_request position="attributes">

replace that with:

<button name="close_request position="attributes">

1
Avatar
Discard
Luis Filipe Castanheira
Author

Yeah, I did for simplicity sake. I edited the code and those are the buttons I want to Hide (the "wtv" button was added as an example)

Luis Filipe Castanheira
Author

That was it! Thanks!

Ludo - 21South

Glad to hear. If this is resolved now, please mark the answer.

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
View inheritance Solved
view inheritance
Avatar
Avatar
1
मार्च 20
4357
How do I remove fields from a view in a custom module? Solved
view inheritance
Avatar
Avatar
Avatar
Avatar
12
दिस॰ 18
36184
Weird error "Expression cannot be located in parent view" in view inheritance Solved
view inheritance
Avatar
Avatar
1
जुल॰ 16
7909
Two-level view inheritance, what am I missing?
view inheritance
Avatar
Avatar
2
मार्च 15
6837
Is "search + use arch" the right way to derive a form ?
view inheritance
Avatar
0
मार्च 15
4571
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • 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