← Back to team overview

openerp-india team mailing list archive

[Bug 942699] Re: Unable to set a new default name for product.product via copy() call

 

Hello Niels Huylebroeck,

In trunk copy method of product.product  pass the default = None and
also check :

 if not default:
            default = {}

It's not logically correct to pass name in default and in your logical
view after all you assign the product['name'].

Would you please elaborate more what you exactly want to do ?  with
related use case.

Thanks and waiting for your reply.


** Changed in: openobject-addons
       Status: New => Incomplete

-- 
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/942699

Title:
  Unable to set a new default name for product.product via copy() call

Status in OpenERP Addons (modules):
  Incomplete

Bug description:
  Due to how  the code is written in product.product method copy[1] we
  cannot call copy method with default['name'] = 'My New product name'
  because the value in default['name'] is unconditionally overwritten
  with the product name + '(copy)'.

  A workaround is to do copy() and then a write to update the name to
  the calculated name.

  However I would find it a lot more logical if you would just do a
  simple test like:

  if 'name' not in default or default['name'] == product['name']:
      default['name'] = product['name'] + _(' (copy)')

  Which would then enable people to properly copy products and replace the name at the same time.
  I checked also the trunk version (r6646) and it seems the same issue is still there[2] as well as on the 6.1 r6637 [3]

  [1] http://bazaar.launchpad.net/~openerp/openobject-addons/6.0/view/head:/product/product.py#L617
  [2] http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/product/product.py#L660
  [3] http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/product/product.py#L673

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/942699/+subscriptions


References