openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #01817
[Bug 894434] Re: [6.1/trunk] wrong check : Cannot change the category of existing UoM; patch included
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.
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/894434
Title:
[6.1/trunk] wrong check : Cannot change the category of existing UoM;
patch included
Status in OpenERP Addons (modules):
Incomplete
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...
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/894434/+subscriptions
References