Document module migration of "url" attachments

Bug #809745 reported by Guewen Baconnier @ Camptocamp
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 1

Bug Description

Hello,

On trunk (same problem in stable 6):
In the document module, in document.py there is a method _attach_parent_id to migrate documents on the installation of the module.

The query :
cr.execute("UPDATE ir_attachment SET file_size=length(db_datas) WHERE file_size = 0;")
will work only for attachments of type "binary", for those one of type "url" it will raise a not null constraint error and block the module installation :
ERROR: null value in column "file_size" violates not-null constraint
Because length() of an empty column returns null.

To fix, replace the query by:
cr.execute("UPDATE ir_attachment SET file_size=length(db_datas) WHERE file_size = 0 and type = 'binary';")

Thanks
Regards
Guewen

Related branches

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Guewen,

I have checked your bug report as well as your patch.
you patch seems good.
you have described ERROR: null value in column "file_size" violates not-null constraint which is I am not able to reproduce at my end.

So would you please provide me the proper example or proper steps to reproduce it.

Thanks and waiting for your reply!

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hello,

 - Create a new database with demo data
 - Open a customer
 - Go to attachments and create a new one :
   * Name: as you want
   * Type: URL
   * Url: as you want
 - Go to Modules
 - Install the "document" module

Thanks

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

Hello Guewen,

Thanks for your reply!
Now I have reproduce the same at my end.

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Medium
status: Incomplete → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
DBR (OpenERP) (dbr-openerp) wrote :

Hello Guewen ,

Thanks for the patch.
Its fixed in following branch:
lp:~openerp-dev/openobject-addons/trunk-bug-809745-dbr
It will be merge soon with trunk addons.

Revision ID : 4923 <email address hidden>
Revision No : 4923

Thank You.

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Fix Released
Revision history for this message
qdp (OpenERP) (qdp) wrote :

fix released on revision 5057 revid:<email address hidden>

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.