← Back to team overview

openerp-india team mailing list archive

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

 

You have been subscribed to a public bug:

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

** Affects: openobject-addons
     Importance: Medium
     Assignee: OpenERP R&D Web Team (openerp-dev-web)
         Status: Won't Fix

** Affects: openerp-web/6.1
     Importance: Undecided
     Assignee: OpenERP Publisher's Warranty Team (openerp-opw)
         Status: Fix Released


** Tags: maintenance
-- 
[6.1] Actions not working when the form has no fields
https://bugs.launchpad.net/bugs/951254
You received this bug notification because you are a member of OpenERP Indian Team, which is subscribed to OpenERP Addons.