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 remove certain columns from an inherited model?

By
Marie Pinto
on 9/16/15, 12:59 PM 1,178 views

I'm trying to create a model named 'mantenimiento' based on project.task, but want to omit one or two columns from it.

I have this so far:

 _name = "project.mantenimientos" 
_description = "Mantenimientos"
_inherit = 'project.task'

How could I do it?

Thanks.

2

Axel Mendoza

--Axel Mendoza--
10318
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 9/16/15, 1:40 PM

You need to define those fields as function fields in your model to don't get created in your table.

2

Anil R. Kesariya

--Anil R. Kesariya--
4321
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
On 9/17/15, 2:35 AM

Hi Marie Pinto,

There are two possiblities to remove columns.

1) Easier way: Either inherit view and just invisible those columns which you don't want to show to user.

2) little tricky: override def init(self, cr): method of this model and execute query to drop columns by altering table as suggest by vivek.

  Risk factor in second step : If your are altering the table and removing any columns from table make sure those fields are not used in any views you have to remove it from there. if those fields are used in any base module view you have to replace it by inheriting views.

Hope this would clear more idea.

Regards,

Anil.




1
Vivek
On 9/16/15, 1:58 PM

There is not any way for delete columns using _inherit. You need to remove column from database(postgres) using alter table.

You need to execute query for drop column like : alter table project_mantenimientos drop column specific_column.

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: 9/16/15, 12:59 PM
Seen: 1178 times
Last updated: 9/18/15, 2:08 AM