CSV export crash when browse null is in some relations

Bug #583265 reported by Nicolas Bessi - Camptocamp
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Won't Fix
Undecided
Unassigned

Bug Description

CSV export generates client side error can not marshal osv.orm.browse_null.

The error comes from the fact in that browse_null are exported instead of false.
I have made a temporary patch that remove the browse_null, but I did not have the time to trace the export functions (that lack a little comments), so the patch can be far better.

Regards

Nicolas

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Nicolas,

I would prefer to generate the situation where I can face the problem.

Would you please tell us the steps you followed?

Thanks.

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Here's the patch I did.

You can easily reproduce this by trying to export a field of a relation which doesn't exist. For example, create a picking without address and try to export address' name.

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

The patch of Albert is far better than mine.

Regards

Nicolas

Changed in openobject-server:
status: New → Confirmed
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello,

I wonder how it crashes.

There is a method check_type() which will always give you the corresponding null value(0,0.00,False,'').

However, I am still trying to generate the error by some reverse-engineering (checking how can I forcefully generate).

Thanks.

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Hi Jay,
have you tried to reproduce it with the given example: "create a picking without address and try to export address' name."?

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

Hello Albert,

Yes, I tried the same way out.

Doesn't the method check_type() resists the problem at your end?

Thanks.

Revision history for this message
Samantha (samantha-z-mathews) wrote :

no luck to re-birth is at my station.

Changed in openobject-server:
status: Confirmed → Invalid
Changed in openobject-server:
milestone: none → 5.0.15
Revision history for this message
Mikel Ruiz (mkruiz) wrote :

Hello,

I know this bug is a bit old, but I have the same problem here. Albert's patch works perfectly.

Jay: the problem with check_type() is that it's only called if the column exists either in self._columns or in self._inherit_fields. When exporting fields from related fields (i.e. when the column doesn't belong to the current object) the column types aren't available. Maybe this is the real bug (?) and it should really never happen.

To reproduce, try going to Sales Management/Sales Orders, create one entry with a shipping address without country and then export Shipping Address/Country/Contry Code. At that point 'country_id' isn't found in self._columns or in self._inherit_fields and check_type isn't called.

Regarding the proposed patch, I find defaulting to an empty string when marshaling a null object (of an unknown column type) is much better than crashing.

Thanks!

Changed in openobject-server:
status: Invalid → Confirmed
Revision history for this message
Mikel Ruiz (mkruiz) wrote :

By the way, I think that the second part of the patch is unnecessary as data[fpos] = tools.ustr(r or '') should do the job.

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

Hello,

I have checked this issue with latest trunk and it is working fine.

So this issue only effect for the stable version5.

For this type of stable version's issue, If you have a support and maintenance contact with us then you can contact with our OPW team at <email address hidden>, they will definitely help you.

Thank you!

Changed in openobject-server:
status: Confirmed → Won't Fix
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.