What about using copy_data?
On Wed, Feb 29, 2012 at 4:59 AM, Niels Huylebroeck < <email address hidden>> wrote:
> Public bug reported: > > 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 > > ** Affects: openobject-addons > Importance: Undecided > Status: New > > -- > You received this bug notification because you are 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): > New > > 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 >
What about using copy_data?
On Wed, Feb 29, 2012 at 4:59 AM, Niels Huylebroeck <
<email address hidden>> wrote:
> Public bug reported: bazaar. launchpad. net/~openerp/ openobject- addons/ 6.0/view/ head:/product/ product. py#L617 bazaar. launchpad. net/~openerp/ openobject- addons/ trunk/view/ head:/product/ product. py#L660 bazaar. launchpad. net/~openerp/ openobject- addons/ 6.1/view/ head:/product/ product. py#L673 /bugs.launchpad .net/bugs/ 942699 bazaar. launchpad. net/~openerp/ openobject- addons/ 6.0/view/ head:/product/ product. py#L617 bazaar. launchpad. net/~openerp/ openobject- addons/ trunk/view/ head:/product/ product. py#L660 bazaar. launchpad. net/~openerp/ openobject- addons/ 6.1/view/ head:/product/ product. py#L673 /bugs.launchpad .net/openobject -addons/ +bug/942699/ +subscriptions
>
> 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://
> [2]
> http://
> [3]
> http://
>
> ** Affects: openobject-addons
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are subscribed to OpenERP
> Addons.
> https:/
>
> Title:
> Unable to set a new default name for product.product via copy() call
>
> Status in OpenERP Addons (modules):
> New
>
> 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://
> [2]
> http://
> [3]
> http://
>
> To manage notifications about this bug go to:
> https:/
>