This question has been flagged
1 Reply
4605 Views

I'm working on an import engine from my old ERP to Odoo. I see that (as for every model) there's a name field for project.project (I see this by viewing the Project edit page in developer mode, and placing my cursor over the Project Name field). Here's what shows:

Field: name
Object: project.project
Type: char
Modifiers: {"required": true}

However when I open the project.project table in pgAdmin there's no name column. 

I also linked to the same database tables through Access and encountered the same issue.

Can anyone help me out with this, why don't I see the name field?

Avatar
Discard
Best Answer

Hi Michael,

in v8 project,project is inheriting  from account.analytic.account all its fields. You can see it by "_inherits = {'account.analytic.account': "analytic_account_id" }" . The inheritance mechanism that is used there is called delegation inheritance. You can read about that in https://www.odoo.com/documentation/8.0/reference/orm.html under point: "Inheritance and extension".


So when you see the box that shows "Field: name, Object: project.project" then in reality that field is from account.analytic.account. You can look up the name in pgadmin by first checking the id of field analytic_account_id in project.project. By this id you can look up the account,analytic.account record.
In the end, the name field is defined in: addons/analytic/analytic.py  at line 175 with: "'name': fields.char('Account/Contract Name', required=True, track_visibility='onchange').

You may ask yourself, why in project view, you see "Project Name" and not Account/Contract Name. This is because in the view definition of project.project, the string is separately set by:
<field name="name" string="Project Name"/>

Avatar
Discard
Author

Excellent Gregor, Thank you so much! I see exactly what you're describing now. Glad you knew this, it doesn't seem that obvious. Much appreciated - Thanks again!