From a70ea4f2619b778b564e481733a5289787669b9f Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Fri, 22 Jan 2010 11:55:43 +0530 Subject: [PATCH 01/22] [FIX] project : In projects, "Set As Template" and "Done" are not working bzr revid: hmo@tinyerp.com-20100122062543-51tvnrdhk0y2asq0 --- addons/project/project.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index f90e2b65e0e..c97e2412744 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -164,7 +164,7 @@ class project(osv.osv): return res def set_done(self, cr, uid, ids, context={}): - self.write(cr, uid, ids, {'state':'done'}, context=context) + self.write(cr, uid, ids, {'state':'close'}, context=context) return True def set_cancel(self, cr, uid, ids, context={}): @@ -192,7 +192,8 @@ class project(osv.osv): default['name'] = proj.name+_(' (copy)') res = super(project, self).copy(cr, uid, id, default, context) ids = self.search(cr, uid, [('parent_id','child_of', [res])]) - cr.execute('update project_task set active=True where project_id in ('+','.join(map(str, ids))+')') + if ids: + cr.execute('update project_task set active=True where project_id in ('+','.join(map(str, ids))+')') return res def duplicate_template(self, cr, uid, ids,context={}): @@ -203,11 +204,9 @@ class project(osv.osv): res = cr.fetchall() for (tasks_id,) in res: self.pool.get('project.task').copy(cr, uid, tasks_id,default={'project_id':new_id,'active':True}, context=context) - cr.execute('select id from project_project where parent_id=%s', (proj.id,)) - res = cr.fetchall() - project_ids = [x[0] for x in res] - for child in project_ids: - self.duplicate_template(cr, uid, [child],context={'parent_id':new_id}) + child_ids = self.search(cr, uid, [('parent_id','=', proj.id)]) + if child_ids: + self.duplicate_template(cr, uid, child_ids, context={'parent_id':new_id}) # TODO : Improve this to open the new project (using a wizard) @@ -222,10 +221,9 @@ class project(osv.osv): tasks_id = [x[0] for x in cr.fetchall()] if tasks_id: self.pool.get('project.task').write(cr, uid, tasks_id, {'active': value}, context) - cr.execute('select id from project_project where parent_id=%s', (proj.id,)) - project_ids = [x[0] for x in cr.fetchall()] - for child in project_ids: - self.setActive(cr, uid, [child], value, context) + child_ids = self.search(cr, uid, [('parent_id','=', proj.id)]) + if child_ids: + self.setActive(cr, uid, child_ids, value, context) return True project() From 741bbcb6cd0c63b9fceb20fca20b10df699ea8f2 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Fri, 22 Jan 2010 12:32:41 +0530 Subject: [PATCH 02/22] [IMP+FIX] project: improve _proget_get method bzr revid: hmo@tinyerp.com-20100122070241-hzyes9f8y0w9k8a2 --- addons/project/project.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index c97e2412744..c7dc5ece780 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -587,10 +587,14 @@ def _project_get(self, cr, uid, context={}): if uid==1: ids = self.pool.get('project.project').search(cr, uid, []) res = self.pool.get('project.project').read(cr, uid, ids, ['id','name'], context) - return [(str(r['id']),r['name']) for r in res] - cr.execute("""SELECT to_char(id, '99999'),name FROM project_project where manager=%s OR - id IN (SELECT project_id from project_user_rel where uid=%s)""" % (uid, uid)) - return cr.fetchall() + else: + # Take Projects only user is manager or member + cr.execute("""SELECT project.id,project.name FROM project_project project + LEFT JOIN account_analytic_account account ON account.id = project.category_id + WHERE (account.user_id = %s)""", uid) + res = cr.fetchall() + res = [(str(r['id']),r['name']) for r in res] + return res class users(osv.osv): _inherit = 'res.users' From 50269991886273200bbb07b5e7b684fd776bffd6 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Fri, 22 Jan 2010 13:03:05 +0530 Subject: [PATCH 03/22] [IMP,ADD]: Caldav, base_calendar: Put proper data for attribute/field mapping according to new objects, Improvement in base.calendar view bzr revid: rpa@openerp.co.in-20100122073305-gxsydxpedsxoftqo --- addons/base_calendar/__terp__.py | 2 +- addons/base_calendar/base_calendar.py | 6 +- addons/base_calendar/base_calendar_data.xml | 369 +++++++++++++++ addons/base_calendar/base_calendar_view.xml | 20 +- addons/caldav/caldav.py | 2 + addons/caldav/caldav_data.xml | 438 ++++++++++++++++++ addons/crm/crm_meeting_data.xml | 25 + addons/project_calendar/__terp__.py | 2 +- .../project_calendar_data.xml | 41 ++ 9 files changed, 891 insertions(+), 14 deletions(-) create mode 100644 addons/base_calendar/base_calendar_data.xml create mode 100644 addons/project_calendar/project_calendar_data.xml diff --git a/addons/base_calendar/__terp__.py b/addons/base_calendar/__terp__.py index 49b3a2d7389..51097c2b13c 100644 --- a/addons/base_calendar/__terp__.py +++ b/addons/base_calendar/__terp__.py @@ -38,7 +38,7 @@ "author" : "Tiny", 'category': 'Generic Modules/Others', 'website': 'http://www.openerp.com', - "init_xml" : [], + "init_xml" : ["base_calendar_data.xml"], "demo_xml" : [], "update_xml" : [ 'security/ir.model.access.csv', diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 1cb79407476..32ac63d8ab4 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -275,7 +275,8 @@ class basic_calendar_line(osv.osv): ('attendee', 'Attendee')], \ string="Type", size=64), 'object_id': fields.many2one('ir.model', 'Object'), - 'calendar_id': fields.many2one('basic.calendar', 'Calendar', required=True), + 'calendar_id': fields.many2one('basic.calendar', 'Calendar', \ + required=True, ondelete='cascade',), 'mapping_ids': fields.one2many('basic.calendar.fields', 'type_id', 'Fields Mapping') } @@ -301,7 +302,8 @@ class basic_calendar_fields(osv.osv): _columns = { 'field_id': fields.many2one('ir.model.fields', 'OpenObject Field'), 'name': fields.many2one('basic.calendar.attributes', 'Name', required=True), - 'type_id': fields.many2one('basic.calendar.lines', 'Type', required=True), + 'type_id': fields.many2one('basic.calendar.lines', 'Type', \ + required=True, ondelete='cascade'), 'expr': fields.char("Expression", size=64), 'fn': fields.selection( [('field', 'Use the field'), ('const', 'Expression as constant'), diff --git a/addons/base_calendar/base_calendar_data.xml b/addons/base_calendar/base_calendar_data.xml new file mode 100644 index 00000000000..0eb232ac0a3 --- /dev/null +++ b/addons/base_calendar/base_calendar_data.xml @@ -0,0 +1,369 @@ + + + + + + OpenERP + + + + + + comment + event + + + + uid + event + + + + seq + event + + + + recurrence-id + event + + + + transp + event + + + + attendee + event + + + + related + event + + + + rrule + event + + + + dtend + event + + + + valarm + event + + + + priority + event + + + + location + event + + + + exrule + event + + + + resources + event + + + + rstatus + event + + + + status + event + + + + exdate + event + + + + dtstamp + event + + + + description + event + + + + rdate + event + + + + dtstart + event + + + + class + event + + + + x-openobject-model + event + + + + created + event + + + + url + event + + + + summary + event + + + + contact + event + + + + + + + status + todo + + + + comment + todo + + + + attendee + todo + + + + valarm + todo + + + + description + todo + + + + seq + todo + + + + url + todo + + + + completed + todo + + + + percent + todo + + + + due + todo + + + + summary + todo + + + + priority + todo + + + + exdate + todo + + + + location + todo + + + + exrule + todo + + + + duration + todo + + + + organizer + todo + + + + dtstart + todo + + + + rrule + todo + + + + class + todo + + + + uid + todo + + + + + + cn + attendee + + + + sent-by + attendee + + + + language + attendee + + + + delegated-from + attendee + + + + member + attendee + + + + cutype + attendee + + + + role + attendee + + + + partstat + attendee + + + + delegated-to + attendee + + + + dir + attendee + + + + rsvp + attendee + + + + + + attendee + alarm + + + + trigger_duration + alarm + + + + description + alarm + + + + attach + alarm + + + + trigger_occurs + alarm + + + + trigger_interval + alarm + + + + summary + alarm + + + + duration + alarm + + + + repeat + alarm + + + + action + alarm + + + + trigger_related + alarm + + + + diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml index 1dc534db87f..130eb268105 100644 --- a/addons/base_calendar/base_calendar_view.xml +++ b/addons/base_calendar/base_calendar_view.xml @@ -1,18 +1,18 @@ - + Basic Calendar basic.calendar form -
- + + - + @@ -25,21 +25,21 @@ - + + + - + - +
- - Calendar ir.actions.act_window @@ -50,7 +50,7 @@ - + diff --git a/addons/caldav/caldav.py b/addons/caldav/caldav.py index e5739983324..c11110609a8 100644 --- a/addons/caldav/caldav.py +++ b/addons/caldav/caldav.py @@ -444,9 +444,11 @@ class calendar_event(osv.osv): _columns = { 'id': fields.integer('ID'), + 'sequence': fields.integer('Sequence'), 'name': fields.char('Description', size=64, required=True), 'date': fields.datetime('Date'), 'date_deadline': fields.datetime('Deadline'), + 'create_date': fields.datetime('Created' ,readonly=True), 'duration': fields.function(_get_duration, method=True, \ fnct_inv=_set_duration, string='Duration'), 'description': fields.text('Your action'), diff --git a/addons/caldav/caldav_data.xml b/addons/caldav/caldav_data.xml index 2043dd3e6e4..e32ec1a663a 100644 --- a/addons/caldav/caldav_data.xml +++ b/addons/caldav/caldav_data.xml @@ -130,5 +130,443 @@ + + event + + + + + + todo + + + + + + alarm + + + + + + attendee + + + + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + +
diff --git a/addons/crm/crm_meeting_data.xml b/addons/crm/crm_meeting_data.xml index 180d52314b1..035a5c30175 100644 --- a/addons/crm/crm_meeting_data.xml +++ b/addons/crm/crm_meeting_data.xml @@ -27,5 +27,30 @@ crm.meeting + + + + + + + + field + + + + + + + + field + + + + + + + field + + diff --git a/addons/project_calendar/__terp__.py b/addons/project_calendar/__terp__.py index 22ef44ad8ba..dc091369928 100644 --- a/addons/project_calendar/__terp__.py +++ b/addons/project_calendar/__terp__.py @@ -26,7 +26,7 @@ "category" : "Generic Modules/Others", "description": """ Synchronize between Project task and Caldav Vtodo.""", "depends" : ["project", "caldav"], - "init_xml" : [], + "init_xml" : ["project_calendar_data.xml"], "demo_xml" : [], "update_xml" : ["project_calendar_view.xml", "project_calendar_wizard.xml"], diff --git a/addons/project_calendar/project_calendar_data.xml b/addons/project_calendar/project_calendar_data.xml new file mode 100644 index 00000000000..5b371611a55 --- /dev/null +++ b/addons/project_calendar/project_calendar_data.xml @@ -0,0 +1,41 @@ + + + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + + + + field + + + + \ No newline at end of file From f21f43ed8ebf2e54b4b0cc662654f765c54d22a9 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Fri, 22 Jan 2010 13:11:48 +0530 Subject: [PATCH 04/22] [ADD+IMP] project: Made wizard for duplicate template and call it in from project view on click button for duplicate template bzr revid: hmo@tinyerp.com-20100122074148-6adgv1fp7j117fe6 --- addons/project/project.py | 19 ++--- addons/project/project_view.xml | 4 +- addons/project/project_wizard.xml | 5 ++ addons/project/wizard/__init__.py | 1 + .../wizard/duplicate_template_wizard.py | 71 +++++++++++++++++++ 5 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 addons/project/wizard/duplicate_template_wizard.py diff --git a/addons/project/project.py b/addons/project/project.py index c7dc5ece780..9174449e898 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -197,21 +197,24 @@ class project(osv.osv): return res def duplicate_template(self, cr, uid, ids,context={}): + result = [] for proj in self.browse(cr, uid, ids): - parent_id=context.get('parent_id',False) - new_id=self.pool.get('project.project').copy(cr, uid, proj.id,default={'name':proj.name+_(' (copy)'),'state':'open','parent_id':parent_id}) + parent_id = context.get('parent_id',False) + new_id = self.pool.get('project.project').copy(cr, uid, proj.id, default = { + 'name': proj.name +_(' (copy)'), + 'state':'open', + 'parent_id':parent_id}) + result.append(new_id) cr.execute('select id from project_task where project_id=%s', (proj.id,)) res = cr.fetchall() for (tasks_id,) in res: - self.pool.get('project.task').copy(cr, uid, tasks_id,default={'project_id':new_id,'active':True}, context=context) + self.pool.get('project.task').copy(cr, uid, tasks_id, default = { + 'project_id': new_id, + 'active':True}, context=context) child_ids = self.search(cr, uid, [('parent_id','=', proj.id)]) if child_ids: self.duplicate_template(cr, uid, child_ids, context={'parent_id':new_id}) - - # TODO : Improve this to open the new project (using a wizard) - - cr.commit() - raise osv.except_osv(_('Operation Done'), _('A new project has been created !\nWe suggest you to close this one and work on this new project.')) + return result # set active value for a project, its sub projects and its tasks def setActive(self, cr, uid, ids, value=True, context={}): diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index cde3f076df9..55819fb911b 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -58,9 +58,9 @@