Odoo Help


Analytic account creating

on 9/16/15, 1:52 PM 1,246 views

Hi everybody, i am trying to have a specific behavior in odoo v8. I would like to create an analytic account automaticaly when i am creating an employee. This analytic account should have the same name that employee's.

Axel Mendoza
On 9/16/15, 2:00 PM

Just put hr.employee model to inherits from account.analytic.account like project.project does

On 9/17/15, 12:20 PM

Hi alex,

i did it like you said but i get error. That what i do :

class hr_employee(osv.osv):
_name = "hr.employee"
_inherit = ['hr.employee']
_description = "Employee"
_inherits = {'account.analytic.account': "analytic_account_id"}
_columns = {
'date_start': fields.date('Date Embauche'),
'diplome': fields.many2one('diplome', 'Diplome'),

the error i get is this :

Integrity Error

The operation cannot be completed, probably due to the following:

- deletion: you may be trying to delete a record while other records still reference it

- creation/update: a mandatory field is not correctly set

[object with reference: name - name]

thanks in advance.

You need to put the field analytic_account_id in your column, like: 'analytic_account_id': fields.many2one( 'account.analytic.account', 'Contract/Analytic', help="Link this project to an analytic account if you need financial management on projects. " "It enables you to connect projects with budgets, planning, cost and revenue analysis, timesheets on projects, etc.", ondelete="cascade", required=True, auto_join=True),

Axel Mendoza
on 9/18/15, 2:05 AM

copied from project.project definition

Axel Mendoza
on 9/18/15, 2:05 AM

Axel i copy the code in project.py file. So i create the account.analytic.account field but i still yhe same error.

on 9/18/15, 10:51 AM

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/16/15, 1:52 PM
Seen: 1246 times
Last updated: 9/17/15, 12:20 PM