[IMP]:renamed category_id to analytic_account_id in project and project_* modules
bzr revid: pap@tinyerp.co.in-20100715073517-je8i2a0dkht2z45k
This commit is contained in:
@@ -44,15 +44,15 @@ project_task_type()
|
||||
class project(osv.osv):
|
||||
_name = "project.project"
|
||||
_description = "Project"
|
||||
_inherits = {'account.analytic.account':"category_id"}
|
||||
_inherits = {'account.analytic.account':"analytic_account_id"}
|
||||
|
||||
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
if user == 1:
|
||||
return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
|
||||
if context and context.has_key('user_prefence') and context['user_prefence']:
|
||||
cr.execute("""SELECT project.id FROM project_project project
|
||||
LEFT JOIN account_analytic_account account ON account.id = project.category_id
|
||||
LEFT JOIN project_user_rel rel ON rel.project_id = project.category_id
|
||||
LEFT JOIN account_analytic_account account ON account.id = project.analytic_account_id
|
||||
LEFT JOIN project_user_rel rel ON rel.project_id = project.analytic_account_id
|
||||
WHERE (account.user_id = %s or rel.uid = %s)"""%(user, user))
|
||||
res = cr.fetchall()
|
||||
return [(r[0]) for r in res]
|
||||
@@ -121,7 +121,7 @@ class project(osv.osv):
|
||||
'complete_name': fields.function(_complete_name, method=True, string="Project Name", type='char', size=250),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the project without removing it."),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of Projects."),
|
||||
'category_id': fields.many2one('account.analytic.account', 'Analytic Account', 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."),
|
||||
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', 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."),
|
||||
'priority': fields.integer('Sequence', help="Gives the sequence order when displaying a list of task"),
|
||||
'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team."),
|
||||
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose."),
|
||||
@@ -250,8 +250,8 @@ class project(osv.osv):
|
||||
result.append(new_id)
|
||||
cr.execute('select id from project_task where project_id=%s', (proj.id,))
|
||||
res = cr.fetchall()
|
||||
child_ids = self.search(cr, uid, [('parent_id','=', proj.category_id.id)], context=context)
|
||||
parent_id = self.read(cr, uid, new_id, ['category_id'])['category_id'][0]
|
||||
child_ids = self.search(cr, uid, [('parent_id','=', proj.analytic_account_id.id)], context=context)
|
||||
parent_id = self.read(cr, uid, new_id, ['analytic_account_id'])['analytic_account_id'][0]
|
||||
if child_ids:
|
||||
self.duplicate_template(cr, uid, child_ids, context={'parent_id': parent_id})
|
||||
|
||||
@@ -376,7 +376,7 @@ class task(osv.osv):
|
||||
'delegated_user_id': fields.related('child_ids', 'user_id', type='many2one', relation='res.users', string='Delegated To'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'),
|
||||
'manager_id': fields.related('project_id', 'category_id', 'user_id', type='many2one', relation='res.users', string='Project Manager'),
|
||||
'manager_id': fields.related('project_id', 'analytic_account_id', 'user_id', type='many2one', relation='res.users', string='Project Manager'),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ class project_vs_hours(osv.osv):
|
||||
FROM project_project as pp,
|
||||
account_analytic_account as aaa,
|
||||
project_task as pt
|
||||
WHERE aaa.id=pp.category_id and pt.project_id=pp.id and pp.category_id=aaa.id
|
||||
WHERE aaa.id=pp.analytic_account_id and pt.project_id=pp.id and pp.analytic_account_id=aaa.id
|
||||
GROUP BY aaa.user_id,aaa.state,aaa.name
|
||||
UNION All
|
||||
SELECT
|
||||
@@ -165,7 +165,7 @@ class project_vs_hours(osv.osv):
|
||||
project_user_rel as pur,
|
||||
account_analytic_account as aaa,
|
||||
project_task as pt
|
||||
WHERE pur.project_id=pp.id and pt.project_id=pp.id and pp.category_id=aaa.id AND pur.uid != aaa.user_id
|
||||
WHERE pur.project_id=pp.id and pt.project_id=pp.id and pp.analytic_account_id=aaa.id AND pur.uid != aaa.user_id
|
||||
GROUP BY pur.uid,aaa.state,aaa.name
|
||||
)
|
||||
""")
|
||||
|
||||
@@ -27,7 +27,7 @@ class project_issue(osv.osv):
|
||||
_description = 'project issue'
|
||||
_columns = {
|
||||
'timesheet_ids': fields.one2many('hr.analytic.timesheet', 'issue_id', 'Timesheets'),
|
||||
'analytic_account_id': fields.related('project_id', 'category_id', string='Analytic Account')
|
||||
'analytic_account_id': fields.related('project_id', 'analytic_account_id', string='Analytic Account')
|
||||
}
|
||||
|
||||
project_issue()
|
||||
@@ -48,15 +48,6 @@ class hr_analytic_issue(osv.osv):
|
||||
_columns = {
|
||||
'issue_id' : fields.many2one('project.issue', 'Issue'),
|
||||
}
|
||||
|
||||
def _get_analytic_account(self, cr, uid, context={}):
|
||||
if context.get('account_id', False):
|
||||
return context.get('account_id')
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'account_id' : _get_analytic_account,
|
||||
}
|
||||
|
||||
hr_analytic_issue()
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<notebook colspan="4">
|
||||
<page string="Worklogs">
|
||||
<field name="analytic_account_id" invisible="1"/>
|
||||
<field name="timesheet_ids" colspan="4" nolabel="1" default_get="{'account_id':project_id}" context="{'default_user_id' : user_id, 'default_account_id' : analytic_account_id}">
|
||||
<field name="timesheet_ids" colspan="4" nolabel="1" context="{'default_user_id' : user_id, 'default_account_id' : analytic_account_id}">
|
||||
<tree editable="top" string="Timesheet">
|
||||
<field name="name"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" widget="float_time"/>
|
||||
|
||||
@@ -529,7 +529,7 @@ WHERE user_id=%s and account_id=%s and date>=%s and date<=%s''', (line.user_id.i
|
||||
project_task
|
||||
WHERE
|
||||
''' + where + '''
|
||||
project_id IN (select id from project_project where category_id=%s) AND
|
||||
project_id IN (select id from project_project where analytic_account_id=%s) AND
|
||||
date_end>=%s AND
|
||||
date_end<=%s''', (
|
||||
line.account_id.id,
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<form string="Tasks">
|
||||
<group colspan="4" col="2">
|
||||
<field name="name" select="1"/>
|
||||
<field name="project_id" required="1" select="1" domain="[('category_id','=',parent.account_id)]"/>
|
||||
<field name="project_id" required="1" select="1" domain="[('analytic_account_id','=',parent.account_id)]"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<field name="date_deadline"/>
|
||||
|
||||
@@ -69,7 +69,7 @@ class project_work(osv.osv):
|
||||
vals_line['product_id'] = result['product_id']
|
||||
vals_line['date'] = vals['date'][:10]
|
||||
vals_line['unit_amount'] = vals['hours']
|
||||
acc_id = obj_task.project_id.category_id.id
|
||||
acc_id = obj_task.project_id.analytic_account_id.id
|
||||
vals_line['account_id'] = acc_id
|
||||
res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id)
|
||||
if res.get('value'):
|
||||
@@ -165,7 +165,7 @@ class task(osv.osv):
|
||||
task_obj_l = self.browse(cr, uid, ids, context)
|
||||
if (vals.has_key('project_id') and vals['project_id']):
|
||||
project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id'])
|
||||
acc_id = project_obj.category_id.id
|
||||
acc_id = project_obj.analytic_account_id.id
|
||||
|
||||
for task_obj in task_obj_l:
|
||||
if len(task_obj.work_ids):
|
||||
@@ -188,7 +188,7 @@ class project_project(osv.osv):
|
||||
context = {}
|
||||
result = []
|
||||
for project in self.browse(cr, user, ids, context):
|
||||
name = "[%s] %s" % (project.category_id and project.category_id.code or '?', project.name)
|
||||
name = "[%s] %s" % (project.analytic_account_id and project.analytic_account_id.code or '?', project.name)
|
||||
result.append((project.id, name))
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user