← 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

 

Landed in trunk
revno: 5831 [merge]
revision-id: rco@xxxxxxxxxxx-20111130154615-3hqztlw2e3771rx3


** Changed in: openobject-addons
       Status: Fix Committed => Fix Released

-- 
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):
  Fix Released

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