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.

1

How to change the length of a custom field in Odoo 7?

By
Massinissa Belkassam
on 10/15/15, 3:28 AM 753 views

I have a custom field (on a view based on the object res.partner). It's not possible to edit the field size in Settings > Technical > Database Structure > Fields. I would like to change the length of this field. How can do it? Where can I find the related python script on my server?

0
Maurice Agée
On 10/15/15, 4:01 AM

You can change the size of the char field in the XML-file :

<field name="my_field" style="font-size:13pt;"/>

The Temur's answer is for the number of characters.

0

Temur

--Temur--
2896
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 10/15/15, 3:49 AM

field definitions are incremental. it means if you know what is the model this field belongs to, then you can inherit this model in your python code, add field with the same name and in field definition use the only attribute, the size. this way size will be changed, whereas all other properties will be preserved. say it's a Char field named "ex_field", then:

class my_model(models.Model):
    _inherit="parent.model"

    ex_field = fields.Char(size=256)

as noted above, ex_field is field you need to change size for.

I do not noticed v7 tag... but (size=NewSize) part should be same for openerp7 as well, just adapt the rest...

Temur
on 10/15/15, 3:50 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

2 follower(s)

Stats

Asked: 10/15/15, 3:28 AM
Seen: 753 times
Last updated: 2/19/16, 1:50 AM