Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Need help with wizards

Subscriure's

Get notified when there's activity on this post

This question has been flagged
wizard
3 Respostes
4742 Vistes
Avatar
Luis Filipe Castanheira

I'm trying to implement a wizard that will update a form a then (if possible, send a signal to workflow to change status of an object, but that will be for later). I'm  trying and trying, but I'm doing something wrong since I get stuck with this annoying error!

I've got these two files inside the "wizard" folder:
reformulate_wizard.py:
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _

class ref_generic_request(osv.osv_memory):
    _name='ref.generic.request'

    _columns = {
        'reformulation_info': fields.text('Reformulation instructions', help='Instructions for the requestor justification the reformulation needs'),
            }

    
    def save_info(self, cr, uid, ids, context=None):
        if 'active_id' in context:
            info=self.browse(cr,uid,ids)[0].reformulation_info
            self.pool.get('project.task').write(cr,uid,context['active_id'],
                                                 {'remaining_hours' : remaining_hrs})
        return {
                'type': 'ir.actions.act_window_close',
         }
ref_generic_request()

reformulate_wizard.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_reformulate_generic_request_wizard" model="ir.ui.view">
            <field name="name">reformulate_generic_request_wizard.form</field>
            <field name="model">ref.generic.request</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Insert reformulation info" version="7.0">
                    <group colspan="4" >
                        <separator string="bla bla bla here" colspan="4"/>
                        <field name="reformulation_info" string="Reformulation info"/>
                        <newline/>
                    </group>
                    <separator string="" colspan="4" />
                    <group colspan="4" col="6">
                        <button  icon="gtk-cancel" special="cancel" string="Cancel"/>
                        <button  icon="gtk-ok" name="save_info" string="Send to reformulation" type="object" />
                    </group>
               </form>
            </field>
        </record>
        <record id="action_reformulate_generic_request" model="ir.actions.act_window">
            <field name="name">Reformulate Request</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">ref.generic.request</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_reformulate_generic_request_wizard"/>
            <field name="target">new</field>
        </record>

        <act_window id="action_reformulate_generic_request"
                name="Reformulate Request"
                res_model="generic.request"
                view_mode="form"
                target="new"
        />

    </data>
</openerp>

And I didn't forget the __init__.py with the "import reformulate_wizard" in it.

I am calling the wizard from my xml view like this (and I guess that's where I'm getting the error):

<button  name="%(reformulate_generic_request_wizard)d" string="Button that calls wizard" type="object" />

In my base folder I'm importing the wizard folder inside the __init__.py:

import parecer
import pedido_generico
import tracing
import wizard


And here is the content of my __openerp__.py (The error might be from the order I'm loading things):


{
    'name': 'Processos UC',
    'version': '0.1',
    'category': 'Tools',
    'description': """
OpenERP Module that implements UC's business processes.""",
    'author': 'Filipe Castanheira',
    'website': 'http://www.uc.pt',
    'depends': ['base','web'],
    'demo': [],
    'test':[],
    #'js': [
    #        'static/js/custom.js',
    #],
    'css': [ 'static/css/uc_css.css' ],
    'update_xml' : [
            'data/action_server.xml',
            'security/security.xml',
            'security/processos_uc_domain_rules.xml',
            'wizard/reformulate_wizard.xml',
            'processos_view.xml',
            'parecer_wkf.xml',
            'pedido_wkf.xml',
            ],
    'data': [
             'security/ir.model.access.csv',
             'data/owner_groups.xml',
             'data/subject_type.xml',
             ],
    'installable': True,
    'images': [],
}

Here is the error message from the server logs.

2014-05-14 16:55:45,182 19742 ERROR may_9 openerp.tools.convert: Parse error in /home/lfc/openerp/v7/addons/processos_uc/processos_view.xml:23:
(...)XML displayed here(...)
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 807, in _tag_record
    f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 154, in _eval_xml
    for n in node]), idref)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 148, in _process
    idref[id]=self.id_get(cr, id)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 824, in id_get
    res = self.model_id_get(cr, id_str)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 833, in model_id_get
    return model_data_obj.get_object_reference(cr, self.uid, mod, id_str)
  File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
    r = self.lookup(self2, cr, *args)
  File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
    value = d[key] = self.method(self2, cr, *args)
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 869, in get_object_reference
    data_id = self._get_id(cr, uid, module, xml_id)
  File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
    r = self.lookup(self2, cr, *args)
  File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
    value = d[key] = self.method(self2, cr, *args)
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 862, in _get_id
    raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
