Is there a way of removing the internal reference shown in product descriptions? So just to display product name and not the internal reference?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
Chirag,
Technically, its name_get() method you have to override().
Thanks.
@api.multi
@api.onchange('product_id')
def product_id_change(self):
if not self.product_id:
return {'domain': {'product_uom': []}}
vals = {}
domain = {'product_uom': [('category_id', '=', self.product_id.uom_id.category_id.id)]}
if not self.product_uom or (self.product_id.uom_id.category_id.id != self.product_uom.category_id.id):
vals['product_uom'] = self.product_id.uom_id
product = self.product_id.with_context(
lang=self.order_id.partner_id.lang,
partner=self.order_id.partner_id.id,
quantity=self.product_uom_qty,
date=self.order_id.date_order,
pricelist=self.order_id.pricelist_id.id,
uom=self.product_uom.id
)
name = product.name
if product.description_sale:
name += '\n' + product.description_sale
vals['name'] = name
self._compute_tax_id()
if self.order_id.pricelist_id and self.order_id.partner_id:
vals['price_unit'] = self.env['account.tax']._fix_tax_included_price(product.price, product.taxes_id, self.tax_id)
self.update(vals)
return {'domain': domain}
Did you want to remove the internal reference shown in individual product descriptions? If so it is the "Internal Reference" box shown below. Highlight text > Delete > Save.
If you want to remove the actual field then sorry, I dont know.
Dear Chirag,
Yes, @Serpent Consulting Services is right you need to override the name_get method like this
class product_product(osv.Model):
_inherit = 'product.product'
def name_get(self, cr, uid, ids, context={}):
res = []
if context is None:
context = {}
if isinstance(ids, (int, long)):
ids = [ids]
if not len(ids):
return []
for product in self.browse(cr, uid, ids,context=context):
res.append((product.id, product.name))
return res
Hope this code may be help full
Regards,
Ankit H Gandhi
How do I go about doing that?
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up