İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Problem with inheritance of a view.

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
viewinheritance
1 Cevapla
8717 Görünümler
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
Vazgeç
Luis Filipe Castanheira
Üretici

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
En İyi Yanıt

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
Vazgeç
Luis Filipe Castanheira
Üretici

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
Üretici

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!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
View inheritance Çözüldü
view inheritance
Avatar
Avatar
1
Mar 20
4371
How do I remove fields from a view in a custom module? Çözüldü
view inheritance
Avatar
Avatar
Avatar
Avatar
12
Ara 18
36198
Weird error "Expression cannot be located in parent view" in view inheritance Çözüldü
view inheritance
Avatar
Avatar
1
Tem 16
7923
Two-level view inheritance, what am I missing?
view inheritance
Avatar
Avatar
2
Mar 15
6853
Is "search + use arch" the right way to derive a form ?
view inheritance
Avatar
0
Mar 15
4572
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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