[6.1] Error in View after execute a button object

Bug #974323 reported by kurt
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
Status tracked in Trunk
6.1
Confirmed
Low
OpenERP Publisher's Warranty Team
Trunk
Invalid
Low
OpenERP Publisher's Warranty Team

Bug Description

addons: 6727
web: 2296
server: 4134

object1 (supplier.import.config):
_columns = {
 'name': fields.char('Name', size=64, required=True),
     'fees_file_ids': fields.one2many('supplier.import.fees.files','config_fees_id','Fields'),
 }

object2 (supplier.import.fees.files):

def read_fees_file(self, cr, uid, ids, context=None):
   fees_files = self.browse(cr,uid,ids,context)[0]
   import_fields_ids=[x.id for x in fees_files.field_fees_ids]
   supp = self.write(cr,uid,ids,{'field_fees_ids':[(5,import_fields_ids)]} )
   import_fields = self.pool.get('supplier.import.field').unlink(cr,uid,import_fields_ids)

   res = []
   _struct = {}
   _struct.update({'sequence':2})
   _struct.update({'type':''})
   _struct.update({'name':'TEST3'})
   _rec = [0,False,_struct]
   res.append(_rec)

   val = {'field_fees_ids':res}
   supp = self.write(cr,uid,ids,val)

   view_id=self.pool.get('ir.model.data').get_object_reference(cr, uid, 'supplier_import', 'supplier_import_fees_files_form_view')
   value = {
   'name':_('Fees'),
   'view_type':'form',
   'res_model': 'supplier.import.fees.files',
   "src_model": 'supplier.import.config',
   'view_id': 'supplier_import.supplier_import_fees_files_form_view',
   'views': [(view_id and view_id[1] or 0, 'form')],
   'type': 'ir.actions.act_window_close',
   'target':'new',
   'res_id':ids[0],
   }
   return value

_columns = {
 'name':fields.char('Fees file', size=128, required=True),
     'field_fees_ids': fields.one2many('supplier.import.field','fees_file_id','Fields'),
     'config_fees_id': fields.many2one('supplier.import.config','External Mapping'),
     }

object3 (supplier.import.field):
_columns = {
 'name': fields.char('Name',size=64, required=True),
     'sequence': fields.integer('Sequence',readonly=True, help="Is the order that you want for the columns field in the file"),
     'lang':fields.many2one('res.lang','Language',select=True),
     'fees_file_id': fields.many2one('supplier.import.fees.files','External Mapping'),
 }

views:
<record model="ir.ui.view" id="csv_file_form_view">
    <field name="name">Import</field>
    <field name="model">supplier.import.config</field>
    <field name="type">form</field>
    <field name="priority" eval="5"/>
    <field name="arch" type="xml">
 <form string="Field(s) Mapping">
  <field name="name" select="1"/>
  <group string="Fees File" col="10" colspan="4">
   <field name="fees_file_ids" colspan="4" nolabel="1" select="1" />
   </group>
 </form>
    </field>
</record>

<record model="ir.ui.view" id="supplier_import_fees_files_form_view">
    <field name="name">supplier.import.fees.files.form</field>
    <field name="model">supplier.import.fees.files</field>
    <field name="type">form</field>
    <field name="priority" eval="5"/>
    <field name="arch" type="xml">
    <form string="Fees">
  <field name="name"/>
  <button name="read_fees_file" icon="STOCK_JUMP_TO" />
  <field name="field_fees_ids" colspan="4" nolabel="1" select="1" >
   <tree editable="top">
    <field name="sequence"/>
    <field name="name"/>
    <field name="fees_field_id"/>
   </tree>
  </field>
    </form>
    </field>
</record>

When I push the button to execute 'read_fees_file' I'm getting a error:
--> ' _.detect(self.cache, function (c) {return c.id === id;}) is undefined '

The problem is that in the function (read_fees_file), I delete the current links
of the one2many 'field_fees_ids' and update it whith the new one's, who's creating
new id's in the 'supplier.import.field' object but those id's aren't available when
creating/refreshing the new view.

Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :
Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :

Hello kurt ,

I have checked this issue at my end but I did not face any problem regarding
this issue. but I get view fees_field_id because of its not field of supplier.import.fees.files
.After a removing a field <field name="fees_field_id"/> its working fine at my end.
So would you please check this again and provide more information
regarding this issue.

I have attached a video for you more information.

Thanks and waiting for reply!

Changed in openerp-web:
status: New → Incomplete
Revision history for this message
Sébastien Alix (sebastien-alix) wrote :

Hello,

I'm facing the same problem. I have a button in a one2many list which remove the current line. The form where the one2many list takes place isn't editable in order to not have the "Create" button displayed.
I have attached a video too.

The XML code of the form:

        <record model="ir.ui.view"
                id="view_document_picker_form">
            <field name="name">document.picker.form</field>
            <field name="model">document.picker</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Attach documents">
                    <field name="attachment_ids" colspan="4" nolabel="1"
                        widget="one2many" readonly="1">
                        <tree>
                            <field name="name"/>
                            <field name="datas_fname"/>
                            <field name="datas" filename="datas_fname"/>
                            <button icon="gtk-remove" name="unlink"
                                type="object"
                                confirm="Remove this attachment?"/>
                        </tree>
                    </field>
                    <group col="4" colspan="4">
                        <button type="action"
                            name="%(action_document_picker_attachment_form)d"
                            string="Add a document"
                            icon="gtk-add"/>
                        <button icon="gtk-close" special="cancel"
                                string="Close"/>
                    </group>
                </form>
            </field>
        </record>

The error returned:

    _.detect(self.cache, function (c) {return c.id === id;}) is undefined
    http://172.24.1.170:8069/web/static/src/js/data.js?debug=1332496465.0:731

Changed in openerp-web:
status: Incomplete → New
Revision history for this message
A. Schmid (aschmid) wrote :

Hello,

I'm facing the same issue as Sébastien.

Is there a known workaround ?

Revision history for this message
Timothy Solomon (timothy-spiraleye) wrote :

Happened to me, then realised I was loading the wrong type of object for the field. The error could be more descriptive

Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :

Hello kurt ,

I have checked this again with latest trunk as well as stable.For trunk it's working fine
, Currently this issue produceble with 6.1.So I am assigning this issue to opw team.

Thanks for reporting!

Changed in openerp-web:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :
Revision history for this message
Sébastien Alix (sebastien-alix) wrote :

Hi,

Any news about this bug on the 6.1 branch?

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

Other bug subscribers

Remote bug watches

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