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 can add an existing field from a module to an other module?

By
nasim
on 8/3/15, 6:14 AM 239 views


how can add an existing field from a module to an other module?

for example I want to add "department_id" field (from hr module) to Asset form from accounting module(account_asset module)?

I think :

1. add this field in account_asset.py with this format:

'department_id': fields.many2one('hr.department', 'Department'),

2.add this field in postgresql with this format:

ALTER TABLE account_asset ALTER COLUMN department_id integer; ##I dont know what type should be use? (integer!!!)

but I have an error:

ERROR: relation "account_asset" does not exist

restart server

3.add this filed in interface from "manage view"

and after restart server, I have an error:

ProgrammingError: column account_asset_asset.department_id does not exist

please help

Thanks

have you added module dependency in __openerp__.py file?

Solanki Shamji
on 8/3/15, 6:35 AM
0
Virali
On 8/3/15, 6:44 AM

Hii,

Yes this field is store id so it is INTEGER.

you need to put hr module in __openerp__.py file in dependancy of your module account_asset.

in postgresql if you are using ubantu then

--> go inside your database

--> then \d  account_asset(your model name)

--> then you can see department id type as integer.

Hope this will help you if this will not display then let me know.




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: 8/3/15, 6:14 AM
Seen: 239 times
Last updated: 8/3/15, 6:45 AM