Pregunta

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!

ValueError: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard

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('generic.request').write(cr,uid,context['active_id'],
                                                     {'reformulation_info' : reformulation_info})
            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!

¿Fue útil?

Solución

The error message is telling you where the trouble is: you're using an id reformulate_generic_request_wizard that isn't declared anywhere.

Your button should point at the action's id, action_reformulate_generic_request_wizard.

So, try this:

<button  name="%(action_reformulate_generic_request_wizard)d" string="Button that calls wizard" type="object" />
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top