[6.0rc1] Poor error handling on import of many2many

Bug #672669 reported by Martin Collins
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Medium
OpenERP's Framework R&D

Bug Description

I have a CSV file of user data res.users.csv in my module. Some of my users belong to several groups. Upon installing my module I was getting a warning in the log:

WARNING:import:Relation not found: Accounting / Accountant,Accounting / Invoice,Accounting / Manager,Administration / Acc
ess Rights,Administration / Configuration,Citrus Growers Association,Internal User,Inventory,Inventory / Checker,Inventory / Coldstore Supervisor,Inventory
/ Forklift Operator,Partner Manager,Pounds Solids / Manager,Pounds Solids / Tech,Product / Manager,Receiving,Receiving / Data Entry Clerk,Receiving / Logist
ics Coordinator,Receiving / Maturity Lab Tech,Receiving / Receiving Foreman,Receiving / Scale Operator,Receiving / Security Officer,Receiving / Sipesa,Recei
ving / Yard Marshall,Sales / Manager,Sales / User,Useability / Analytic Accounting,Useability / Extended View,Useability / Multi Companies,Useability / No O
ne,Useability / Product UoS View,Useability / Product Variant,Warehouse / Manager,Warehouse / User on 'res.groups'

I have three issues with this:

1) All data loaded before this point is rolled back but the install continues. Either roll-back and stop, or commit and go forward. Don't leave me half-installed with nothing but a warning in the log.

2) Which of these twenty-eight items is the problem? Each one is checked individually so tell me exactly which one breaks.

3) After going through in the debugger I discovered it was Product / Manager. This is one of your groups. What was wrong with it? It should not have a slash. You have Sales / Manager, Accounting / Manager, Warehouse / Manager - but you also have Partner Manager and Product Manager. Consistency please!

Related branches

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Martin,

Would you please provide me your .csv file. So i can check at my end.

Thanks.

Changed in openobject-server:
status: New → Incomplete
Revision history for this message
Martin Collins (mkc-steadfast) wrote :

I attach a module that demonstrates the (remaining) problem on a basic demo database. It appears that between reporting this bug and RC1, which I am now running, issue 2 was fixed. That is, it now tells me which relation is at fault.

However, all previous data is still rolled back. In this data you will see there are three users. Only the third has an error in the data ('Partner / Manager' instead of 'Partner Manager') but none of the users are committed. If there were previous data files in the module they too would be rolled back. If there were following files in the module they would be loaded and (assuming no more errors) committed.
Either this should be a fatal error and loading should stop, or it should give a warning and only this record is not committed. The warning should identify the record, as well as the broken field, and all other data should be committed.

Incidentally, Product Manager used to have a slash but Fabien removed it for some reason.

Revision history for this message
Martin Collins (mkc-steadfast) wrote :

After adding my last comment I realised I reported this bug against RC1, and I am still running RC1. So how was issue 2 fixed?
I did it myself. Doh!
Heres a diff:

=== modified file 'bin/osv/orm.py'
--- bin/osv/orm.py 2010-10-18 16:16:38 +0000
+++ bin/osv/orm.py 2010-11-29 16:55:11 +0000
@@ -888,10 +888,10 @@
                                         uid, word, [], operator='=', context=context)
                                 res3 = (res2 and res2[0][0]) or False
                                 if not res3:
- warning += [_("Relation not found: %s on '%s'") % (line[i], relation)]
+ warning += [_("Relation not found: %s on '%s'") % (word, relation)]
                                     logger.notifyChannel("import",
                                             netsvc.LOG_WARNING,
- _("Relation not found: %s on '%s'") % (line[i], relation))
+ _("Relation not found: %s on '%s'") % (word, relation))
                                 else:
                                     res.append(res3)
                             if len(res):

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

I have applied the patch and it works successfully. So please refer it.

Thanks.

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Medium
status: Incomplete → Confirmed
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

AMP, did you commited the patch ?

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello,

Patch has not yet been applied to server. The patch has been applied locally for Qualifying the bug.

Thanks.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

The patch of comment #3 was applied in trunk in rev 3137 <email address hidden>
Thanks!

Looking at issue 1 now.. (note that RC2 will include an update import/export wizard that should allow you to easily create working CSV files)

Changed in openobject-server:
status: Confirmed → In Progress
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Alright, after server revision 3138 <email address hidden>, any CSV import failure will abort module installation, to preserve transactional properties.

Together with the reviewed "import compatible" mode that will be introduced soon, this should allow to work more easily with CSV files.

Changed in openobject-server:
milestone: none → 6.0-rc2
status: In Progress → Fix Released
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.