openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #02123
[Merge] lp:~openerp-dev/openobject-addons/jam-dev-addons into lp:~openerp-dev/openobject-addons/trunk-dev-addons1
jam-openerp has proposed merging lp:~openerp-dev/openobject-addons/jam-dev-addons into lp:~openerp-dev/openobject-addons/trunk-dev-addons1.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
#695038 OpenOfficeReportDesigner Group to Remove in Trunk
https://bugs.launchpad.net/bugs/695038
#695596 Audit trail module does not creating an audit log for users.
https://bugs.launchpad.net/bugs/695596
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/jam-dev-addons/+merge/45682
Hello,
Merge proposal Changes:
+ Thunderbird ui changes for windows.
Kindly Review them.
Thank you
--
https://code.launchpad.net/~openerp-dev/openobject-addons/jam-dev-addons/+merge/45682
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/jam-dev-addons.
=== modified file 'project_long_term/project_long_term.py'
--- project_long_term/project_long_term.py 2010-12-31 11:57:54 +0000
+++ project_long_term/project_long_term.py 2011-01-10 12:52:01 +0000
@@ -23,8 +23,11 @@
from dateutil.relativedelta import relativedelta
from tools.translate import _
from osv import fields, osv
-from resource.faces import task as Task
+from resource.faces import task as Task
import operator
+from new import classobj
+import types
+import new
class project_phase(osv.osv):
_name = "project.phase"
@@ -216,22 +219,59 @@
"""
Return a list of Resource Class objects for the resources allocated to the phase.
"""
+
res = {}
resource_pool = self.pool.get('resource.resource')
for phase in self.browse(cr, uid, ids, context=context):
- user_ids = map(lambda x:x.resource_id.user_id.id, phase.resource_ids)
- project = phase.project_id
- calendar_id = project.resource_calendar_id and project.resource_calendar_id.id or False
- resource_objs = resource_pool.generate_resources(cr, uid, user_ids, calendar_id, context=context)
+ resource_objs = map(lambda x:x.resource_id.name, phase.resource_ids)
res[phase.id] = resource_objs
return res
- def generate_schedule(self, cr, uid, ids, start_date=False, calendar_id=False, context=None):
+ def generate_phase(self, cr, uid, ids, f, parent=False, context=None):
+ if context is None:
+ context = {}
+ phase_ids = []
+ resource_pool = self.pool.get('resource.resource')
+ data_pool = self.pool.get('ir.model.data')
+ resource_allocation_pool = self.pool.get('project.resource.allocation')
+ uom_pool = self.pool.get('product.uom')
+ data_model, day_uom_id = data_pool.get_object_reference(cr, uid, 'product', 'uom_day')
+ for phase in self.browse(cr, uid, ids, context=context)[::-1]:
+ avg_days = uom_pool._compute_qty(cr, uid, phase.product_uom.id, phase.duration, day_uom_id)
+ duration = str(avg_days) + 'd'
+ # Create a new project for each phase
+ str_resource = ('%s,'*len(phase.resource_ids))[:-1]
+ str_vals = str_resource % tuple(map(lambda x: 'Resource_%s'%x.resource_id.id, phase.resource_ids))
+ # Phases Defination for the Project
+ s = '''
+ def Phase_%s():
+ effort = \'%s\'
+ resource = %s
+'''%(phase.id, duration, str_vals or False)
+ if parent:
+ start = 'up.Phase_%s.end' % (parent.id)
+ s += '''
+ start = %s
+'''%(start)
+ f += s + '\n'
+ phase_ids.append(phase.id)
+ # Recursive call till all the next phases scheduled
+ for next_phase in phase.next_phase_ids:
+ if next_phase.state in ['draft', 'open', 'pending']:
+ rf, rphase_ids = self.generate_phase(cr, uid, [next_phase.id], f = '', parent=phase, context=context)
+ f += rf +'\n'
+ phase_ids += rphase_ids
+ else:
+ continue
+ return f, phase_ids
+
+ def generate_schedule(self, cr, uid, root_phase, start_date=False, calendar_id=False, context=None):
"""
Schedule phase with the start date till all the next phases are completed.
@param: start_date (datetime.datetime) : start date for the phase. It would be either Start date of phase or start date of project or system current date
@param: calendar_id : working calendar of the project
"""
+ func_str = ''
if context is None:
context = {}
resource_pool = self.pool.get('resource.resource')
@@ -239,71 +279,102 @@
resource_allocation_pool = self.pool.get('project.resource.allocation')
uom_pool = self.pool.get('product.uom')
data_model, day_uom_id = data_pool.get_object_reference(cr, uid, 'product', 'uom_day')
- for phase in self.browse(cr, uid, ids, context=context):
- if not phase.responsible_id:
- raise osv.except_osv(_('No responsible person assigned !'),_("You must assign a responsible person for phase '%s' !") % (phase.name,))
-
- if not start_date:
- start_date = phase.project_id.date_start or phase.date_start or datetime.now().strftime("%Y-%m-%d")
- start_date = datetime.strftime((datetime.strptime(start_date, "%Y-%m-%d")), "%Y-%m-%d")
- phase_resource_obj = self.generate_resources(cr, uid, [phase.id], context=context)[phase.id]
- avg_days = uom_pool._compute_qty(cr, uid, phase.product_uom.id, phase.duration, day_uom_id)
- if not phase_resource_obj: #TOCHECK: why need this ?
- avg_days = avg_days - 1
- duration = str(avg_days) + 'd'
- # Create a new project for each phase
- def Project():
- # If project has working calendar then that
- # else the default one would be considered
- start = start_date
- minimum_time_unit = 1
- resource = phase_resource_obj
- working_hours_per_day = 24
- vacation = []
- if calendar_id:
- working_hours_per_day = 8 #TODO: it should be come from calendars
- vacation = tuple(resource_pool.compute_vacation(cr, uid, calendar_id))
- working_days = resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context)
- def phase():
- effort = duration
-
- project = Task.BalancedProject(Project)
-
- s_date = project.phase.start.to_datetime()
- e_date = project.phase.end.to_datetime()
+
+
+ if not start_date:
+ start_date = root_phase.project_id.date_start or root_phase.date_start or datetime.now().strftime("%Y-%m-%d")
+ start_date = datetime.strftime((datetime.strptime(start_date, "%Y-%m-%d")), "%Y-%m-%d")
+
+ start = start_date
+ minimum_time_unit = 1
+ working_hours_per_day = 24
+ working_days_per_week = 7
+ working_days_per_month = 30
+ working_days_per_year = 365
+
+ vacation = []
+ if calendar_id:
+ working_hours_per_day = 8 #TODO: it should be come from calendars
+ working_days_per_week = 5
+ working_days_per_month = 20
+ working_days_per_year = 200
+ vacation = tuple(resource_pool.compute_vacation(cr, uid, calendar_id))
+ working_days = resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context)
+
+ #Creating resources using the member of the Project
+ u_ids = [i.id for i in root_phase.project_id.members]
+ resource_objs = resource_pool.generate_resources(cr, uid, u_ids, calendar_id, context=context)
+ cls_str = ''
+ # Creating Resources for the Project
+ for key, vals in resource_objs.items():
+ cls_str +='''
+ class Resource_%s(Resource):
+ vacation = %s
+ efficiency = %s
+'''%(key, vals.get('vacation', False), vals.get('efficiency', False))
+
+ # Create a new project for each phase
+ func_str += '''
+
+def Project_%d():
+ # If project has working calendar then that
+ # else the default one would be considered
+ start = \'%s\'
+ minimum_time_unit = %s
+ working_hours_per_day = %s
+ working_days_per_week = %s
+ working_days_per_month = %s
+ working_days_per_year = %s
+ vacation = %s
+ working_days = %s
+ from resource.faces import Resource
+'''%(root_phase.project_id.id, start, minimum_time_unit, working_hours_per_day, working_days_per_week, working_days_per_month, working_days_per_year, vacation, working_days )
+ func_str += cls_str
+ phases, phase_ids = self.generate_phase(cr, uid, [root_phase.id], func_str, context=context)
+ #Temp File to test the Code for the Allocation
+# fn = '/home/tiny/Desktop/plt.py'
+# fp = open(fn, 'w')
+# fp.writelines(phases)
+# fp.close()
+ # Allocating Memory for the required Project and Pahses and Resources
+ exec(phases)
+ Project = eval('Project_%d' % root_phase.project_id.id)
+ project = Task.BalancedProject(Project)
+
+ for phase_id in phase_ids:
+ phase = eval("project.Phase_%d" % phase_id)
+ start_date = phase.start.to_datetime()
+ end_date = phase.end.to_datetime()
+ for res in phase.resource.all_members():
+ print "\n\n888888888888888",res.book_task()
+# for i in dir(res):
+# print "$$$$$$$$",i,eval('res.%s'%i)
# Recalculate date_start and date_end
# according to constraints on date start and date end on phase
- if phase.constraint_date_start and str(s_date) < phase.constraint_date_start:
- start_date = datetime.strptime(phase.constraint_date_start, '%Y-%m-%d')
- else:
- start_date = s_date
- if phase.constraint_date_end and str(e_date) > phase.constraint_date_end:
- end_date= datetime.strptime(phase.constraint_date_end, '%Y-%m-%d')
- date_start = phase.constraint_date_end
- else:
- end_date = e_date
- date_start = end_date
- # Write the calculated dates back
- ctx = context.copy()
- ctx.update({'scheduler': True})
- self.write(cr, uid, [phase.id], {
+# if phase.constraint_date_start and str(s_date) < phase.constraint_date_start:
+# start_date = datetime.strptime(phase.constraint_date_start, '%Y-%m-%d')
+# else:
+# start_date = s_date
+# if phase.constraint_date_end and str(e_date) > phase.constraint_date_end:
+# end_date= datetime.strptime(phase.constraint_date_end, '%Y-%m-%d')
+# date_start = phase.constraint_date_end
+# else:
+# end_date = e_date
+# date_start = end_date
+# # Write the calculated dates back
+# ctx = context.copy()
+# ctx.update({'scheduler': True})
+ self.write(cr, uid, [phase_id], {
'date_start': start_date.strftime('%Y-%m-%d'),
'date_end': end_date.strftime('%Y-%m-%d')
- }, context=ctx)
+ }, context=context)
# write dates into Resources Allocation
- for resource in phase.resource_ids:
- resource_allocation_pool.write(cr, uid, [resource.id], {
- 'date_start': start_date.strftime('%Y-%m-%d'),
- 'date_end': end_date.strftime('%Y-%m-%d')
- }, context=ctx)
- # Recursive call till all the next phases scheduled
- for next_phase in phase.next_phase_ids:
- if next_phase.state in ['draft', 'open', 'pending']:
- id_cal = next_phase.project_id.resource_calendar_id and next_phase.project_id.resource_calendar_id.id or False
- self.generate_schedule(cr, uid, [next_phase.id], date_start+timedelta(days=1), id_cal, context=context)
- else:
- continue
- return True
+# for resource in phase.resource_ids:
+# resource_allocation_pool.write(cr, uid, [resource.id], {
+# 'date_start': start_date.strftime('%Y-%m-%d'),
+# 'date_end': end_date.strftime('%Y-%m-%d')
+# }, context=context)
+# # Recursive call till all the next phases scheduled
def schedule_tasks(self, cr, uid, ids, context=None):
"""
@@ -395,7 +466,8 @@
])
calendar_id = project.resource_calendar_id and project.resource_calendar_id.id or False
start_date = False
- phase_pool.generate_schedule(cr, uid, phase_ids, start_date, calendar_id, context=context)
+ for phase in phase_pool.browse(cr, uid, phase_ids, context=context):
+ phase_pool.generate_schedule(cr, uid, phase, start_date, calendar_id, context=context)
return True
def schedule_tasks(self, cr, uid, ids, context=None):
@@ -489,9 +561,15 @@
raise osv.except_osv(_('Error'), _('Resources should be allocated to your phases and Members should be assigned to your Project!'))
minimum_time_unit = 1
working_hours_per_day = 24
+ working_days_per_week = 7
+ working_days_per_month = 30
+ working_days_per_year = 365
vacation = []
if calendar_id:
working_hours_per_day = 8 #TODO: it should be come from calendars
+ working_days_per_week = 5
+ working_days_per_month = 20
+ working_days_per_year = 200
vacation = tuple(resource_pool.compute_vacation(cr, uid, calendar_id, context=context))
working_days = resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context)
# Dynamic creation of tasks
=== modified file 'project_long_term/test/schedule_project_phases.yml'
--- project_long_term/test/schedule_project_phases.yml 2010-09-24 09:26:14 +0000
+++ project_long_term/test/schedule_project_phases.yml 2011-01-10 12:52:01 +0000
@@ -4,7 +4,14 @@
!record {model: project.project, id: project_project_worldbanksproject0}:
name: "World Bank's Project"
priority: 4
-
+ members:
+ - project.res_users_analyst
+ - project.res_users_project_manager
+ - project.res_users_technical_leader
+ - project.res_users_developer
+ - project.res_users_designer
+
+
-
Create a project phase 'Defining Client's Basic Idea of Project'
-
@@ -14,8 +21,7 @@
name: "Defining Client's Basic Idea of Project"
product_uom: product.uom_day
project_id: project_project_worldbanksproject0
-
-
+
-
Create project phase 'Establishing Project Feasibility'
-
@@ -25,7 +31,21 @@
name: Establishing Project Feasibility
product_uom: product.uom_day
project_id: project_project_worldbanksproject0
+
+-
+ Resource1
+-
+ !record {model: project.resource.allocation, id: res_phase0}:
+ resource_id: project_long_term.resource_project_manager
+ phase_id: project_phase_definingclientsbasicideaofproject0
+-
+ Resource2
+-
+ !record {model: project.resource.allocation, id: res_phase2}:
+ resource_id: project_long_term.resource_analyst
+ phase_id: project_phase_definingclientsbasicideaofproject0
+
-
Create project phase 'Preparation of Engineering Designs'
-
=== modified file 'resource/resource.py'
--- resource/resource.py 2010-12-30 12:35:34 +0000
+++ resource/resource.py 2011-01-10 12:52:01 +0000
@@ -250,7 +250,7 @@
"""
Return a list of Resource Class objects for the resources allocated to the phase.
"""
- resource_objs = []
+ resource_objs = {}
user_pool = self.pool.get('res.users')
for user in user_pool.browse(cr, uid, user_ids, context=context):
resource_ids = self.search(cr, uid, [('user_id', '=', user.id)], context=context)
@@ -264,12 +264,17 @@
resource_cal = resource.calendar_id.id
if resource_cal:
leaves = self.compute_vacation(cr, uid, calendar_id, resource.id, resource_cal, context=context)
- resource_objs.append(classobj(str(user.name), (Resource,),{
- '__doc__': user.name,
- '__name__': user.name,
- 'vacation': tuple(leaves),
- 'efficiency': resource_eff,
- }))
+ temp = {
+ 'vacation': tuple(leaves),
+ 'efficiency': resource_eff,
+ }
+ resource_objs[resource_id] = temp
+# resource_objs.append(classobj(str(user.name), (Resource,),{
+# '__doc__': user.name,
+# '__name__': user.name,
+# 'vacation': tuple(leaves),
+# 'efficiency': resource_eff,
+# }))
return resource_objs
def compute_vacation(self, cr, uid, calendar_id, resource_id=False, resource_calendar=False, context=None):
=== modified file 'thunderbird/plugin/openerp_plugin.xpi'
Binary files thunderbird/plugin/openerp_plugin.xpi 2010-12-16 10:36:16 +0000 and thunderbird/plugin/openerp_plugin.xpi 2011-01-10 12:52:01 +0000 differ
=== modified file 'thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar'
Binary files thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar 2010-12-16 10:36:16 +0000 and thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar 2011-01-10 12:52:01 +0000 differ
=== modified file 'thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/config.xul'
--- thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/config.xul 2010-12-16 10:36:16 +0000
+++ thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/config.xul 2011-01-10 12:52:01 +0000
@@ -17,10 +17,10 @@
</tabs>
<tabpanels>
<tabpanel id="configtab">
- <vbox style="border:1px solid black">
+ <vbox style="border:1px solid">
<groupbox id="gpConnection" align ="center" >
- <separator class="groove-thin" orient="horizontal" width="94"/>
- <caption label="&gpConnection.label;"/>
+ <separator class="groove-thin" orient="horizontal" width="94"/>
+ <caption label="&gpConnection.label;"/>
<hbox>
<label align="right" id="url" value="&txturl.label;" width="80" />
<textbox id="txturl" width="200" readonly="true" />
@@ -50,28 +50,28 @@
</vbox>
<separator class="groove-thin" orient="horizontal" width="10"/>
- <vbox style="border:1px solid black" width="94">
- <groupbox id="webgroup" >
- <vbox>
- <caption label="&webConnection.label;"/>
- </vbox>
- <separator class="groove-thin" orient="horizontal" width="10"/>
- <hbox>
- <label align="right" id="url" value="&txtweburl.label;" width="80" />
- <textbox id="txtweburl" width="200" readonly="true"/>
- </hbox>
-
- <hbox >
- <spacer width="113"/>
- <button align="center" id="websetconnection" label="&setconnection.label;" oncommand="openConfigChangeweb();" image="&imagesearch.value;"/>
- <button align="center" id="webopenconnection" label="&openconnection.label;" oncommand="testConnection_web();" image="&imageok.value;"/>
- </hbox>
-</groupbox>
- </vbox>
+ <vbox style="border:0.5px solid" >
+ <groupbox id="webgroup" align ="center">
+ <vbox>
+ <caption label="&webConnection.label;"/>
+ </vbox>
+ <separator class="groove-thin" orient="horizontal" width="10"/>
+ <hbox>
+ <label align="right" id="url" value="&txtweburl.label;" width="80" />
+ <textbox id="txtweburl" width="200" readonly="true"/>
+ </hbox>
+
+ <hbox >
+ <spacer width="113"/>
+ <button align="center" id="websetconnection" label="&setconnection.label;" oncommand="openConfigChangeweb();" image="&imagesearch.value;"/>
+ <button align="center" id="webopenconnection" label="&openconnection.label;" oncommand="testConnection_web();" image="&imageok.value;"/>
+ </hbox>
+ </groupbox>
+ </vbox>
</tabpanel>
<tabpanel id="objecttab">
- <groupbox id="gpObject" width="700" >
+ <groupbox id="gpObject" align ="center">
<caption label="&listDocument.header;"/>
<hbox>
<vbox>
@@ -109,7 +109,9 @@
</tabpanel>
<tabpanel id="abouttab">
<groupbox id="gpAbout" width="770" align="center">
- <caption label="&gpAbout.label;"/>
+ <caption label="&gpAbout.label;" align="center"/>
+
+ <vbox style="border:1px solid black" width="770"/>
<description>&openerp.paresent;</description>
<image src="chrome://openerp_plugin/skin/logo.png" sizemode="stretch" align="center"/>
=== modified file 'thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/plugin.xul'
--- thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/plugin.xul 2010-12-07 16:15:02 +0000
+++ thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/plugin.xul 2011-01-10 12:52:01 +0000
@@ -17,8 +17,7 @@
<hbox id="root1" height="380" width="800" >
<vbox>
<caption label="&gptinyobj.label;" />
- <groupbox id="existsobjectgroup" width="400" style="border:1px solid black">
-
+ <groupbox id="existsobjectgroup" style="border:1px solid black">
<separator class="groove-thin" orient="horizontal" width="400"/>
<hbox>
<label id="lblsearch" control="txtvalueobj" value="&search.label;"/>
@@ -57,7 +56,7 @@
<vbox>
<caption label="&newobject.label;" />
- <groupbox id="newobjectgroup" width="400" align="left" style="border:1px solid black;">
+ <groupbox id="newobjectgroup" align="left" style="border:1px solid black;" height="100" >
<separator class="groove-thin" orient="horizontal" width="400" height="30"/>
<hbox align="left">
<vbox>
@@ -77,7 +76,7 @@
<separator class="groove-thin" orient="horizontal" width="180" height="100"/>
</groupbox>
<caption label="&newcontact.label;" />
- <groupbox id="newcontactgroup" width="400" align="left" style="border:1px solid black;">
+ <groupbox id="newcontactgroup" align="left" style="border:1px solid black;">
<separator class="groove-thin" orient="horizontal" width="400" height="30"/>
<hbox align="left">
<vbox>
=== modified file 'thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/config.dtd'
--- thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/config.dtd 2010-12-16 10:36:16 +0000
+++ thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/config.dtd 2011-01-10 12:52:01 +0000
@@ -42,7 +42,7 @@
<!ENTITY tinyerp_s.value "The Tiny Company">
<!ENTITY imageicon.value "chrome://openerp_plugin/skin/NEWT1.png">
-<!ENTITY gpAbout.label "About OpenERP Thunderbird Plugin">
+<!ENTITY gpAbout.label "OpenERP Thunderbird Plugin :">
<!ENTITY develop.value "Based on original work, copyright 2003-2009, by Tiny & Axelor ">
<!ENTITY information.value "For more information, please visit our website">
<!ENTITY contact.label "Contact Us">
Follow ups