Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0][web_widget_x2many_2d_matrix] Cannot read property 'id' of undefined #321

Closed
DayssamAgora opened this issue Mar 9, 2016 · 19 comments
Closed
Assignees
Milestone

Comments

@DayssamAgora
Copy link

Hi everyone,

I got this error when i want to re show the matrix

Uncaught TypeError: Cannot read property 'id' of undefined
http://localhost:3000/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js:215

I debuged the javascript code

the error was in this function

// return row id of a coordinate get_xy_id: function(x, y) { return this.by_x_axis[x][y]['id']; },

when i logged the x & y values

It gives me the value of x is "undefined"

x=1 y=1
x=2 y=1
x=3 y=1
x=4 y=1
x=5 y=1
x=6 y=1
x=7 y=1
x=8 y=1
x=9 y=1
x=10 y=1
x=11 y=1
x=undefined y=1

Normally i have only 11 rows
and it iterates only the first column

@hbrunn
Copy link
Member

hbrunn commented Mar 9, 2016

This widget is quite picky about the data. What code do you use to populate the field and how does the internal data structure look?

@DayssamAgora
Copy link
Author

matrix2d

The python code :

@api.model
def default_get(self,fields):
    defaults = super(Saisie,self).default_get(fields)
    default = super(Saisie,self).default_get(['projet_id'])
    if default:
        projet=self.env['projet.projet'].search([('id','=',default['projet_id'])])
        model=projet.model_saisie
        marques=model.marque_ids
        parametres=model.parametre_ids
        ids= [rec.id for rec in marques]
        marque_names_list = [rec.name for rec in self.env['saisie.marque'].browse(ids) ]
        ids2= [rec.id for rec in parametres]
        parametre_names_list = [rec.name for rec in self.env['saisie.parametre'].browse(ids2)]        
        print "p list", parametre_names_list
        inputdata = [
        parametre_names_list,
        [0],
        marque_names_list,
        [0]
        ]
        result = list(itertools.product(*inputdata))
        print(result)
        defaults['saisie_ligne_id'] = [
        (0, 0, {
            'value': 0,
            'parametre_id': p,
            'marque_id': e,
        })
        for e in ids
        for p in ids2
        ] 
    return defaults

The XML CODE :

@DayssamAgora
Copy link
Author

@hbrunn :

I will make a video showing you the scenario which produce the error

@hbrunn
Copy link
Member

hbrunn commented Mar 9, 2016

that will be helpful. From your code it looks very good, I don't see anything that might be causing the problem

@DayssamAgora
Copy link
Author

@hbrunn
https://youtu.be/s_W5yhPilLk

The error was in this function

// return row id of a coordinate get_xy_id: function(x, y) { return this.by_x_axis[x][y]['id']; },

when i logged the x & y values

It gives me the value of x is "undefined"

x=1 y=1
x=2 y=1
x=3 y=1
x=4 y=1
x=5 y=1
x=6 y=1
x=7 y=1
x=8 y=1
x=9 y=1
x=10 y=1
x=11 y=1
x=undefined y=1

@hbrunn
Copy link
Member

hbrunn commented Mar 10, 2016

interesting. So something seems to go wrong if the widget is build repeatedly. Do you see any patterns here, like the 3rd time you open this, the error occurs? Any patterns in the values filled in? And does a reload fix the problem temporarily?

@DayssamAgora
Copy link
Author

Always the error occurs. but when i save the form there is no problem,

@DayssamAgora
Copy link
Author

@hbrunn

The error occurs in the changed field.

when i change x1y1 it stops @ x1y1

when i change x3y1 it stops @ x3y1

@DayssamAgora
Copy link
Author

@hbrunn

Any idea about sorting the x fields or y fields (not sorted by id by default) ?

@hbrunn
Copy link
Member

hbrunn commented Mar 15, 2016

hmmm, I'm running out of ideas here. I think I need to debug what's going on here. Could you please provide a minimal example module that exposes this behavior when being installed in an empty database with demo data? Then we should be able to fix the problem.

@DayssamAgora
Copy link
Author

@hbrunn
Can i send it to you in private ?

@hbrunn
Copy link
Member

hbrunn commented Mar 15, 2016

yes, makes sense, you should find my mail address on the github profile or the oca site

@DayssamAgora
Copy link
Author

@hbrunn
Its done

hbrunn added a commit to hbrunn/web that referenced this issue Mar 17, 2016
@hbrunn
Copy link
Member

