copy product needs to add "(copy)" to the product name/variant

Bug #410164 reported by Ferdinand
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Wishlist
Unassigned

Bug Description

the copy process should add "(copy)" to the product name ot variant name

the message "working now on the duplicate document" is only temporary
it the user does not alter the name immediately and closes the tab it's difficult to find out which one is the copy

Revision history for this message
Ferdinand (office-chricar) wrote :

=== modified file 'product/product.py'
--- product/product.py 2009-08-07 07:26:47 +0000
+++ product/product.py 2009-08-07 11:31:40 +0000
@@ -633,6 +633,11 @@
     def copy(self, cr, uid, id, default=None, context=None):
         if not context:
             context={}
+ product = self.browse(cr, uid, id, context=context)
+ if not default:
+ default = {}
+ default = default.copy()
+ default['name'] = (product['name'] or '') + ' (copy)'

         if ('variant' in context) and context['variant']:
             fields = ['product_tmpl_id', 'active', 'variants', 'default_code',

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Corrected by revision 2314 <email address hidden>.

Thanks.

Changed in openobject-addons:
importance: Undecided → Wishlist
status: New → Fix Released
Revision history for this message
Niels Huylebroeck (red15) wrote :

What is the point of

if not default:
        default = {}
        default = default.copy()

A copy of an empty dictionary ?

Revision history for this message
gpa(OpenERP) (gpa-openerp) wrote :

Hello Red 15,

default = default.copy()
if not default:
        default = {}

Is this code preferable?

Thanks for reporting

Changed in openobject-addons:
status: Fix Released → Incomplete
Revision history for this message
Niels Huylebroeck (red15) wrote :

It's just I hate to see something so glaringly wrong going into trunk and possibly stable later.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Red15,

Corrections made in revision 2317 <email address hidden>.

Here, translation is also taken into consideration.

Thank you for pointing.

Changed in openobject-addons:
status: Incomplete → Fix Released
Revision history for this message
Niels Huylebroeck (red15) wrote :

Instead of doing this only on the product level, wouldn't it be advisable to do this in orm itself ?

This way other modules made by other people would also not suffer from this temporary indicator problem.

Revision history for this message
Ferdinand (office-chricar) wrote :
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Yes, Its acceptable.

But, its not necessary that every object uses the copy() of its super.
It is possible that any object uses copy() by its own.

Anyways, we have taken the suggestion into consideration.

Many thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.