[IMP] product: remove unused field name_template
The field `name_template` is removed. There is no real use of this field in the Community or Enterprise versions. Moreover, an issue occurs with it: it takes the value of product template name, whatever the language of the user updating the record. In other words, if a user changes the name of the product template in order to define a translation, this translation will be used in `name_template`. This could be solved by patching the ORM (http://pastesha.re/ihRc), but patching the ORM for a single field with no real use is not worth the risk. opw-678143
This commit is contained in:
@@ -789,7 +789,7 @@ class product_product(osv.osv):
|
||||
_description = "Product"
|
||||
_inherits = {'product.template': 'product_tmpl_id'}
|
||||
_inherit = ['mail.thread']
|
||||
_order = 'default_code,name_template'
|
||||
_order = 'default_code'
|
||||
|
||||
def _product_price(self, cr, uid, ids, name, arg, context=None):
|
||||
plobj = self.pool.get('product.pricelist')
|
||||
@@ -893,10 +893,6 @@ class product_product(osv.osv):
|
||||
def _is_product_variant_impl(self, cr, uid, ids, name, arg, context=None):
|
||||
return dict.fromkeys(ids, True)
|
||||
|
||||
def _get_name_template_ids(self, cr, uid, ids, context=None):
|
||||
template_ids = self.pool.get('product.product').search(cr, uid, [('product_tmpl_id', 'in', ids)])
|
||||
return list(set(template_ids))
|
||||
|
||||
def _get_image_variant(self, cr, uid, ids, name, args, context=None):
|
||||
result = dict.fromkeys(ids, False)
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
@@ -971,10 +967,6 @@ class product_product(osv.osv):
|
||||
'active': fields.boolean('Active', help="If unchecked, it will allow you to hide the product without removing it."),
|
||||
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade", select=True, auto_join=True),
|
||||
'barcode': fields.char('Barcode', help="International Article Number used for product identification.", oldname='ean13', copy=False),
|
||||
'name_template': fields.related('product_tmpl_id', 'name', string="Template Name", type='char', store={
|
||||
'product.template': (_get_name_template_ids, ['name'], 10),
|
||||
'product.product': (lambda self, cr, uid, ids, c=None: ids, [], 10),
|
||||
}, select=True),
|
||||
'attribute_value_ids': fields.many2many('product.attribute.value', id1='prod_id', id2='att_id', string='Attributes', ondelete='restrict'),
|
||||
'is_product_variant': fields.function( _is_product_variant_impl, type='boolean', string='Is a product variant'),
|
||||
# image: all image fields are base64 encoded and PIL-supported
|
||||
|
||||
Reference in New Issue
Block a user