I want to link department (hr.department) to analytic account (account.analytic.account)
example dept d1 -> a1 and if user from d1 create invoice i auto select a1 as analytic account
and here is my code
class hr_department(osv.osv):
_inherit = "hr.department"
_name = "hr.department"
_columns = {
'analytic_account_id': fields.many2one('account.analytic.account', 'Contract/Analytic', ondelete="restrict", required=True),
}
but what i see the in project:
class project(osv.osv):
_name = "project.project"
_description = "Project"
_inherits = {'account.analytic.account': "analytic_account_id",....}
......
_columns = {
...
'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),
...
}
what is the difference ? why not just many2one? i think using many2one i always can access data from related object or i do not understand something? need i use _inherits = {'account.analytic.account': "analytic_account_id",....} in my case or it is enough just many2one to account.analytic.account ?