Odoo Help

Welcome!

This community 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.

0

How to avoid the « internal code » at the beginning of the field name in those models?

By
Pascal Tremblay
on 4/18/15, 7:19 PM 593 views

Hello all,

In these 3 tables, we have a column « name » :

  • purchase_order_line

  • sale_order_line

  • account_invoice_line

we don't want the internal code at the beginning of the field « name ».

For example, in this field, instead of « [g-cafe] Grand café », we just want « Grand café ».

Thanks to help!

2
Jordi Ballester Alomar
On 4/19/15, 12:03 AM

Hello Pascal,

You must be referring to this issue on a particular field, such as the product, right?

By default on each model the name shown in the lists corresponds to the field 'name' in that model.

However there's the option to override this behaviour, in order to customize the name shown, by means of implementing method 'name_get' in a particular model.

In case of the model 'product', that is used in 'purchase.order.line', 'sale.order.line', '.account.invoice.line', the this method, as seen in the module 'product' and file 'product.py' does this concatenation:

name = '[%s] %s' % (code,name)

In order to avoid this you should create a new custom model, inherit from 'product' and redefine this method to suit your needs.

Regards,

Jordi Ballester

Eficent.


Thanks 100 times!

Pascal Tremblay
on 4/19/15, 8:22 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/18/15, 7:19 PM
Seen: 593 times
Last updated: 4/19/15, 8:22 AM