** Attachment added: "uom.csv"
   
https://bugs.launchpad.net/openobject-addons/+bug/894434/+attachment/2607133/+files/uom.csv

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP Project Group.
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):
  New

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

_______________________________________________
Mailing list: https://launchpad.net/~c2c-oerpscenario
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~c2c-oerpscenario
More help   : https://help.launchpad.net/ListHelp

Reply via email to