Skip to Content
Menu
This question has been flagged
1 Reply
9414 Views

I have managed to import Customers via a .csv file. Now I am trying to import Vendors from a .csv file; but after fixing the most obvious errors, the Vendors .csv import validation now for me fails with:

new row for relation "res_partner" violates check constraint "res_partner_check_name" DETAIL: Failing row contains (4297, null, 1, null, null, 2016-10-06 15:35:02.084982, 0, person, null, null, null, null, null, null, null, 4296, f, null, null, f, Europe/Copenhagen, null, t, null, null, null, f, null, 2016-10-06 15:35:02.084982, t, null, 32, da_DK, 32, null, null, contact, f, null, null, null, null, always, null, f, null, null, null, null, null, null). at row 4
new row for relation "res_partner" violates check constraint "res_partner_check_name" DETAIL: Failing row contains (4314, null, 1, null, null, 2016-10-06 15:35:02.084982, 0, person, null, null, null, null, null, null, null, 4313, f, null, null, f, Europe/Copenhagen, null, t, null, null, null, f, null, 2016-10-06 15:35:02.084982, t, null, 32, da_DK, 32, null, null, contact, f, null, null, null, null, always, null, f, null, null, null, null, null, null). at row 20
new row for relation "res_partner" violates check constraint "res_partner_check_name" DETAIL: Failing row contains (4351, null, 1, null, null, 2016-10-06 15:35:02.084982, 0, person, null, null, null, null, null, null, null, 4350, f, null, null, f, Europe/Copenhagen, null, t, null, null, null, f, null, 2016-10-06 15:35:02.084982, t, null, 32, da_DK, 32, null, null, contact, f, null, null, null, null, always, null, f, null, null, null, null, null, null). at row 56
...

I have absolutely no idea what the problem is here; there are lots of "null"s in the shown rows, however, I am positive that all of the rows in the .csv have the Name field filled, so that cannot be the problem. Also, these printed rows have absolutely no information from the originating .csv, so I cannot really pinpoint which are the right .csv rows causing this?

I sort of suspect that a problem might be duplicate names, but none of the reported rows have names that are duplicates in the Vendors .csv I imported previously?! So maybe they should be duplicates? But then i have other rows which don't have duplicate names, and I they are not reported in the validation error?

Furthermore, how can I debug a problem like this? I tried a `grep -r res_partner_check_name odoo1_git/`, but nothing is returned. So the string `res_partner_check_name` shown in the error is not in the Python part of the code - does it come from the database, then?


So why does this error happen - and how can I fix it; or alternatively, how could I debug this error, so as to find what lead to the problem?

Avatar
Discard
Author Best Answer

(I had to try to write this in pieces (with editing the answer), because the first time I tried to post an answer, it simply got lost in the system - didn't even get a warning message - and I wasted my time)

OK, I think I got somewhere; first of all, I inspected the database with the `pgAdmin III` tool, and could see that `res_partner_check_name` is indeed a constraint in the `res_partner` database:

Then, I noticed on the server, in the log file `/var/log/postgresql/postgresql-9.3-main.log`:

2016-10-06 17:35:47 CEST STATEMENT:  INSERT INTO "res_partner" ("id", "notify_email", "color", "company_type", "use_parent_address", "active", "supplier", "tz", "opt_out", "company_id", "parent_id", "type", "is_company", "lang", "employee", "customer", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('res_partner_id_seq'), 'always', 0, 'person', false, true, false, 'Europe/Copenhagen', false, 1, 4640, 'contact', false, 'da_DK', false, true, 32, 32, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id
2016-10-06 17:35:54 CEST ERROR: new row for relation "res_partner" violates check constraint "res_partner_check_name"
2016-10-06 17:35:54 CEST DETAIL: Failing row contains (4689, null, 1, null, null, 2016-10-06 15:35:02.084982, 0, person, null, null, null, null, null, null, null, 4688, f, null, null, f, Europe/Copenhagen, null, t, null, null, null, f, null, 2016-10-06 15:35:02.084982, t, null, 32, da_DK, 32, null, null, contact, f, null, null, null, null, always, null, f, null, null, null, null, null, null).

So indeed, there is no name inserted here...

Ultimately, this is what the problem was - in my Vendors .csv, I had a field that was a bank account; I had tried to map this to a relational field "Contacts / Banks / Account Number", and it was this causing the validation errors - apparently this mapping triggered somehow the row insertion noted above. As soon as I set the mapping of this field to "Don't import", validation passed without the above errors - and I could import my Vendors data.

Avatar
Discard
Related Posts Replies Views Activity
0
Oct 24
98
2
May 24
2371
0
Apr 24
308
2
Jul 23
1029
1
Sep 22
1105