From 45b7289189c2f58b31d08b9a101c03ff843c9ecf Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Wed, 3 Feb 2010 15:54:56 +0530 Subject: [PATCH 01/11] [IMP]:improved groupby date format to Today, and (month year) wise eg: Today,January 2010, February 2010 bzr revid: nch@tinyerp.com-20100203102456-lz4uqqnstsblcoo7 --- bin/osv/orm.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 4d874824196..9975cf1e5a3 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1831,23 +1831,17 @@ class orm(orm_template): alldata[r['id']] = r del r['id'] - today = '' - if fget.has_key(groupby) and fget[groupby]['type'] in ('date','datetime'): - today = datetime.date.today() - yesterday = (today - datetime.timedelta(days=1)).strftime('%Y-%m-%d') - data = self.read(cr, uid, alldata.keys(), [groupby], context=context) for d in data: if fget.has_key(groupby): if fget[groupby]['type'] == 'many2one': d[groupby] = d[groupby] and d[groupby][1] or '' - if today: - if d[groupby][:10] == str(today): - d[groupby] = 'Today' - elif d[groupby][:10] == yesterday: - d[groupby] = 'Yesterday' - else: - d[groupby] = 'Old' + if fget[groupby]['type'] in ('date','datetime'): + today = datetime.date.today() + if d[groupby][:10] == str(today): + d[groupby] = 'Today' + else: + d[groupby] = datetime.datetime.strptime(d[groupby][:10],'%Y-%m-%d').strftime('%B %Y') d['__domain'] = [(groupby,'=',alldata[d['id']][groupby] or False)] + domain del alldata[d['id']][groupby] d.update(alldata[d['id']]) From 7a031b3646edf66bfde0f28429018bada65456b2 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Wed, 3 Feb 2010 15:57:18 +0530 Subject: [PATCH 02/11] [IMP] mrp: set the colors for cancel state in list view bzr revid: sbh@tinyerp.com-20100203102718-mlkgt1wjyetofd51 --- addons/mrp/mrp_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 29146b78edb..e9ff640c635 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -669,7 +669,7 @@ mrp.procurement tree - + From 4f9107a9d6a4859321ee2f42521b8188e0ea3010 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Wed, 3 Feb 2010 16:13:25 +0530 Subject: [PATCH 03/11] [CHNGE]: beter view for the dashboard for project module bzr revid: mga@tinyerp.com-20100203104325-hz4wfzctode5j70m --- addons/board_project/board_project_manager_view.xml | 4 ++-- addons/board_project/board_project_view.xml | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/board_project/board_project_manager_view.xml b/addons/board_project/board_project_manager_view.xml index 3f805115fd4..3baca91bce6 100644 --- a/addons/board_project/board_project_manager_view.xml +++ b/addons/board_project/board_project_manager_view.xml @@ -55,9 +55,9 @@ - + - + diff --git a/addons/board_project/board_project_view.xml b/addons/board_project/board_project_view.xml index f1e27da0839..e602b54d982 100644 --- a/addons/board_project/board_project_view.xml +++ b/addons/board_project/board_project_view.xml @@ -92,11 +92,12 @@ - + + + - From 1bb30ecef0776c0f51f47c81ced3dcdd4a67596d Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 3 Feb 2010 16:16:24 +0530 Subject: [PATCH 04/11] [IMP]: caldav: Attendee Invitation improvement * Improved information+formating of mail to send on invitation * Implemented email gateway functions that updates attendees's response by mail reply bzr revid: rpa@openerp.co.in-20100203104624-hs3t7kk2966s90e4 --- addons/caldav/caldav.py | 132 +++++++++++++++++++++++++++------- addons/caldav/caldav_view.xml | 19 ++--- 2 files changed, 114 insertions(+), 37 deletions(-) diff --git a/addons/caldav/caldav.py b/addons/caldav/caldav.py index 1e2aa15b77a..fa4b811fa2b 100644 --- a/addons/caldav/caldav.py +++ b/addons/caldav/caldav.py @@ -67,52 +67,106 @@ def _links_get(self, cr, uid, context={}): return [(r['object'], r['name']) for r in res] html_invitation = """ + %(name)s -
- - + +
+ + + + + + + + + +
Hello,
You are invited for OpenERP Event.
Below are the details of event :
+ + + + + +