2014-05-14 16:55:45,186 19742 ERROR may_9 openerp.netsvc: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
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 433, in dispatch
    return fn(*params)
  File "/opt/openerp/v7/server/openerp/service/web_services.py", line 444, in exp_authenticate
    res_users = pooler.get_pool(db).get('res.users')
  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 807, in _tag_record
    f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 154, in _eval_xml
    for n in node]), idref)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 148, in _process
    idref[id]=self.id_get(cr, id)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 824, in id_get
    res = self.model_id_get(cr, id_str)
  File "/opt/openerp/v7/server/openerp/tools/convert.py", line 833, in model_id_get
    return model_data_obj.get_object_reference(cr, self.uid, mod, id_str)
  File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
    r = self.lookup(self2, cr, *args)
  File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
    value = d[key] = self.method(self2, cr, *args)
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 869, in get_object_reference
    data_id = self._get_id(cr, uid, module, xml_id)
  File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
    r = self.lookup(self2, cr, *args)
  File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
    value = d[key] = self.method(self2, cr, *args)
  File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 862, in _get_id
    raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard

 


Any help is more than welcome!

0
Avatar
Descartar
Avatar
Jaakko Komulainen
Best Answer

Your button type needs to be "action" when executing an action and the name should be the id of the action to trigger.

 See: https://doc.openerp.com/6.0/developer/2_6_views_events/views/design_element/#button

1
Avatar
Descartar
Avatar
Luis Filipe Castanheira
Autor Best Answer

Thanks for your answer. It solved that problem (I wasn't reading correctly the code, and I read it many times, believe me!).

Now I'm getting this strange error message when I click my button (I say strange because I don't have any occurrence of '111' anywhere in my code. And I did a `grep -R 111 *` to be sure!):

2014-05-15 14:00:49,986 3108 ERROR may_9 openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
  File "/opt/openerp/v7/server/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/v7/server/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/v7/server/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
AttributeError: 'generic_request' object has no attribute '111'
2014-05-15 14:00:49,987 3108 ERROR may_9 openerp.netsvc: 'generic_request' object has no attribute '111'
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 626, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp/v7/server/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/opt/openerp/v7/server/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/v7/server/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/v7/server/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
AttributeError: 'generic_request' object has no attribute '111'


Any idea of wath might be causing this exception?

 

---------------------------------------------------------------

Ok, got it! I had the wrong name in the button, plus the wrong type!

<button  name="%(action_reformulate_generic_request)d" string="Button that calls wizard" type="action" />

Solved it, and it is working fine now. Thanks, all for your help!

1
Avatar
Descartar
Avatar
Kazim Mirza | Founder at TechUltra Solutions
Best Answer

<button  name="%(reformulate_generic_request_wizard)d" string="Button that calls wizard" type="action" />

 

you have to write  action_reformulate_generic_request in "%(reformulate_generic_request_wizard)d"

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

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

Registrar-se
Related Posts Respostes Vistes Activitat
Load currnet record values when calling wizard Solved
wizard
Avatar
Avatar
1
de des. 22
4370
What is wizard ? Solved
wizard
Avatar
Avatar
Avatar
3
de nov. 23
34748
Close wizard in onchange
wizard
Avatar
Avatar
4
de jul. 25
5740
IntegrityError: null value in column "res_model" violates not-null constraint Solved
wizard
Avatar
Avatar
2
de des. 23
18808
populate wizard form dynamically Solved
wizard
Avatar
Avatar
Avatar
Avatar
6
d’abr. 18
22553
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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