Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Need help with wizards

Subscribe

Get notified when there's activity on this post

This question has been flagged
wizard
3 Replies
4741 Views
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
Discard
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
Discard
Avatar
Luis Filipe Castanheira
Author 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
Discard
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
Discard
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
Load currnet record values when calling wizard Solved
wizard
Avatar
Avatar
1
Dec 22
4369
What is wizard ? Solved
wizard
Avatar
Avatar
Avatar
3
Nov 23
34747
Close wizard in onchange
wizard
Avatar
Avatar
4
Jul 25
5738
IntegrityError: null value in column "res_model" violates not-null constraint Solved
wizard
Avatar
Avatar
2
Dec 23
18808
populate wizard form dynamically Solved
wizard
Avatar
Avatar
Avatar
Avatar
6
Apr 18
22551
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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