Odoo Help

0

How to remove internal reference from product description

By
Chirag
on 7/7/15, 3:34 PM 1,392 views

Is there a way of removing the internal reference shown in product descriptions? So just to display product name and not the internal reference?

1

Chirag,

Technically, its name_get() method you have to override().

Thanks.

0
savita
On 7/13/17, 6:59 AM

@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}


0
Geoff Kimpton
On 9/11/15, 10:59 AM

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.


0
Ankit H Gandhi(AHG)
On 7/26/15, 7:25 AM

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

0
Chirag
On 7/8/15, 5:08 PM

How do I go about doing that?

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/7/15, 3:34 PM
Seen: 1392 times
Last updated: 7/13/17, 6:59 AM