← Back to team overview

openerp-india team mailing list archive

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

 

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

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/951254

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

Status in OpenERP Web 6.1 series:
  Fix Released
Status in OpenERP Addons (modules):
  Won't Fix

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/openerp-web/6.1/+bug/951254/+subscriptions