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.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Just put hr.employee model to inherits from account.analytic.account like project.project does
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'),
}
hr_employee()
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),
copied from project.project definition
Axel i copy the code in project.py file. So i create the account.analytic.account field but i still yhe same error.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up