%(name)s

- +
- - - + - + - - + + - + -
-
Start Date
+
+
Start Date
%(start_date)s -
End Date
+
: %(start_date)s +
End Date
%(end_date)s: %(end_date)s
Description%(description)sDescription: %(description)s
-
Location
+
Location
%(location)s: %(location)s
-
Event Attendees
+
Event Attendees
-
%(attendees)s
+
: %(attendees)s
""" +
Are you coming? +
    +
  • + YES +
  • + NO +
  • + MAYBE +
+
+ + + + + + + + + + + + + + + + + + + +
Note: If you are interested please reply this + mail and keep only your response from options YES, NO + and MAYBE.
From:
%(user)s
--------------------------
%(sign)s
+ + +""" class calendar_attendee(osv.osv): _name = 'calendar.attendee' @@ -253,6 +307,30 @@ request was delegated to"), _defaults = { 'state': lambda *x: 'needs-action', } + + response_re = response_re = re.compile("Are you coming\?.*(YES|NO|MAYBE).*", re.UNICODE) + + def msg_new(self, cr, uid, msg): + return False + + def msg_act_get(self, msg): + mailgate_obj = self.pool.get('mail.gateway') + body = mailgate_obj.msg_body_get(msg) + actions = {} + res = self.response_re.findall(body['body']) + if res: + actions['state'] = res[0] + return actions + + def msg_update(self, cr, uid, ids, msg, data={}, default_act='None'): + msg_actions = self.msg_act_get(msg) + if msg_actions.get('state'): + if msg_actions['state'] in ['YES','NO','MAYBE']: + mapping = {'YES': 'accepted', 'NO': 'declined', 'MAYBE': 'tentative'} + status = mapping[msg_actions['state']] + print 'Got response for invitation id: %s as %s' % (ids, status) + self.write(cr, uid, ids, {'state': status}) + return True def onchange_user_id(self, cr, uid, ids, user_id, *args, **argv): if not user_id: @@ -278,7 +356,7 @@ request was delegated to"), vals['cn'] = vals.get("cn") res = super(calendar_attendee, self).create(cr, uid, vals, context) return res - + calendar_attendee() class res_alarm(osv.osv): @@ -457,7 +535,7 @@ or contains the text to be used for display"""), %s """ % (alarm.name, alarm.trigger_date, alarm.description, \ - alarm.user_id.name, alarm.user_id.sign) + alarm.user_id.name, alarm.user_id.signature) mail_to = [alarm.user_id.address_id.email] for att in alarm.attendee_ids: mail_to.append(att.user_id.address_id.email) @@ -1113,23 +1191,27 @@ class invite_attendee_wizard(osv.osv_memory): vals.update({'email': datas['email']}) att_id = att_obj.create(cr, uid, vals) obj.write(cr, uid, res_obj.id, {'attendee_ids': [(4, att_id)]}) - - sub = '[OpenERP Invitation] %s' % (res_obj.name) + sign = res_obj.user_id and res_obj.user_id.signature or '' + sign = '
'.join(sign and sign.split('\n') or []) + sub = '[%d] %s' % (att_id, res_obj.name) body_vals = {'name': res_obj.name, 'start_date': res_obj.date, 'end_date': res_obj.date_deadline or None, 'description': res_obj.description, 'location': res_obj.location or '-', - 'attendees': '-' #Todo + 'attendees': '-', #Todo + 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', + 'sign': sign } body = html_invitation % body_vals mail_to = [datas['email']] tools.email_send( - res_obj.user_id.name, + tools.config.get('email_from',False), mail_to, sub, body, - subtype='html' + subtype='html', + reply_to=tools.config.get('email_from',False), ) elif type == 'partner': diff --git a/addons/caldav/caldav_view.xml b/addons/caldav/caldav_view.xml index 4d10b9529f5..2d3a59892c7 100644 --- a/addons/caldav/caldav_view.xml +++ b/addons/caldav/caldav_view.xml @@ -95,21 +95,16 @@