changes in project.py and project_view.xml
bzr revid: solanki.priyesh@gmail.com-20080912054231-xrso21mkmyyd8hfv
This commit is contained in:
parent
d683c8d025
commit
c22ef987b5
|
@ -66,7 +66,7 @@ def emp_create_xml(self,cr,uid,dept,holiday_type,row_id,empid,name,som,eom):
|
|||
return xml
|
||||
|
||||
class report_custom(report_rml):
|
||||
def create_xml(self, cr, uid, ids,data, context):
|
||||
def create_xml(self, cr, uid, ids, data, context):
|
||||
depts=[]
|
||||
emp_id={}
|
||||
done={}
|
||||
|
@ -86,7 +86,6 @@ class report_custom(report_rml):
|
|||
|
||||
som = strToDate(first_date)
|
||||
eom = som+datetime.timedelta(59)
|
||||
|
||||
day_diff=eom-som
|
||||
|
||||
if data['form']['holiday_type']!='both':
|
||||
|
|
|
@ -11,3 +11,4 @@
|
|||
|
||||
</data>
|
||||
</openerp>
|
||||
<!-- -->
|
|
@ -150,31 +150,36 @@ class project(osv.osv):
|
|||
|
||||
# toggle activity of projects, their sub projects and their tasks
|
||||
def settemplate(self, cr, uid, ids, context={}):
|
||||
b_obj = self.browse(cr, uid, ids)[0]
|
||||
task_data = self.pool.get('project.task').search(cr, uid, [('project_id','in',ids)])
|
||||
for id in task_data:
|
||||
self.pool.get('project.task').write(cr, uid, id, {'active':False})
|
||||
return self.write(cr, uid, ids, {'state':'template'})
|
||||
|
||||
res = self.setActive(cr, uid, ids, value=False, context=context)
|
||||
return res
|
||||
|
||||
def resetproject(self, cr, uid, ids, context={}):
|
||||
cr.execute('select id from project_task where project_id in ('+','.join(map(str, ids))+')')
|
||||
for id in cr.fetchall():
|
||||
self.pool.get('project.task').write(cr, uid, id[0], {'active':True})
|
||||
return self.write(cr, uid, ids, {'state':'open'})
|
||||
res = self.setActive(cr, uid, ids,value=True, context=context)
|
||||
return res
|
||||
|
||||
def duplicatetemplate(self, cr, uid, ids, context={}):
|
||||
return self.pool.get('project.project').copy(cr, uid, ids[0], context=context)
|
||||
proj = self.browse(cr, uid, ids[0], context)
|
||||
self.pool.get('project.project').copy(cr, uid, ids[0],default={'state':'template'}, context=context)
|
||||
cr.execute('select id from project_task where project_id=%d', (proj.id,))
|
||||
res = cr.fetchall()
|
||||
tasks_ids = [x[0] for x in res]
|
||||
if tasks_ids:
|
||||
for i in tasks_ids:
|
||||
self.pool.get('project.task').copy(cr, uid, i,default={'active':False}, context=context)
|
||||
project_ids = [x[0] for x in res]
|
||||
return True
|
||||
|
||||
# set active value for a project, its sub projects and its tasks
|
||||
def setActive(self, cr, uid, id, value, context={}):
|
||||
proj = self.browse(cr, uid, id, context)
|
||||
self.write(cr, uid, [id], {'active': value}, context)
|
||||
cr.execute('select id from project_task where project_id=%d', (proj.id,))
|
||||
tasks_id = [x[0] for x in cr.fetchall()]
|
||||
self.pool.get('project.task').write(cr, uid, tasks_id, {'active': value}, context)
|
||||
project_ids = [x[0] for x in cr.fetchall()]
|
||||
for child in project_ids:
|
||||
self.setActive(cr, uid, child, value, context)
|
||||
def setActive(self, cr, uid, ids, value=True, context={}):
|
||||
|
||||
for proj in self.browse(cr, uid, ids, context):
|
||||
self.write(cr, uid, [proj.id], {'state': value and 'open' or 'template'}, context)
|
||||
cr.execute('select id from project_task where project_id=%d', (proj.id,))
|
||||
res = cr.fetchall()
|
||||
tasks_id = [x[0] for x in res]
|
||||
if tasks_id:
|
||||
self.pool.get('project.task').write(cr, uid, tasks_id, {'active': value}, context)
|
||||
project_ids = [x[0] for x in res]
|
||||
return True
|
||||
project()
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
<field colspan="4" name="members" nolabel="1"/>
|
||||
<group col="6" colspan="8">
|
||||
<field name="state"/>
|
||||
<button name="settemplate" string="set as template" type="object" states="open"/>
|
||||
<button name="resetproject" string="reset as project" type="object" states="template"/>
|
||||
<button name="duplicatetemplate" string="duplicate template" type="object" states="template"/>
|
||||
<button name="settemplate" string="Set as Template" type="object" states="open"/>
|
||||
<button name="resetproject" string="Reset as Project" type="object" states="template"/>
|
||||
<button name="duplicatetemplate" string="Duplicate Template" type="object" states="template"/>
|
||||
</group>
|
||||
</page>
|
||||
<page groups="base.group_extended" string="Partner Info">
|
||||
|
|
Loading…
Reference in New Issue