[6.1/trunk] wrong check : Cannot change the category of existing UoM; patch included

Bug #894434 reported by Raphaël Valyi - http://www.akretion.com
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 2

Bug Description

Try to import several time this UOM CSV file (for instance using the GTK client)

After first importation, subsequent importations will fail (silently, you might want to hack the GTK client to actually make it print the server warning message, this is yet an other GTK bug)
So if you hack the GTK client to display the message, then you'll see the server error response:
(-1, {'category_id': 1, 'name': 'toto', 'factor': 1.0}, u"Line 1 : Warning\nCannot change the category of existing UoM 'toto3'.", '')

If you look in product/product.py, the test of UOM category change is plain wrong:

    def write(self, cr, uid, ids, vals, context=None):
        if 'category_id' in vals:
            for uom in self.browse(cr, uid, ids, context=context):
                if uom.category_id != vals['category_id']:
                    raise osv.except_osv(_('Warning'),_("Cannot change the category of existing UoM '%s'.") % (uom.name,))

You are comparing a browse object to an integer...

Of course this should be instead:

    def write(self, cr, uid, ids, vals, context=None):
        if 'category_id' in vals:
            for uom in self.browse(cr, uid, ids, context=context):
                if uom.category_id.id != vals['category_id']:
                    raise osv.except_osv(_('Warning'),_("Cannot change the category of existing UoM '%s'.") % (uom.name,))

Thanks to change that...

Related branches

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :
Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :

Hello Raphael Valyi ,

I have checked this issue at my end.Its working fine
with trunk without using your patch,I am not properly get
what you want exactly so would you please more elaborate regarding
this issue.

Thanks and waiting for replay.

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Rucha (Open ERP) (rpa-openerp) wrote :

Hello,
I am agree with Raphaël to change the code, actually it was my mistake, thanks Raphaël for pointing out,
moreover I am agree with Jignesh too that this error doesn't come with/without this improvement,
Can you be more specific?

Thank you.

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

Hello,

According to comment#3, this need to be fix.

So I am confirming this issue.

Thank you!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Low
status: Incomplete → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Kirti Savalia(OpenERP) (ksa-openerp) wrote :

Hello,

Thanks For Reporting.
It has been Fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-894434-ksa
revision-id: <email address hidden>
revno: 5794
It will be available in trunk soon

Thanks.

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Raphael Collet (OpenERP) (rco-openerp) wrote :

Landed in trunk
revno: 5831 [merge]
revision-id: <email address hidden>

Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.