Odoo Help

0
1 Answer
2
Avatar
--Sushma--

Techno-Functional Associate with 4+ years of experience in Odoo (formerly known as OpenERP).

Sushma
7/18/18, 5:20 AM

Hi Ganshyam,

You can call 'ir.model.fields' create mandatory values: {'name':'fieldname','field_description':'feild label','ttype':'boolean','model_id':model_id, 'state':'base'}

Other properties like readonly, required etc. you add in this dictionary.

Make sure you should pass state = 'base', by default it is manual that could be consider as custom field and can easily delete from odoo admin, but for base you can't delete from odoo admin, for custom fields you need to add prefix 'x_' to every field name.

If you're trying though python script you can refer https://www.odoo.com/documentation/10.0/reference/orm.html


4 Comments
ghanshyam
7/21/18, 3:07 AM

Your answer is work for me and custom fields added in ir.model.filed, but i as well as i want to add in particular model too like res.partner(Contats).

Sushma
7/25/18, 6:41 AM

Indeed you need to find out res.partner model.id pass in create dictionary. Thanks !

ghanshyam
7/25/18, 6:45 AM

It's solved now i want to add those created custom field to view like (res.partner.form)

so we can see those custom field in a form , have u any idea about that please know me.

Sushma
7/25/18, 9:23 AM

write some script to update existing ones, first reset there state = base, and remove prefix "x_" update with new field, but I'm not sure about how to deal with data already exist for such fields

Ask a Question
Writer
Keep Informed
1 follower(s)
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