Odoo Help


Analytic account creating

on 9/16/15, 1:52 PM 857 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

--Axel Mendoza--
| 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, 2:00 PM

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



| 5 2 7
Lomé, Togo


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

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 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: 857 times
Last updated: 9/17/15, 12:20 PM