hbrunn commented Mar 17, 2016

@DayssamAgora this should be fixed in #327. Next time somebody asks you for a minimal example that produces the error, please actually provide a minimal example. I had to dive through a lot of unnecessary code, and you're lucky I was curious about that problem, otherwise I'd have put this back to you

@mhabou
Copy link

mhabou commented Mar 17, 2016

@hbrunn 👍

Many thanks ,

I will post a minimal example that produce the error.

@hbrunn
Copy link
Member

hbrunn commented Mar 17, 2016

now it's solved, so not necessary now. That was just a tip for the future

@hbrunn
Copy link
Member

hbrunn commented Mar 17, 2016

but please review my PR and if it solves your problem, give a thumbs up there. This issue will be closed automatically when the code is merged

@hbrunn hbrunn added this to the 8.0 milestone Mar 17, 2016
@DayssamAgora
Copy link
Author

it's done 👍

guewen added a commit that referenced this issue Mar 31, 2016
[FIX] fix #321, choked on cached writes
@hbrunn
Copy link
Member

hbrunn commented May 16, 2016

fixed by merging #327 a while ago

@hbrunn hbrunn closed this as completed May 16, 2016
pedrobaeza pushed a commit to Tecnativa/web that referenced this issue Sep 16, 2016
hbrunn added a commit to hbrunn/web that referenced this issue Sep 20, 2016
pedrobaeza pushed a commit to Tecnativa/web that referenced this issue Sep 21, 2016
pedrobaeza pushed a commit to Tecnativa/web that referenced this issue Sep 21, 2016
pedrobaeza pushed a commit to Tecnativa/web that referenced this issue Sep 21, 2016
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
thomaspaulb pushed a commit to thomaspaulb/web that referenced this issue Dec 5, 2016
simahawk pushed a commit to simahawk/web that referenced this issue Mar 27, 2018
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
fmdl pushed a commit to fmdl/web that referenced this issue May 1, 2018
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
yaniaular pushed a commit to vauxoo-dev/web that referenced this issue May 14, 2018
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
yaniaular pushed a commit to vauxoo-dev/web that referenced this issue May 14, 2018
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
alexey-pelykh pushed a commit to brainbeanapps/web that referenced this issue Nov 9, 2018
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
alexey-pelykh pushed a commit to brainbeanapps/web that referenced this issue Nov 9, 2018
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
yajo pushed a commit that referenced this issue Nov 20, 2018
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix #321, choked on cached writes
AdriaGForgeFlow pushed a commit to ForgeFlow/web that referenced this issue Jan 10, 2020
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
AdriaGForgeFlow pushed a commit to ForgeFlow/web that referenced this issue Feb 14, 2020
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
AdriaGForgeFlow pushed a commit to ForgeFlow/web that referenced this issue Mar 5, 2020
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
Saran440 pushed a commit to ecosoft-odoo/web that referenced this issue Nov 13, 2020
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
Saran440 pushed a commit to ecosoft-odoo/web that referenced this issue Nov 13, 2020
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
pniederlag pushed a commit to datenbetrieb/web that referenced this issue Dec 26, 2020
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
ChrisOForgeFlow pushed a commit to ForgeFlow/web that referenced this issue Dec 13, 2021
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
LoisRForgeFlow pushed a commit to ForgeFlow/web that referenced this issue Feb 18, 2022
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
bizzappdev pushed a commit to bizzappdev/web that referenced this issue Nov 5, 2022
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
JoanSForgeFlow pushed a commit to ForgeFlow/web that referenced this issue Nov 14, 2022
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
tarteo pushed a commit to tarteo/web that referenced this issue Feb 28, 2023
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
PieterPaulussen pushed a commit to GumbysBE/web that referenced this issue Apr 28, 2023
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
dreispt pushed a commit to ursais/web that referenced this issue Jan 21, 2024
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
norlinhenrik pushed a commit to norlinhenrik/web that referenced this issue Jan 28, 2024
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
SodexisTeam pushed a commit to SodexisTeam/web that referenced this issue Feb 29, 2024
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
mohs8421 pushed a commit to mohs8421/oca-web that referenced this issue Jun 18, 2024
* README update to newest OCA template
* Example in README
* Massive performance boost for big matrices, specially on Firefox
* Assign id on row in order to find it back in all cases
* Fix OCA#321, choked on cached writes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants