[6.1] Actions not working when the form has no fields

Bug #951254 reported by mikel
62
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Won't Fix
Medium
OpenERP R&D Web Team
Odoo Web (MOVED TO GITHUB)
6.1
Fix Released
Undecided
OpenERP Publisher's Warranty Team

Bug Description

This is the root of the previuosly reported bug #950690

In actions that have forms associated with no fields like Unreconcile Entries, Reconcile Entries, Post Journal Entries in page "Accounting/Journal Entries/Journal Items" the webclient fails with error:

""
Uncaught TypeError: Cannot read property 'type' of undefined
https://XXXXXXXXXXXXXX/web/webclient/js:31111
""
 in chromiun browser and error

""
view.fields_view.fields[node.attrs.name] is undefined
https://XXXXXXXXXXXX/web/webclient/js:31111
""

 in firefox

Unreconcile Entries, for example has the followinf XML

        <record id="account_unreconcile_reconcile_view" model="ir.ui.view">
            <field name="name">Unreconcile Entries</field>
            <field name="model">account.unreconcile.reconcile</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
            <form string="Unreconciliation">
                <separator string="Unreconciliation transactions" colspan="4"/>
                <image name="gtk-dialog-info"/>
                <label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
                <separator colspan="4"/>
                    <group colspan="4" col="6">
                        <button icon="gtk-cancel" special="cancel" string="Cancel"/>
                        <button icon="gtk-ok" string="Unreconcile" name="trans_unrec_reconcile" type="object" default_focus="1"/>
                   </group>
               </form>
            </field>
        </record>

And gives the mentioned errors.

Making the following chage the problem is solved

=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2012-03-05 19:58:00 +0000
+++ addons/web/static/src/js/view_form.js 2012-03-10 00:30:10 +0000
@@ -1345,7 +1345,10 @@
         this.value = undefined;
         view.fields[this.name] = this;
         view.fields_order.push(this.name);
- this.type = node.attrs.widget || view.fields_view.fields[node.attrs.name].type;
+ if (view.fields_view.fields[node.attrs.name] == undefined)
+ this.type = 'string';
+ else
+ this.type = node.attrs.widget || view.fields_view.fields[node.attrs.name].type;
         this.element_name = "field_" + this.name + "_" + this.type;

         this._super(view, node);

But I supouse that this is not the best way to solve it

Tags: maintenance
Revision history for this message
mikel (mikel-martin) wrote :
Changed in openerp-web:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
importance: Undecided → Low
status: New → Confirmed
Changed in openerp-web:
importance: Low → Medium
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Hello, I can confirm mikel's patch solves the problem.

Revision history for this message
Nicolas Vanhoren (OpenERP) (niv-openerp) wrote :

Thanks a lot for reporting this bug and contributing to OpenERP. We have double-checked this issue and we can confirm that it does not affect the latest development version of OpenERP (trunk), but only a stable version.
The official OpenERP bug management policy states that bugs reported on stable branches follow a much stricter qualification process, to limit the risk of regressions on these production-grade versions.
These are exclusively handled by the OpenERP Entreprise Team, and should be reported via the OpenERP Enterprise (OPW) maintenance service.
You can find more details about all of this in the FAQ of our Bug Management Policy documentation:
   http://bit.ly/openerp-bugs-faq (FAQ #2)

Thank you for your contributions and for your understanding!

Changed in openerp-web:
status: Confirmed → Won't Fix
tags: added: maintenance
Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello,

This has already been fixed in http://bazaar.launchpad.net/~openerp/openobject- addons/6.1/revision/6842.
Revision no. : 6842.

Thanks.

affects: openerp-web → openobject-addons
Revision history for this message
Lluis Gili Belmonte (tictacbum) wrote :

Hello,
are you sure this is the right revision? It only removes image tags and changes colspan values

http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/revision/6842

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

Bug watches keep track of this bug in other bug trackers.