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
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • 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

Problem with inheritance of a view.

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
viewinheritance
1 Atsakyti
8715 Rodiniai
Portretas
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
Portretas
Atmesti
Luis Filipe Castanheira
Autorius

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.

Portretas
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
Portretas
Atmesti
Luis Filipe Castanheira
Autorius

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
Autorius

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!

Registracija
Related Posts Replies Rodiniai Veikla
View inheritance Solved
view inheritance
Portretas
Portretas
1
kov. 20
4367
How do I remove fields from a view in a custom module? Solved
view inheritance
Portretas
Portretas
Portretas
Portretas
12
gruod. 18
36196
Weird error "Expression cannot be located in parent view" in view inheritance Solved
view inheritance
Portretas
Portretas
1
liep. 16
7919
Two-level view inheritance, what am I missing?
view inheritance
Portretas
Portretas
2
kov. 15
6852
Is "search + use arch" the right way to derive a form ?
view inheritance
Portretas
0
kov. 15
4572
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