← Back to team overview

credativ team mailing list archive

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

 

** Changed in: openobject-addons
       Status: Confirmed => In Progress

-- 
You received this bug notification because you are a member of OpenERP
Framework Experts, 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):
  In Progress

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