Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

Uncaught TypeError: Cannot read property '1' of undefined

By
daouda
on 8/14/13, 12:24 PM 48,910 views

Hi guys, I am facing this problem when i am trying to create a new customer. Can you please help me correct this bug. Thanks in advance

I am also getting this same error when creating a new product from the point of sale menu. When I create a new product from anywhere else (like purchase menu) I do not get this error.

It happens for all users for me.

I have tried setting defaults in debug mode but that doesn't seem to find this 'undefined ' field.

The only thing I might be able to attribute this to is deleting the others category from point of sale categories (but it recreates it automatically).

Jason Christensen
on 12/17/13, 5:42 PM
3

Felipe

--Felipe--
962
| 5 3 8
Bogotá, Colombia
--Felipe--
Informatics engineer Industrial engineer
Felipe
On 12/17/13, 7:50 PM

This error is because there is a property field in that model, on that form that doesn't have his generic value defined, probably someone delete it.

you should be getting this same error one time for every property with no generic value inside that form.

the model is the object, for example the partner 'res.partner'

What is a property field?

https://accounts.openerp.com/forum/Help-1/question/24622/

Where can I define the generic value?

first you need to know the property you are going define, to know that, get developer mode on that form and check for fields that begins with 'property', properties are usually accounts, in res.partner we also have the price-lists.

so lets say for example our property is 'property_account_receivable' from the partner object, which is a many2one field to the object account.account

now we go to settings --> parameters --> configuration parameters

we filter for generics and search for it, if there is no lines, then thats a problem and we need one.

so we create one with the name:'property_account_receivable', field: Account Receivable, type:many2one, resource:[no value], account.account, and the default account we would want to put.

Thank you so much. Your answer was helpful and I gave you a thumb up!

Ahmed Ghazi
on 2/1/14, 2:31 AM
2
Luiz C. Ferreira
On 3/27/14, 5:42 PM

Hi.

The solution is:

In the file /addons/web/static/src/js/view_form.js

Replace the lines:

if (! no_recurse) {
        var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
        this.alive(dataset.name_get([self.get("value")])).done(function(data) {
            self.display_value["" + self.get("value")] = data[0][1];
            self.render_value(true);
        });
    }

By:

if (! no_recurse) {
        var dataset = new instance.web.DataSetStatic(this, this.field.relation, self.build_context());
        this.alive(dataset.name_get([self.get("value")])).done(function(data) {
            if(typeof data[0] != "undefined" && data[0] != null && data[0].length > 0){
                self.display_value["" + self.get("value")] = data[0][1];
                self.render_value(true);
            }
            else {
               return false;
            }
        });

}
0

You could get the real reason with a small js print to debug.

Go to \addons/web/static/src/js/view_form.js#L533  and add the following lines:

console.log("FIELDNAME "+fieldname);
console.log(self.fields);


After reproduce the error and then check on your browser developer tools console to see the problem.

For chrome use right-click and inspect option and see the console.


Answer by @oscarolar

0
Aboura Nacim
On 6/22/16, 7:32 PM

If using nginx, read this post >>

http://www.developpez.net/forums/d1498867/logiciels/solutions-d-entreprise/erp/odoo-ex-openerp/v8-importation-csv-error-cannot-read-property-1-of-undefined/

0

Omal Bastin

--Omal Bastin--
1146
| 6 6 8
Kochi, Kerala, India
--Omal Bastin--

Swiming deep into openERP/ODOO

Omal Bastin
On 2/18/15, 7:44 AM

Usually this error comes when you try to pass an non existing id to a many2many/many2one field.

0
Elevenmidia
On 3/22/14, 11:22 AM

This is happening also with my when I access the Products form and click on Create. Following the instructions I found 5 property values on product form: 3 for stock counter parts (property_stock_procurement, property_stock_production and property_stock_inventory) and 2 for accounting (property_account_income and property_account_expense). All 5 property values are defined on settings / parameters / configuration parameters. Any idea please?

0
Jason Christensen
On 12/17/13, 5:42 PM

I am also getting this same error when creating a new product from the point of sale menu. When I create a new product from anywhere else (like purchase menu) I do not get this error.

It happens for all users for me.

I have tried setting defaults in debug mode but that doesn't seem to find this 'undefined ' field.

The only thing I might be able to attribute this to is deleting the others category from point of sale categories (but it recreates it automatically).

0
Ahmed Ghazi
On 1/31/14, 2:31 AM

I am getting this error when trying to add a customer invoice. The error appears when I try to add an invoice line, it gives this error and does not allow me to add an invoice line.

I checked the property fields as suggested and all fields seems to be there. The system is a fresh install with a custom chart of accounts. Account payable and receivable are available for the customer. Also income and expense accounts are available for the product.

Please help.

UPDATE: The issue is now fixed. There was not default account set for the generic properties of receivable, payable, expense and income accounts. Thank you so much for your help.

remember that answer posts are only for answer, you can put your question as a comment to my answer, and also remember to thumb up if it was helpful.

Felipe
on 1/31/14, 3:01 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

4 follower(s)

Stats

Asked: 8/14/13, 12:24 PM
Seen: 48910 times
Last updated: 6/30/16, 7:16 PM