From cea761bbd10f1b1be1a56970287a8c8a60fee929 Mon Sep 17 00:00:00 2001 From: "Hiral Patel (OpenERP)" Date: Tue, 26 Feb 2013 18:05:44 +0530 Subject: [PATCH 001/450] [IMP] Hide the tab invitation in technical feature bzr revid: hip@tinyerp.com-20130226123544-fg48m2bi0008hbqi --- addons/base_calendar/crm_meeting_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml index d9b659b91fa..6a28305f572 100644 --- a/addons/base_calendar/crm_meeting_view.xml +++ b/addons/base_calendar/crm_meeting_view.xml @@ -133,7 +133,7 @@ - + From b66f2a1abfd4b100383dd2f9a69fe8f665b45056 Mon Sep 17 00:00:00 2001 From: "Hiral Patel (OpenERP)" Date: Tue, 26 Feb 2013 18:06:47 +0530 Subject: [PATCH 002/450] [IMP] Internal attendees should automatically be accepted and see the meeting in their calendar bzr revid: hip@tinyerp.com-20130226123647-s957bznoogxk8zrg --- addons/crm/res_partner_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml index 00a071fa954..9a978cb01ad 100644 --- a/addons/crm/res_partner_view.xml +++ b/addons/crm/res_partner_view.xml @@ -21,7 +21,7 @@ res.partner crm.meeting calendar,tree,form,gantt - {'default_partner_ids': [active_id]} + {'search_default_partner_ids': [active_id]} From af37857114b0eb0b7a2b2ca4b596562a4c6a8464 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Thu, 28 Feb 2013 10:42:17 +0530 Subject: [PATCH 003/450] [FIX] removed unnecessary code bzr revid: cha@tinyerp.com-20130228051217-jqa6skltv1325ihi --- addons/crm/res_partner_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml index 9a978cb01ad..00a071fa954 100644 --- a/addons/crm/res_partner_view.xml +++ b/addons/crm/res_partner_view.xml @@ -21,7 +21,7 @@ res.partner crm.meeting calendar,tree,form,gantt - {'search_default_partner_ids': [active_id]} + {'default_partner_ids': [active_id]} From 12089d7156c29353d81749b87865b3ab7279dce3 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Mon, 4 Mar 2013 16:48:32 +0530 Subject: [PATCH 004/450] [IMP] base_calendar: backport form 7.0 branch: lp:~openerp-dev/openobject-addons/7.0-opw-586763-mma bzr revid: cha@tinyerp.com-20130304111832-uq2bl1hkq5icva8i --- addons/base_calendar/base_calendar.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index ca75c9e20fc..f41caa4e1ff 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -578,8 +578,7 @@ property or property parameter."), def do_accept(self, cr, uid, ids, context=None, *args): """ - Update state of invitation as Accepted and if the invited user is other - then event user it will make a copy of this event for invited user. + Marks event invitation as Accepted. @param cr: the current row, from the database cursor @param uid: the current user's ID for security checks @param ids: list of calendar attendee's IDs @@ -588,16 +587,7 @@ property or property parameter."), """ if context is None: context = {} - - for vals in self.browse(cr, uid, ids, context=context): - if vals.ref and vals.ref.user_id: - mod_obj = self.pool.get(vals.ref._name) - res=mod_obj.read(cr,uid,[vals.ref.id],['duration','class'],context) - defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']} - mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) - self.write(cr, uid, vals.id, {'state': 'accepted'}, context) - - return True + return self.write(cr, uid, ids, {'state': 'accepted'}, context) def do_decline(self, cr, uid, ids, context=None, *args): """ From abcbdd8df508c962d2feb0d05652871d27040040 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Tue, 5 Mar 2013 15:31:45 +0530 Subject: [PATCH 005/450] [IMP] base_calendar: overwrite search method to make 'my meeting' filter accurate bzr revid: cha@tinyerp.com-20130305100145-q3k23ydf955xcjpw --- addons/base_calendar/crm_meeting.py | 9 +++++++++ addons/base_calendar/crm_meeting_view.xml | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/base_calendar/crm_meeting.py b/addons/base_calendar/crm_meeting.py index 6010f5ccfca..42513c19f10 100644 --- a/addons/base_calendar/crm_meeting.py +++ b/addons/base_calendar/crm_meeting.py @@ -65,6 +65,15 @@ class crm_meeting(base_state, osv.Model): _defaults = { 'state': 'open', } + + def search(self, cr, uid, args, offset=0, limit=0, order=None, context=None, count=False): + partner_id = self.pool.get('res.users').browse(cr, uid, uid, context).partner_id.id + if context.get('mymeetings',False): + args.append('|') + args.append(['partner_ids', 'in', partner_id]) + args.append(['user_id', '=', uid]) + ids = super(crm_meeting, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) + return ids def message_get_subscription_data(self, cr, uid, ids, context=None): res = {} diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml index 6a28305f572..6bbc6b58574 100644 --- a/addons/base_calendar/crm_meeting_view.xml +++ b/addons/base_calendar/crm_meeting_view.xml @@ -238,7 +238,7 @@ - + @@ -252,7 +252,7 @@ calendar,tree,form,gantt - {"calendar_default_user_id": uid} + {"search_default_mymeetings": 1}

Click to schedule a new meeting. From 76a3c48d0bb69e80939cdff1c399915e1ff8d8d3 Mon Sep 17 00:00:00 2001 From: "kirti savalia (OpenERP)" Date: Fri, 8 Mar 2013 14:01:16 +0530 Subject: [PATCH 006/450] [FIX]:pass the correct context value for the account move bzr revid: ksa@tinyerp.com-20130308083116-bpu9nlh8x4kv3gd9 --- addons/account/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index f6b74edeccd..a686733e211 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1439,7 +1439,7 @@ From 27686df49d8f438c41b90866cedd921989252461 Mon Sep 17 00:00:00 2001 From: chirag patel Date: Mon, 29 Apr 2013 17:34:09 +0530 Subject: [PATCH 007/450] [FIX] Fixed raise warning when email_from value false. bzr revid: cpa@tinyerp.com-20130429120409-sm0c01022qm25agv --- addons/email_template/email_template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 356d903b03d..e8f9dbba5a4 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -376,7 +376,8 @@ class email_template(osv.osv): # create a mail_mail based on values, without attachments values = self.generate_email(cr, uid, template_id, res_id, context=context) - assert values.get('email_from'), 'email_from is missing or empty after template rendering, send_mail() cannot proceed' + if not values.get('email_from'): + raise osv.except_osv(_('Warning!'),_('email_from is missing or empty after template rendering, send_mail() cannot proceed')) del values['email_recipients'] # TODO Properly use them. attachment_ids = values.pop('attachment_ids', []) attachments = values.pop('attachments', []) From 21047bc3f68dd0ad7638e785170971dae24745bb Mon Sep 17 00:00:00 2001 From: "Somesh Khare (OpenERP)" Date: Wed, 8 May 2013 11:48:41 +0530 Subject: [PATCH 008/450] [FIX] account_voucher : Wrong payment date when invoice is paid from bank statement (Ref : Case 592393) bzr revid: skh@openerp.com-20130508061841-mmpytzw9rk7v90ly --- addons/account_voucher/account_voucher.py | 6 +++++- .../wizard/account_statement_from_invoice.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 4b4639daeb6..fabd18bdbbe 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1582,7 +1582,11 @@ class account_bank_statement(osv.osv): bank_st_line_obj = self.pool.get('account.bank.statement.line') st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context) if st_line.voucher_id: - voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context) + voucher_obj.write(cr, uid, [st_line.voucher_id.id], + {'number': next_number, + 'date': st_line.date, + 'period_id': st_line.statement_id.period_id.id}, + context=context) if st_line.voucher_id.state == 'cancel': voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context) wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr) diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py index fce251df175..92d2ebf9173 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice.py +++ b/addons/account_voucher/wizard/account_statement_from_invoice.py @@ -119,7 +119,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'statement_id': statement_id, 'ref': line.ref, 'voucher_id': voucher_id, - 'date': time.strftime('%Y-%m-%d'), + 'date': statement.date, }, context=context) return {'type': 'ir.actions.act_window_close'} From da6e1fcc6b6bea2a7e6c58d55a31c12e8135c575 Mon Sep 17 00:00:00 2001 From: Niels Huylebroeck Date: Wed, 8 May 2013 18:09:10 +0200 Subject: [PATCH 009/450] [FIX] account_voucher: when importing invoices the payment date should be set to the statement date instead of being set to the original invoice date lp bug: https://launchpad.net/bugs/1127198 fixed bzr revid: nh@agaplan.eu-20130508160910-xk1pljvn1aco8417 --- .../account_voucher/wizard/account_statement_from_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py index fce251df175..289a110fdbd 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice.py +++ b/addons/account_voucher/wizard/account_statement_from_invoice.py @@ -94,7 +94,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'account_id': result['value'].get('account_id', statement.journal_id.default_credit_account_id.id), 'company_id': statement.company_id.id, 'currency_id': statement.currency.id, - 'date': line.date, + 'date': statement.date, 'amount': sign*amount, 'payment_rate': result['value']['payment_rate'], 'payment_rate_currency_id': result['value']['payment_rate_currency_id'], @@ -119,7 +119,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'statement_id': statement_id, 'ref': line.ref, 'voucher_id': voucher_id, - 'date': time.strftime('%Y-%m-%d'), + 'date': statement.date, }, context=context) return {'type': 'ir.actions.act_window_close'} From c642f391f3873816507c497a64312495f7e779da Mon Sep 17 00:00:00 2001 From: chirag patel Date: Thu, 9 May 2013 16:28:50 +0530 Subject: [PATCH 010/450] [FIX] Fixed project compute phases gives error, expected an indented block bzr revid: cpa@tinyerp.com-20130509105850-srm674sss61nc9y1 --- addons/project_long_term/wizard/project_compute_phases.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/project_long_term/wizard/project_compute_phases.py b/addons/project_long_term/wizard/project_compute_phases.py index c9aa7eb3573..7e7c83a603e 100644 --- a/addons/project_long_term/wizard/project_compute_phases.py +++ b/addons/project_long_term/wizard/project_compute_phases.py @@ -52,7 +52,8 @@ class project_compute_phases(osv.osv_memory): else: project_ids = project_pool.search(cr, uid, [('user_id','=',uid)], context=context) - project_pool.schedule_phases(cr, uid, project_ids, context=context) + if project_ids: + project_pool.schedule_phases(cr, uid, project_ids, context=context) return self._open_phases_list(cr, uid, data, context=context) def _open_phases_list(self, cr, uid, data, context=None): From 6d3784f954b96811e60560afeb655497e10ad1ad Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Mon, 27 May 2013 19:03:52 +0530 Subject: [PATCH 011/450] [IMP]add the email tempalte bzr revid: rma@tinyerp.com-20130527133352-5ddk1g9040gflfr9 --- addons/base_calendar/base_calendar.py | 202 ++++++++------------ addons/base_calendar/base_calendar_data.xml | 69 +++++++ 2 files changed, 151 insertions(+), 120 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 896349ec5e6..bbf2e05923f 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -127,96 +127,6 @@ def _links_get(self, cr, uid, context=None): res = obj.read(cr, uid, ids, ['object', 'name'], context=context) return [(r['object'], r['name']) for r in res] -html_invitation = """ - - - -%(name)s - - - - - - - - - - - - -
Hello,
You are invited for %(company)s Event.
Below are the details of event. Hours and dates expressed in %(timezone)s time.
- - - - - - - - -
-

%(name)s

-
- - - - - - - - - - - - - - - - - - - - - - - - -
-
Start Date
-
:%(start_date)s -
End Date
-
:%(end_date)s
Description:%(description)s
-
Location
-
:%(location)s
-
Event Attendees
-
: -
-
%(attendees)s
-
-
-
- - - - - - - - - - - - - -
From:
%(user)s
--------------------------
%(sign)s
- - -""" - class calendar_attendee(osv.osv): """ Calendar Attendee Information @@ -494,6 +404,39 @@ property or property parameter."), res = cal.serialize() return res + def get_feedback(self, cr, uid, ids,context=None): +# partner_obj = self.browse(cr,uid, ids,context=context) +# url = [] +# for event_id in self.browse(cr, uid, ids, context): +# event_id = event_id.ref.id +# for partner in partner_obj: +# if partner and partner.user_id: +# related_user = partner.user_id +# base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') +# query = {'db': cr.dbname} +# fragment = { +# 'login': related_user.login, +# 'model': "crm.meeting", +# 'view_type' : "form", +# 'id': event_id, +# } +# url = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment))) +# else : +# url = "https://openerp.my.openerp.com/#" + for event_id in self.browse(cr, uid, ids, context): + event_id = event_id.ref.id + document = self.browse(cr, uid, ids[0], context=context) + print "DOCS ITS CALLED Documents -----------------------------------------",document + partner = document.partner_id + print "partner id",partner + action = 'base_calendar.action_view_event' + print "ACTION -------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>.",action + partner.signup_prepare() + print "PARTNER UPER OF URTLLLLLLLLLLLLLLLL -------------------------------------------.......................", partner.signup_prepare() + a = partner._get_signup_url_for_action(action=action, view_type='form', res_id=event_id)[partner.id] + print "SIG N UP RETUR",a + return partner._get_signup_url_for_action(action=action, view_type='form', res_id=event_id)[partner.id] + def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): """ Send mail for event invitation to event attendees. @@ -506,46 +449,65 @@ property or property parameter."), sign = '
'.join(sign and sign.split('\n') or []) res_obj = att.ref if res_obj: - att_infos = [] + att = [] + att_mail = [] sub = res_obj.name other_invitation_ids = self.search(cr, uid, [('ref', '=', res_obj._name + ',' + str(res_obj.id))]) for att2 in self.browse(cr, uid, other_invitation_ids): - att_infos.append(((att2.user_id and att2.user_id.name) or \ + + att.append(((att2.user_id and att2.user_id.name) or \ (att2.partner_id and att2.partner_id.name) or \ - att2.email) + ' - Status: ' + att2.state.title()) - #dates and times are gonna be expressed in `tz` time (local timezone of the `uid`) + att2.email)) + att_mail.append(att2.email) tz = context.get('tz', pytz.timezone('UTC')) - #res_obj.date and res_obj.date_deadline are in UTC in database so we use context_timestamp() to transform them in the `tz` timezone - date_start = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context) - date_stop = False - if res_obj.date_deadline: - date_stop = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date_deadline, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context) - body_vals = {'name': res_obj.name, - 'start_date': date_start, - 'end_date': date_stop, - 'timezone': tz, - 'description': res_obj.description or '-', - 'location': res_obj.location or '-', - 'attendees': '
'.join(att_infos), - 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', - 'sign': sign, - 'company': company - } - body = html_invitation % body_vals - if mail_to and email_from: - ics_file = self.get_ics_file(cr, uid, res_obj, context=context) - vals = {'email_from': email_from, - 'email_to': mail_to, - 'state': 'outgoing', - 'subject': sub, - 'body_html': body, - 'auto_delete': True} + allday = False + date = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context) + date_deadline = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date_deadline, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context) + if res_obj.allday: + time = "AllDay" + "," + date.strftime('%B-%d-%Y') + tz = '' + elif res_obj.duration < 24: + duration = date + timedelta(hours= res_obj.duration) + time = date.strftime('%B-%d-%Y') + " at (" + date.strftime('%H-%M') + " To " + duration.strftime('%H-%M') + ")" + else : + time = date.strftime('%B-%d-%Y') + " at " + date.strftime('%H-%M') + " To \n" + date_deadline.strftime('%B-%d-%Y') + " at " + date_deadline.strftime('%H-%M') + attendees = '' + + for mail_to in att_mail: + mail_to = mail_to + attendees = mail_to + "," + attendees + footer = self.get_feedback(cr, uid, ids, context=context) + map_url = "http://maps.google.com/maps?oi=map&q=" + body_vals = {'name': res_obj.name, + 'usr': mail_to, + 'responsible': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', + 'company': company, + 'description': res_obj.description or '-', + 'attendees': res_obj.organizer + " - Organizer, " + attendees, + 'time': time, + 'tz': tz, + 'location': res_obj.location or '-', + 'map' : map_url + '+' + str(res_obj.location or '-'), + 'organizer': res_obj.organizer, + 'url' : footer, + } + body_id = self.pool.get('email.template').search(cr, uid, [('subject', '=', 'Meeting Invitation')], context=context) + body = self.pool.get('email.template').browse(cr, uid, body_id[0], context=context).body_html % body_vals + if mail_to and email_from: + ics_file = self.get_ics_file(cr, uid, res_obj, context=context) + vals = {'email_from': email_from, + 'email_to': mail_to, + 'state': 'outgoing', + 'subject': sub, + 'body_html': body, + 'auto_delete': True} if ics_file: vals['attachment_ids'] = [(0,0,{'name': 'invitation.ics', 'datas_fname': 'invitation.ics', 'datas': str(ics_file).encode('base64')})] - self.pool.get('mail.mail').create(cr, uid, vals, context=context) + mail_id= self.pool.get('mail.mail').create(cr, uid, vals, context=context) + self.pool.get('mail.mail').send(cr, uid, [mail_id], context=context) return True def onchange_user_id(self, cr, uid, ids, user_id, *args, **argv): diff --git a/addons/base_calendar/base_calendar_data.xml b/addons/base_calendar/base_calendar_data.xml index 64aa7ba59b6..4c207b3da10 100644 --- a/addons/base_calendar/base_calendar_data.xml +++ b/addons/base_calendar/base_calendar_data.xml @@ -135,4 +135,73 @@ + + + + Meeting Invitation + ${object.user_id.email or ''} + Meeting Invitation + ${object.email} + + + + + +%(name)s + + + + + + + + + + + + + + + + + + + ]]> + + From 75eed7175c5206a8ebe3c07fc98681762e76a3bd Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Thu, 30 May 2013 12:02:08 +0530 Subject: [PATCH 012/450] [IMP] make changes into email template bzr revid: rma@tinyerp.com-20130530063208-fmaijzg9sxmpmi3u --- addons/base_calendar/base_calendar.py | 83 +++++++-------------- addons/base_calendar/base_calendar_data.xml | 55 ++++++-------- 2 files changed, 46 insertions(+), 92 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index bbf2e05923f..5fe919e9f7a 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -404,39 +404,6 @@ property or property parameter."), res = cal.serialize() return res - def get_feedback(self, cr, uid, ids,context=None): -# partner_obj = self.browse(cr,uid, ids,context=context) -# url = [] -# for event_id in self.browse(cr, uid, ids, context): -# event_id = event_id.ref.id -# for partner in partner_obj: -# if partner and partner.user_id: -# related_user = partner.user_id -# base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') -# query = {'db': cr.dbname} -# fragment = { -# 'login': related_user.login, -# 'model': "crm.meeting", -# 'view_type' : "form", -# 'id': event_id, -# } -# url = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment))) -# else : -# url = "https://openerp.my.openerp.com/#" - for event_id in self.browse(cr, uid, ids, context): - event_id = event_id.ref.id - document = self.browse(cr, uid, ids[0], context=context) - print "DOCS ITS CALLED Documents -----------------------------------------",document - partner = document.partner_id - print "partner id",partner - action = 'base_calendar.action_view_event' - print "ACTION -------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>.",action - partner.signup_prepare() - print "PARTNER UPER OF URTLLLLLLLLLLLLLLLL -------------------------------------------.......................", partner.signup_prepare() - a = partner._get_signup_url_for_action(action=action, view_type='form', res_id=event_id)[partner.id] - print "SIG N UP RETUR",a - return partner._get_signup_url_for_action(action=action, view_type='form', res_id=event_id)[partner.id] - def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): """ Send mail for event invitation to event attendees. @@ -444,22 +411,19 @@ property or property parameter."), @return: True """ company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name + company_address = self.pool.get('res.company').browse(cr, uid, uid, context=context).street for att in self.browse(cr, uid, ids, context=context): - sign = att.sent_by_uid and att.sent_by_uid.signature or '' - sign = '
'.join(sign and sign.split('\n') or []) res_obj = att.ref if res_obj: - att = [] - att_mail = [] + att = {} + att_info = [] sub = res_obj.name other_invitation_ids = self.search(cr, uid, [('ref', '=', res_obj._name + ',' + str(res_obj.id))]) for att2 in self.browse(cr, uid, other_invitation_ids): - - att.append(((att2.user_id and att2.user_id.name) or \ - (att2.partner_id and att2.partner_id.name) or \ - att2.email)) - att_mail.append(att2.email) + att_info.append(att2.user_id and att2.user_id.name or att2.partner_id and att2.partner_id.name or att2.email) + att[att2.user_id and att2.user_id.name or att2.partner_id and att2.partner_id.name or att2.email] = att2.email + tz = context.get('tz', pytz.timezone('UTC')) allday = False date = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context) @@ -472,32 +436,35 @@ property or property parameter."), time = date.strftime('%B-%d-%Y') + " at (" + date.strftime('%H-%M') + " To " + duration.strftime('%H-%M') + ")" else : time = date.strftime('%B-%d-%Y') + " at " + date.strftime('%H-%M') + " To \n" + date_deadline.strftime('%B-%d-%Y') + " at " + date_deadline.strftime('%H-%M') - attendees = '' - - for mail_to in att_mail: - mail_to = mail_to - attendees = mail_to + "," + attendees - footer = self.get_feedback(cr, uid, ids, context=context) - map_url = "http://maps.google.com/maps?oi=map&q=" - body_vals = {'name': res_obj.name, - 'usr': mail_to, + map_url = "http://maps.google.com/maps?oi=map&q=" +# a = """
""" +# b = """
""" + +# attendee= """(%s) You, (%s) - Organizer
%s
""" % (a, res_obj.organizer,) + footer = '' + attendee = '' + for user in att: + #attendee = b + attendee + user + #print "List of ATtendeedss ---------------------->", attendee + body_vals = {'user': user, + 'name': res_obj.name, 'responsible': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', 'company': company, 'description': res_obj.description or '-', - 'attendees': res_obj.organizer + " - Organizer, " + attendees, + 'attendees': ', ' + .join(att_info), 'time': time, 'tz': tz, - 'location': res_obj.location or '-', - 'map' : map_url + '+' + str(res_obj.location or '-'), + 'location': res_obj.location or company_address, + 'map' : map_url + '+' + str(res_obj.location or company_address), 'organizer': res_obj.organizer, - 'url' : footer, - } + 'url' : footer, + } body_id = self.pool.get('email.template').search(cr, uid, [('subject', '=', 'Meeting Invitation')], context=context) body = self.pool.get('email.template').browse(cr, uid, body_id[0], context=context).body_html % body_vals - if mail_to and email_from: + if att[user] and email_from: ics_file = self.get_ics_file(cr, uid, res_obj, context=context) vals = {'email_from': email_from, - 'email_to': mail_to, + 'email_to': att[user], 'state': 'outgoing', 'subject': sub, 'body_html': body, diff --git a/addons/base_calendar/base_calendar_data.xml b/addons/base_calendar/base_calendar_data.xml index 4c207b3da10..771e2e071a8 100644 --- a/addons/base_calendar/base_calendar_data.xml +++ b/addons/base_calendar/base_calendar_data.xml @@ -149,58 +149,45 @@ %(name)s -
+
%(name)s
Hello %(usr)s ,
+ %(organizer)s invited you for the %(name)s meeting of %(company)s
+ + + + + + + + + + + + + + + + +
When :
%(time)s
%(tz)s
Where :
%(location)s
What :
%(description)s
Attendees:
%(attendees)s
Accept | Decline
Sent by %(responsible)s from %(company)s.View this meeting detail directly in OpenERP
- +
- - + - - - + + + +
+
%(name)s
Hello %(usr)s ,
- %(organizer)s invited you for the %(name)s meeting of %(company)s
Hello %(user)s,
+ %(organizer)s invited you for the %(name)s meeting of %(company)s.
- +
- - - + + - - - + + - - + + - - + +
When :
%(time)s
%(tz)s
When :
%(time)s (%(tz)s)
+
Where :
%(location)s
Where :
%(location)s (View Map)
What :
%(description)s
What :
%(description)s
Attendees:
%(attendees)s
Attendees:
You, %(organizer)s - Organizer
%(attendees)s
Accept | Decline
Sent by %(responsible)s from %(company)s.View this meeting detail directly in OpenERP
--
Sent by %(responsible)s from %(company)s.View this meeting detail directly in OpenERP
+ + + ]]>
From a42120b12d4555149c92eb0f0aefc91a48895179 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Thu, 30 May 2013 16:55:36 +0530 Subject: [PATCH 013/450] [IMP] improve code bzr revid: rma@tinyerp.com-20130530112536-ev91830ao6mepw4u --- addons/base_calendar/base_calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 5fe919e9f7a..da02fee6be6 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -451,7 +451,7 @@ property or property parameter."), 'responsible': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', 'company': company, 'description': res_obj.description or '-', - 'attendees': ', ' + .join(att_info), + 'attendees': ', ' .join(att_info), 'time': time, 'tz': tz, 'location': res_obj.location or company_address, From 176a45d841fa13fc4b482b012e3fd088c6d91a40 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Fri, 31 May 2013 14:45:53 +0530 Subject: [PATCH 014/450] [IMP] add the controller bzr revid: rma@tinyerp.com-20130531091553-efsa8zzm2qfk3585 --- addons/base_calendar/__init__.py | 1 + addons/base_calendar/__openerp__.py | 3 ++ addons/base_calendar/base_calendar.py | 41 +++++++++++++------ addons/base_calendar/base_calendar_data.xml | 2 +- addons/base_calendar/service.py | 17 ++++++++ .../static/src/js/base_calendar.js | 6 +++ 6 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 addons/base_calendar/service.py create mode 100644 addons/base_calendar/static/src/js/base_calendar.js diff --git a/addons/base_calendar/__init__.py b/addons/base_calendar/__init__.py index b6447567083..a736d491b0e 100644 --- a/addons/base_calendar/__init__.py +++ b/addons/base_calendar/__init__.py @@ -21,5 +21,6 @@ import base_calendar import crm_meeting +import service # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_calendar/__openerp__.py b/addons/base_calendar/__openerp__.py index 313ddb8453a..7d5b82a3cdf 100644 --- a/addons/base_calendar/__openerp__.py +++ b/addons/base_calendar/__openerp__.py @@ -47,6 +47,9 @@ If you need to manage your meetings, you should install the CRM module. 'base_calendar_data.xml', 'crm_meeting_data.xml', ], + 'js': [ + 'static/src/js/*.js' + ], 'test' : ['test/base_calendar_test.yml'], 'installable': True, 'application': True, diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index da02fee6be6..cfb4fe7ba21 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -31,7 +31,8 @@ import time from openerp import tools, SUPERUSER_ID import openerp.service.report - +from urllib import urlencode +from urlparse import urljoin months = { 1: "January", 2: "February", 3: "March", 4: "April", \ 5: "May", 6: "June", 7: "July", 8: "August", 9: "September", \ @@ -403,6 +404,25 @@ property or property parameter."), attendee_add.value = 'MAILTO:' + (attendee.email or '') res = cal.serialize() return res + def meeting_invitation(self, cr, uid, ids,context=None): + partner_obj = self.browse(cr,uid, ids,context=context) + for event_id in self.browse(cr, uid, ids, context): + event_id = event_id.ref.id + for partner in partner_obj: + if partner and partner.user_id: + related_user = partner.user_id + base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') + query = {'db': cr.dbname} + fragment = { + 'login': related_user.login, + 'model': "crm.meeting", + 'view_type' : "form", + 'res_id': event_id, + } + url = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment))) + else : + url = "https://openerp.my.openerp.com/#" + return url def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): """ @@ -411,7 +431,6 @@ property or property parameter."), @return: True """ company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name - company_address = self.pool.get('res.company').browse(cr, uid, uid, context=context).street for att in self.browse(cr, uid, ids, context=context): res_obj = att.ref if res_obj: @@ -436,16 +455,12 @@ property or property parameter."), time = date.strftime('%B-%d-%Y') + " at (" + date.strftime('%H-%M') + " To " + duration.strftime('%H-%M') + ")" else : time = date.strftime('%B-%d-%Y') + " at " + date.strftime('%H-%M') + " To \n" + date_deadline.strftime('%B-%d-%Y') + " at " + date_deadline.strftime('%H-%M') - map_url = "http://maps.google.com/maps?oi=map&q=" -# a = """

""" -# b = """
""" - -# attendee= """(%s) You, (%s) - Organizer
%s
""" % (a, res_obj.organizer,) - footer = '' - attendee = '' + footer = self.meeting_invitation(cr, uid, ids, context=context) + map = '' + if res_obj.location: + map_url = "http://maps.google.com/maps?oi=map&q=" + '+' + str(res_obj.location), + map = """ (View Map)""" % map_url for user in att: - #attendee = b + attendee + user - #print "List of ATtendeedss ---------------------->", attendee body_vals = {'user': user, 'name': res_obj.name, 'responsible': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', @@ -454,8 +469,8 @@ property or property parameter."), 'attendees': ', ' .join(att_info), 'time': time, 'tz': tz, - 'location': res_obj.location or company_address, - 'map' : map_url + '+' + str(res_obj.location or company_address), + 'location': res_obj.location or '-', + 'map' : map or '', 'organizer': res_obj.organizer, 'url' : footer, } diff --git a/addons/base_calendar/base_calendar_data.xml b/addons/base_calendar/base_calendar_data.xml index 771e2e071a8..80ec77ba6e0 100644 --- a/addons/base_calendar/base_calendar_data.xml +++ b/addons/base_calendar/base_calendar_data.xml @@ -167,7 +167,7 @@
Where :
-
%(location)s (View Map)
+
%(location)s %(map)s
What :
diff --git a/addons/base_calendar/service.py b/addons/base_calendar/service.py new file mode 100644 index 00000000000..0d6686f1f47 --- /dev/null +++ b/addons/base_calendar/service.py @@ -0,0 +1,17 @@ +import simplejson +import openerp.addons.web.http as oeweb +import openerp.addons.web.controllers.main as webmain + +class crm_meetting_importstatus(oeweb.Controller): + _cp_path = '/meeting' + @oeweb.httprequest + def meeting_invitation(self, req, dbname='test',res_id,uid): + url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') + safe_url = urllib.quote_plus(url,debname,res_id,uid,':/?&;=') + + return webmain.html_template % { + 'js': "\n ".join('' % i for i in webmain.manifest_list(req, 'js',db= db)), + 'css': "\n ".join('' % i for i in webmain.manifest_list(req, 'css', db=db)), + 'modules': simplejson.dumps(webmain.module_boot(req, db)), + 'init': 'var wc = new s.web.WebClient();wc.appendTo($(document.body)); s.base_calendar.meeting_invitation();' + } diff --git a/addons/base_calendar/static/src/js/base_calendar.js b/addons/base_calendar/static/src/js/base_calendar.js new file mode 100644 index 00000000000..0c7642bdf0b --- /dev/null +++ b/addons/base_calendar/static/src/js/base_calendar.js @@ -0,0 +1,6 @@ +openerp.base_calendar = function(openerp) { + + openerp.base_calendar.meeting_invitation = function(){ + console.log("daaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + } +}; From 5cf8cef63d1450aaf3bb6b65f5d020409a247290 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Fri, 31 May 2013 16:46:18 +0530 Subject: [PATCH 015/450] [IMP] remove extra code bzr revid: rma@tinyerp.com-20130531111618-d6y2o446c6ad1fuf --- addons/base_calendar/service.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/base_calendar/service.py b/addons/base_calendar/service.py index 0d6686f1f47..0d781ddbe0d 100644 --- a/addons/base_calendar/service.py +++ b/addons/base_calendar/service.py @@ -5,10 +5,7 @@ import openerp.addons.web.controllers.main as webmain class crm_meetting_importstatus(oeweb.Controller): _cp_path = '/meeting' @oeweb.httprequest - def meeting_invitation(self, req, dbname='test',res_id,uid): - url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') - safe_url = urllib.quote_plus(url,debname,res_id,uid,':/?&;=') - + def meeting_invitation(self, req, db='may_29'): return webmain.html_template % { 'js': "\n ".join('' % i for i in webmain.manifest_list(req, 'js',db= db)), 'css': "\n ".join('' % i for i in webmain.manifest_list(req, 'css', db=db)), From f0151cd6e4c918dab3edfe5856371bae36d79b4e Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Wed, 5 Jun 2013 15:23:42 +0530 Subject: [PATCH 016/450] [FIX]Fixed the issue of search on tranlsated field, search on tranlsated field fails due to expression parsing which fetches ids from ir_translation as well as working table and UNION of this makes search fruitless, also search fails for in language other then english when you enter part of a string for the field to search. bzr revid: msh@openerp.com-20130605095342-314zfmttymx1k86a --- openerp/osv/expression.py | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 58f35149ddd..b2184f73753 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -1020,37 +1020,32 @@ class expression(object): elif field.translate: need_wildcard = operator in ('like', 'ilike', 'not like', 'not ilike') sql_operator = {'=like': 'like', '=ilike': 'ilike'}.get(operator, operator) + instr = ' %s' if need_wildcard: right = '%%%s%%' % right - subselect = '( SELECT res_id' \ - ' FROM ir_translation' \ - ' WHERE name = %s' \ - ' AND lang = %s' \ - ' AND type = %s' - instr = ' %s' + select = 'WITH temp_'+working_model._table+' (id, name) as (' \ + 'SELECT wt.id, coalesce(it.value,wt.name) ' \ + 'FROM '+working_model._table+' wt ' \ + 'LEFT JOIN ir_translation it ON (it.name = %s and ' \ + 'it.lang = %s and ' \ + 'it.type = %s and ' \ + 'it.res_id = wt.id and ' \ + "it.value != '')" \ + ') ' #Covering in,not in operators with operands (%s,%s) ,etc. if sql_operator in ['in', 'not in']: instr = ','.join(['%s'] * len(right)) - subselect += ' AND value ' + sql_operator + ' ' + " (" + instr + ")" \ - ') UNION (' \ - ' SELECT id' \ - ' FROM "' + working_model._table + '"' \ - ' WHERE "' + left + '" ' + sql_operator + ' ' + " (" + instr + "))" + select += 'SELECT id FROM temp_'+working_model._table+' WHERE "name" '+sql_operator+' ('+instr+') order by name' else: - subselect += ' AND value ' + sql_operator + instr + \ - ') UNION (' \ - ' SELECT id' \ - ' FROM "' + working_model._table + '"' \ - ' WHERE "' + left + '" ' + sql_operator + instr + ")" + select += 'SELECT id FROM temp_'+working_model._table+' WHERE "name" '+sql_operator+' '+instr+' order by name' params = [working_model._name + ',' + left, context.get('lang', False) or 'en_US', 'model', right, - right, ] - push(create_substitution_leaf(leaf, ('id', 'inselect', (subselect, params)), working_model)) + push(create_substitution_leaf(leaf, ('id', 'inselect', (select, params)), working_model)) else: push_result(leaf) From 78619253d2189f1c747f9dc07818ceedc5cd8d22 Mon Sep 17 00:00:00 2001 From: "Nimesh Contractor (OpenERP)" Date: Fri, 21 Jun 2013 11:53:45 +0530 Subject: [PATCH 017/450] [IMP] set ids. bzr revid: nco@tinyerp.com-20130621062345-4aqhvuzxn6godrym --- addons/base_calendar/base_calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 30d5e7f4f88..6a0ed583684 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -587,7 +587,7 @@ property or property parameter."), """ if context is None: context = {} - return self.write(cr, uid, vals.id, {'state': 'accepted'}, context) + return self.write(cr, uid, ids, {'state': 'accepted'}, context) def do_decline(self, cr, uid, ids, context=None, *args): """ From a116468ccf92ef750a5f239915df56c8315a66d2 Mon Sep 17 00:00:00 2001 From: "Mahendra Barad (OpenERP Trainee)" Date: Fri, 21 Jun 2013 15:45:35 +0530 Subject: [PATCH 018/450] [IMP] if internal user than invitation state goes to accepted. bzr revid: nco@tinyerp.com-20130621101535-01ds8rdbeof4tbbv --- addons/base_calendar/base_calendar.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 6a0ed583684..960fa946e53 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -619,6 +619,8 @@ property or property parameter."), email = filter(lambda x:x.__contains__('@'), cnval) vals['email'] = email and email[0] or '' vals['cn'] = vals.get("cn") + if vals.get('user_id'): + vals['state'] = 'accepted' res = super(calendar_attendee, self).create(cr, uid, vals, context=context) return res From 899a60b616b6d55ca3871b430fedb940ea3251ba Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Thu, 27 Jun 2013 16:12:06 +0530 Subject: [PATCH 019/450] [ADD]: Make url for invitation -> When session validate do_accept/do_reject -> Make post in chatter accept/reject -> Show calender view. bzr revid: aja@tinyerp.com-20130627104206-t8eyclekx3f9mmia --- addons/base_calendar/__init__.py | 2 +- addons/base_calendar/base_calendar.py | 33 ++++----- addons/base_calendar/base_calendar_data.xml | 2 +- addons/base_calendar/controllers/__init__.py | 3 + addons/base_calendar/controllers/main.py | 22 ++++++ addons/base_calendar/crm_meeting_view.xml | 4 + addons/base_calendar/service.py | 14 ---- .../static/src/js/base_calendar.js | 73 +++++++++++++++++-- 8 files changed, 114 insertions(+), 39 deletions(-) create mode 100644 addons/base_calendar/controllers/__init__.py create mode 100644 addons/base_calendar/controllers/main.py delete mode 100644 addons/base_calendar/service.py diff --git a/addons/base_calendar/__init__.py b/addons/base_calendar/__init__.py index a736d491b0e..425fb2ed375 100644 --- a/addons/base_calendar/__init__.py +++ b/addons/base_calendar/__init__.py @@ -21,6 +21,6 @@ import base_calendar import crm_meeting -import service +import controllers # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index cfb4fe7ba21..205ad1ca3dc 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -404,25 +404,17 @@ property or property parameter."), attendee_add.value = 'MAILTO:' + (attendee.email or '') res = cal.serialize() return res + def meeting_invitation(self, cr, uid, ids,context=None): partner_obj = self.browse(cr,uid, ids,context=context) - for event_id in self.browse(cr, uid, ids, context): - event_id = event_id.ref.id + action_id=self.pool.get('ir.actions.act_window').search(cr, uid, [('res_model','=','crm.meeting')], context=context) + base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context) for partner in partner_obj: - if partner and partner.user_id: - related_user = partner.user_id - base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') - query = {'db': cr.dbname} - fragment = { - 'login': related_user.login, - 'model': "crm.meeting", - 'view_type' : "form", - 'res_id': event_id, - } - url = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment))) + if partner and partner.ref.user_id: + base_url += '/meeting/meeting_invitation?db=%s&debug=&token=%s&action=%s' % (cr.dbname, ids[0],action_id[0]); else : - url = "https://openerp.my.openerp.com/#" - return url + base_url += "/auth_signup" + return base_url def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): """ @@ -532,15 +524,16 @@ property or property parameter."), """ if context is None: context = {} - + meeting_obj = self.pool.get('crm.meeting') for vals in self.browse(cr, uid, ids, context=context): if vals.ref and vals.ref.user_id: mod_obj = self.pool[vals.ref._name] res=mod_obj.read(cr,uid,[vals.ref.id],['duration','class'],context) defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']} - mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) +# mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) + meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) + meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Accept the meeting") % (vals.cn)), context=context) self.write(cr, uid, vals.id, {'state': 'accepted'}, context) - return True def do_decline(self, cr, uid, ids, context=None, *args): @@ -555,6 +548,10 @@ property or property parameter."), """ if context is None: context = {} + meeting_obj = self.pool.get('crm.meeting') + vals=self.browse(cr, uid, ids, context=context)[0] + meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) + meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Reject the meeting") % (vals.cn)), context=context) return self.write(cr, uid, ids, {'state': 'declined'}, context) def create(self, cr, uid, vals, context=None): diff --git a/addons/base_calendar/base_calendar_data.xml b/addons/base_calendar/base_calendar_data.xml index 80ec77ba6e0..bb9a51b2ae3 100644 --- a/addons/base_calendar/base_calendar_data.xml +++ b/addons/base_calendar/base_calendar_data.xml @@ -177,7 +177,7 @@
You, %(organizer)s - Organizer
%(attendees)s
- +
--
Sent by %(responsible)s from %(company)s.View this meeting detail directly in OpenERP
diff --git a/addons/base_calendar/controllers/__init__.py b/addons/base_calendar/controllers/__init__.py new file mode 100644 index 00000000000..9f828025b8e --- /dev/null +++ b/addons/base_calendar/controllers/__init__.py @@ -0,0 +1,3 @@ +import main + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_calendar/controllers/main.py b/addons/base_calendar/controllers/main.py new file mode 100644 index 00000000000..4762ededd05 --- /dev/null +++ b/addons/base_calendar/controllers/main.py @@ -0,0 +1,22 @@ +import simplejson +import urllib +import openerp.addons.web.http as oeweb +import openerp.addons.web.controllers.main as webmain + +class crm_meetting_importstatus(oeweb.Controller): + _cp_path = '/meeting' + + @oeweb.httprequest + def meeting_invitation(self, req, db, token, action, status): + print 'FFFFFFFFFFFFF' + js = "\n ".join('' % i for i in webmain.manifest_list(req,'js', db=db)) + css = "\n ".join('' % i for i in webmain.manifest_list(req,'css',db=db)) + + return webmain.html_template % { + 'js': js, + 'css': css, + 'modules': simplejson.dumps(webmain.module_boot(req, db)), + 'init': 's.base_calendar.do_accept("%s","%s", "%s", "%s");'% (db,token,action,status), + } + + diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml index d9b659b91fa..4298b193ea7 100644 --- a/addons/base_calendar/crm_meeting_view.xml +++ b/addons/base_calendar/crm_meeting_view.xml @@ -181,6 +181,10 @@ +
+ + +
diff --git a/addons/base_calendar/service.py b/addons/base_calendar/service.py deleted file mode 100644 index 0d781ddbe0d..00000000000 --- a/addons/base_calendar/service.py +++ /dev/null @@ -1,14 +0,0 @@ -import simplejson -import openerp.addons.web.http as oeweb -import openerp.addons.web.controllers.main as webmain - -class crm_meetting_importstatus(oeweb.Controller): - _cp_path = '/meeting' - @oeweb.httprequest - def meeting_invitation(self, req, db='may_29'): - return webmain.html_template % { - 'js': "\n ".join('' % i for i in webmain.manifest_list(req, 'js',db= db)), - 'css': "\n ".join('' % i for i in webmain.manifest_list(req, 'css', db=db)), - 'modules': simplejson.dumps(webmain.module_boot(req, db)), - 'init': 'var wc = new s.web.WebClient();wc.appendTo($(document.body)); s.base_calendar.meeting_invitation();' - } diff --git a/addons/base_calendar/static/src/js/base_calendar.js b/addons/base_calendar/static/src/js/base_calendar.js index 0c7642bdf0b..f3c40537f0b 100644 --- a/addons/base_calendar/static/src/js/base_calendar.js +++ b/addons/base_calendar/static/src/js/base_calendar.js @@ -1,6 +1,69 @@ -openerp.base_calendar = function(openerp) { - - openerp.base_calendar.meeting_invitation = function(){ - console.log("daaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - } +openerp.base_calendar = function(instance) { +var _t = instance.web._t; +instance.base_calendar = {} + + instance.base_calendar.DoAccept = instance.web.Widget.extend({ + + init: function(parent,db,token,action,status) { + this._super(); + this.db = db; + this.token = token; + this.status = status; + this.action = action; + this.ds_attendee = new instance.web.DataSetSearch(this, 'calendar.attendee'); + }, + start: function() { + var self = this; + if (instance.session.session_is_valid(self.db)) { + self.show_meeting(); + } else { + self.show_login() + } + }, + show_login: function(action) { + var self = this; + this.destroy_content(); + this.login = new instance.web.Login_extended(this,self.action); + this.login.appendTo(this.$el); + this.login.on('db_loaded',self,function(db,login){ + if (instance.session.session_is_valid(db)) { + (self.show_meeting()).done(function(){ + self.login.off('db_loaded'); + }); + } + else{ + self.show_login(); + } + }) + }, + destroy_content: function() { + _.each(_.clone(this.getChildren()), function(el) { + el.destroy(); + }); + this.$el.children().remove(); + }, + show_meeting : function(){ + var db = this.db; + var att_status = "do_decline"; + var self = this; + if(self.status === 'accepted'){att_status = "do_accept";} + return this.ds_attendee.call(att_status,[[parseInt(this.token)]]).done(function(res){ + location.replace(_.str.sprintf('/?db=%s&debug=#view_type=calendar&model=crm.meeting&action=%s',self.db,self.action)); + }); + }, + }); + instance.web.Login_extended = instance.web.Login.extend({ + do_login: function (db, login, password) { + var self = this; + (this._super.apply(this,arguments)).done(function(){ + self.trigger('db_loaded',db,login) + }); + } + }); + instance.base_calendar.do_accept = function (db, token, action, status) { + instance.session.session_bind(instance.session.origin).done(function () { + new instance.base_calendar.DoAccept(null,db,token,action,status).appendTo($("body").addClass('openerp')); + }); + } }; +//vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: From 102e8a188bb600fae8fa9489e7f255390ba8d216 Mon Sep 17 00:00:00 2001 From: "Nimesh Contractor (OpenERP)" Date: Mon, 1 Jul 2013 18:21:16 +0530 Subject: [PATCH 020/450] [IMP] improve code. bzr revid: nco@tinyerp.com-20130701125116-2b8mqhlbw7gn3861 --- addons/base_calendar/crm_meeting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_calendar/crm_meeting.py b/addons/base_calendar/crm_meeting.py index 1d623b20eb8..fbb41fb230a 100644 --- a/addons/base_calendar/crm_meeting.py +++ b/addons/base_calendar/crm_meeting.py @@ -67,8 +67,8 @@ class crm_meeting(base_state, osv.Model): } def search(self, cr, uid, args, offset=0, limit=0, order=None, context=None, count=False): - partner_id = self.pool.get('res.users').browse(cr, uid, uid, context).partner_id.id if context.get('mymeetings',False): + partner_id = self.pool.get('res.users').browse(cr, uid, uid, context).partner_id.id args.append('|') args.append(['partner_ids', 'in', partner_id]) args.append(['user_id', '=', uid]) From 89ceb878fa9f88b2346ceb0320cb5f642c2726cf Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Tue, 2 Jul 2013 10:45:22 +0530 Subject: [PATCH 021/450] [IMP]: Improve search method bzr revid: atp@tinyerp.com-20130702051522-jpqh6bkyrbl2gjuc --- addons/base_calendar/crm_meeting.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/base_calendar/crm_meeting.py b/addons/base_calendar/crm_meeting.py index fbb41fb230a..c537472c61c 100644 --- a/addons/base_calendar/crm_meeting.py +++ b/addons/base_calendar/crm_meeting.py @@ -69,11 +69,8 @@ class crm_meeting(base_state, osv.Model): def search(self, cr, uid, args, offset=0, limit=0, order=None, context=None, count=False): if context.get('mymeetings',False): partner_id = self.pool.get('res.users').browse(cr, uid, uid, context).partner_id.id - args.append('|') - args.append(['partner_ids', 'in', partner_id]) - args.append(['user_id', '=', uid]) - ids = super(crm_meeting, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) - return ids + args += ['|', ('partner_ids', 'in', [partner_id]), ('user_id', '=', uid)] + return super(crm_meeting, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) def message_get_subscription_data(self, cr, uid, ids, context=None): res = {} From 055d01f69fb3abb487cef1f698eecccdfc24b426 Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Wed, 3 Jul 2013 11:37:54 +0530 Subject: [PATCH 022/450] [IMP]: code and http request handler bzr revid: aja@tinyerp.com-20130703060754-eky7zik1wskq9738 --- addons/base_calendar/base_calendar.py | 13 +++++-------- addons/base_calendar/controllers/main.py | 17 ++++++++--------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 205ad1ca3dc..c614268ca07 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -405,15 +405,12 @@ property or property parameter."), res = cal.serialize() return res - def meeting_invitation(self, cr, uid, ids,context=None): - partner_obj = self.browse(cr,uid, ids,context=context) - action_id=self.pool.get('ir.actions.act_window').search(cr, uid, [('res_model','=','crm.meeting')], context=context) + def meeting_invitation(self, cr, uid, ids, context=None): + attende_obj = self.browse(cr, uid, ids, context=context) + action_id = self.pool.get('ir.actions.act_window').search(cr, uid, [('res_model','=','crm.meeting')], context=context) base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context) - for partner in partner_obj: - if partner and partner.ref.user_id: - base_url += '/meeting/meeting_invitation?db=%s&debug=&token=%s&action=%s' % (cr.dbname, ids[0],action_id[0]); - else : - base_url += "/auth_signup" + for attende in attende_obj: + base_url += '/meeting/meeting_invitation?db=%s&debug=&token=%s&action=%s' % (cr.dbname, ids[0],action_id[0]); return base_url def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): diff --git a/addons/base_calendar/controllers/main.py b/addons/base_calendar/controllers/main.py index 4762ededd05..0ddff888cd8 100644 --- a/addons/base_calendar/controllers/main.py +++ b/addons/base_calendar/controllers/main.py @@ -1,21 +1,20 @@ import simplejson import urllib -import openerp.addons.web.http as oeweb +import openerp.addons.web.http as http +from openerp.addons.web.http import request import openerp.addons.web.controllers.main as webmain -class crm_meetting_importstatus(oeweb.Controller): - _cp_path = '/meeting' +class crm_meetting_importstatus(http.Controller): - @oeweb.httprequest - def meeting_invitation(self, req, db, token, action, status): - print 'FFFFFFFFFFFFF' - js = "\n ".join('' % i for i in webmain.manifest_list(req,'js', db=db)) - css = "\n ".join('' % i for i in webmain.manifest_list(req,'css',db=db)) + @http.route('/meeting/meeting_invitation', type='http', auth="none") + def meeting_invitation(self, db, token, action, status): + js = "\n ".join('' % i for i in webmain.manifest_list('js', db=db)) + css = "\n ".join('' % i for i in webmain.manifest_list('css',db=db)) return webmain.html_template % { 'js': js, 'css': css, - 'modules': simplejson.dumps(webmain.module_boot(req, db)), + 'modules': simplejson.dumps(webmain.module_boot(db)), 'init': 's.base_calendar.do_accept("%s","%s", "%s", "%s");'% (db,token,action,status), } From 359df13e24d3cf634159dbf0caa7ea4008cd567b Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Wed, 3 Jul 2013 12:23:54 +0530 Subject: [PATCH 023/450] [IMP]: directly to openerp open form view, accept and decline open calender view bzr revid: aja@tinyerp.com-20130703065354-v5kt8symd44n648a --- addons/base_calendar/base_calendar_data.xml | 4 ++-- addons/base_calendar/controllers/main.py | 4 ++-- addons/base_calendar/static/src/js/base_calendar.js | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/base_calendar/base_calendar_data.xml b/addons/base_calendar/base_calendar_data.xml index bb9a51b2ae3..0f58f52c202 100644 --- a/addons/base_calendar/base_calendar_data.xml +++ b/addons/base_calendar/base_calendar_data.xml @@ -177,9 +177,9 @@
You, %(organizer)s - Organizer
%(attendees)s
- + -
--
Sent by %(responsible)s from %(company)s.View this meeting detail directly in OpenERP
+
--
Sent by %(responsible)s from %(company)s.View this meeting detail directly in OpenERP
diff --git a/addons/base_calendar/controllers/main.py b/addons/base_calendar/controllers/main.py index 0ddff888cd8..4bc690833f8 100644 --- a/addons/base_calendar/controllers/main.py +++ b/addons/base_calendar/controllers/main.py @@ -7,7 +7,7 @@ import openerp.addons.web.controllers.main as webmain class crm_meetting_importstatus(http.Controller): @http.route('/meeting/meeting_invitation', type='http', auth="none") - def meeting_invitation(self, db, token, action, status): + def meeting_invitation(self, db, token, action, view_type, status): js = "\n ".join('' % i for i in webmain.manifest_list('js', db=db)) css = "\n ".join('' % i for i in webmain.manifest_list('css',db=db)) @@ -15,7 +15,7 @@ class crm_meetting_importstatus(http.Controller): 'js': js, 'css': css, 'modules': simplejson.dumps(webmain.module_boot(db)), - 'init': 's.base_calendar.do_accept("%s","%s", "%s", "%s");'% (db,token,action,status), + 'init': 's.base_calendar.do_accept("%s", "%s", "%s", "%s", "%s");'% (db, token, action, view_type, status), } diff --git a/addons/base_calendar/static/src/js/base_calendar.js b/addons/base_calendar/static/src/js/base_calendar.js index f3c40537f0b..5ac24e7c23e 100644 --- a/addons/base_calendar/static/src/js/base_calendar.js +++ b/addons/base_calendar/static/src/js/base_calendar.js @@ -4,12 +4,13 @@ instance.base_calendar = {} instance.base_calendar.DoAccept = instance.web.Widget.extend({ - init: function(parent,db,token,action,status) { + init: function(parent,db,token,action,view_type,status) { this._super(); this.db = db; this.token = token; this.status = status; this.action = action; + this.view_type = view_type; this.ds_attendee = new instance.web.DataSetSearch(this, 'calendar.attendee'); }, start: function() { @@ -48,7 +49,7 @@ instance.base_calendar = {} var self = this; if(self.status === 'accepted'){att_status = "do_accept";} return this.ds_attendee.call(att_status,[[parseInt(this.token)]]).done(function(res){ - location.replace(_.str.sprintf('/?db=%s&debug=#view_type=calendar&model=crm.meeting&action=%s',self.db,self.action)); + location.replace(_.str.sprintf('/?db=%s&debug=#view_type=%s&model=crm.meeting&action=%s&active_id=%s',self.db,self.view_type,self.action,self.token)); }); }, }); @@ -60,9 +61,9 @@ instance.base_calendar = {} }); } }); - instance.base_calendar.do_accept = function (db, token, action, status) { + instance.base_calendar.do_accept = function (db, token, action, view_type, status) { instance.session.session_bind(instance.session.origin).done(function () { - new instance.base_calendar.DoAccept(null,db,token,action,status).appendTo($("body").addClass('openerp')); + new instance.base_calendar.DoAccept(null,db,token,action,view_type,status).appendTo($("body").addClass('openerp')); }); } }; From 17df44b67e39dbf563ebfa6a5dacc5abd2d88e8b Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Wed, 3 Jul 2013 12:49:02 +0530 Subject: [PATCH 024/450] [REM]: code comment bzr revid: aja@tinyerp.com-20130703071902-sxtu4n3mdqxi5e0w --- addons/base_calendar/base_calendar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index c614268ca07..29563633896 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -527,7 +527,7 @@ property or property parameter."), mod_obj = self.pool[vals.ref._name] res=mod_obj.read(cr,uid,[vals.ref.id],['duration','class'],context) defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']} -# mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) + mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Accept the meeting") % (vals.cn)), context=context) self.write(cr, uid, vals.id, {'state': 'accepted'}, context) From 4276270bbb2a0c0f21203193fa5fd6f6f4ac5810 Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Wed, 3 Jul 2013 16:30:39 +0530 Subject: [PATCH 025/450] [IMP]: code bzr revid: aja@tinyerp.com-20130703110039-uq8g9jzeyhh6t8nz --- addons/base_calendar/base_calendar.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 29563633896..6720b4d3e4a 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -529,7 +529,8 @@ property or property parameter."), defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']} mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) - meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Accept the meeting") % (vals.cn)), context=context) + if meeting_id: + meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Accept the meeting") % (vals.cn)), context=context) self.write(cr, uid, vals.id, {'state': 'accepted'}, context) return True From 62035e967e613c944a6dcff851225811b3ed7b57 Mon Sep 17 00:00:00 2001 From: "Ravi Gohil (OpenERP)" Date: Wed, 3 Jul 2013 16:40:59 +0530 Subject: [PATCH 026/450] [FIX] plugin: Email pushed using Outlook plugin does not have body content. (Maintenance Case: 593592) bzr revid: rgo@tinyerp.com-20130703111059-rphs9m0twt5w1me2 --- addons/plugin/plugin_handler.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index aa389611a57..b1cd4970cf7 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -4,6 +4,7 @@ Created on 18 oct. 2011 @author: openerp ''' +from openerp import tools from openerp.osv import osv from openerp.tools.translate import _ @@ -94,7 +95,7 @@ class plugin_handler(osv.osv_memory): mail_message = self.pool.get('mail.message') model_obj = self.pool.get(model) msg = self.pool.get('mail.thread').message_parse(cr, uid, email) - message_id = msg.get('message-id') + message_id = msg.get('message_id') mail_ids = mail_message.search(cr, uid, [('message_id', '=', message_id), ('res_id', '=', res_id), ('model', '=', model)]) if message_id and mail_ids: mail_record = mail_message.browse(cr, uid, mail_ids)[0] @@ -112,7 +113,8 @@ class plugin_handler(osv.osv_memory): subject=msg.get('subject'), type='comment' if model == 'res.partner' else 'email', parent_id=msg.get('parent_id'), - attachments=msg.get('attachments')) + attachments=msg.get('attachments'), + message_id=message_id) notify = _("Mail successfully pushed") url = self._make_url(cr, uid, res_id, model) return (model, res_id, url, notify) @@ -151,7 +153,7 @@ class plugin_handler(osv.osv_memory): ir_attachment_obj = self.pool.get('ir.attachment') attach_ids = [] msg = self.pool.get('mail.thread').message_parse(cr, uid, headers) - message_id = msg.get('message-id') + message_id = msg.get('message_id') push_mail = self.push_message(cr, uid, model, headers, res_id) res_id = push_mail[1] model = push_mail[0] @@ -165,6 +167,6 @@ class plugin_handler(osv.osv_memory): attach_ids.append(ir_attachment_obj.create(cr, uid, vals)) mail_ids = mail_message.search(cr, uid, [('message_id', '=', message_id), ('res_id', '=', res_id), ('model', '=', model)]) if mail_ids: - mail_message.write(cr, uid, mail_ids[0], {'attachment_ids': [(6, 0, attach_ids)], 'body': body, 'body_html': body_html}) + mail_message.write(cr, uid, mail_ids[0], {'attachment_ids': [(6, 0, attach_ids)], 'body': tools.plaintext2html(body), 'body_html': body_html}) url = self._make_url(cr, uid, res_id, model) return (model, res_id, url, notify) From e3e97c35d3b89d3e3d1a3be68ed820b82bdab36a Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Fri, 5 Jul 2013 13:04:36 +0530 Subject: [PATCH 027/450] [IMP]: code for send invitation mail. [REM]: copy of invitation when do_accept call ,instead that create a record rule loged in user only able to see his/her invitation line and can able to accept/decline that invitation bzr revid: aja@tinyerp.com-20130705073436-qlbnomlfh1755c36 --- addons/base_calendar/base_calendar.py | 93 +++++++++---------- .../security/calendar_security.xml | 6 ++ 2 files changed, 49 insertions(+), 50 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 6720b4d3e4a..6e2152be9a2 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -409,8 +409,8 @@ property or property parameter."), attende_obj = self.browse(cr, uid, ids, context=context) action_id = self.pool.get('ir.actions.act_window').search(cr, uid, [('res_model','=','crm.meeting')], context=context) base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context) - for attende in attende_obj: - base_url += '/meeting/meeting_invitation?db=%s&debug=&token=%s&action=%s' % (cr.dbname, ids[0],action_id[0]); + if action_id: + base_url += '/meeting/meeting_invitation?db=%s&debug=&token=%s&action=%s' % (cr.dbname, ids,action_id[0]); return base_url def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): @@ -420,8 +420,9 @@ property or property parameter."), @return: True """ company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name - for att in self.browse(cr, uid, ids, context=context): - res_obj = att.ref + mail_id = [] + for attendee in self.browse(cr, uid, ids, context=context): + res_obj = attendee.ref if res_obj: att = {} att_info = [] @@ -430,8 +431,6 @@ property or property parameter."), for att2 in self.browse(cr, uid, other_invitation_ids): att_info.append(att2.user_id and att2.user_id.name or att2.partner_id and att2.partner_id.name or att2.email) - att[att2.user_id and att2.user_id.name or att2.partner_id and att2.partner_id.name or att2.email] = att2.email - tz = context.get('tz', pytz.timezone('UTC')) allday = False date = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context) @@ -444,42 +443,39 @@ property or property parameter."), time = date.strftime('%B-%d-%Y') + " at (" + date.strftime('%H-%M') + " To " + duration.strftime('%H-%M') + ")" else : time = date.strftime('%B-%d-%Y') + " at " + date.strftime('%H-%M') + " To \n" + date_deadline.strftime('%B-%d-%Y') + " at " + date_deadline.strftime('%H-%M') - footer = self.meeting_invitation(cr, uid, ids, context=context) - map = '' + footer = self.meeting_invitation(cr, uid, attendee.id, context=context) + map_url = '' if res_obj.location: - map_url = "http://maps.google.com/maps?oi=map&q=" + '+' + str(res_obj.location), - map = """ (View Map)""" % map_url - for user in att: - body_vals = {'user': user, - 'name': res_obj.name, - 'responsible': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', - 'company': company, - 'description': res_obj.description or '-', - 'attendees': ', ' .join(att_info), - 'time': time, - 'tz': tz, - 'location': res_obj.location or '-', - 'map' : map or '', - 'organizer': res_obj.organizer, - 'url' : footer, - } - body_id = self.pool.get('email.template').search(cr, uid, [('subject', '=', 'Meeting Invitation')], context=context) - body = self.pool.get('email.template').browse(cr, uid, body_id[0], context=context).body_html % body_vals - if att[user] and email_from: - ics_file = self.get_ics_file(cr, uid, res_obj, context=context) - vals = {'email_from': email_from, - 'email_to': att[user], - 'state': 'outgoing', - 'subject': sub, - 'body_html': body, - 'auto_delete': True} + map_url = """ (View Map)""" % res_obj.location + body_vals = {'user':attendee.user_id and attendee.user_id.name, + 'name': res_obj.name, + 'responsible': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', + 'company': company, + 'description': res_obj.description or '-', + 'attendees': ', ' .join(att_info), + 'time': time, + 'tz': tz, + 'location': res_obj.location or '-', + 'map' : map_url or '', + 'organizer': res_obj.organizer, + 'url' : footer} + body_id = self.pool.get('email.template').search(cr, uid, [('subject', '=', 'Meeting Invitation')], context=context) + body = self.pool.get('email.template').browse(cr, uid, body_id[0], context=context).body_html % body_vals + if attendee.email and email_from: + ics_file = self.get_ics_file(cr, uid, res_obj, context=context) + vals = {'email_from': email_from, + 'email_to': attendee.email, + 'state': 'outgoing', + 'subject': sub, + 'body_html': body, + 'auto_delete': True} if ics_file: vals['attachment_ids'] = [(0,0,{'name': 'invitation.ics', - 'datas_fname': 'invitation.ics', - 'datas': str(ics_file).encode('base64')})] - mail_id= self.pool.get('mail.mail').create(cr, uid, vals, context=context) - self.pool.get('mail.mail').send(cr, uid, [mail_id], context=context) - return True + 'datas_fname': 'invitation.ics', + 'datas': str(ics_file).encode('base64')})] + mail_id.append(self.pool.get('mail.mail').create(cr, uid, vals, context=context)) + self.pool.get('mail.mail').send(cr, uid, mail_id, context=context) + return True def onchange_user_id(self, cr, uid, ids, user_id, *args, **argv): """ @@ -523,14 +519,9 @@ property or property parameter."), context = {} meeting_obj = self.pool.get('crm.meeting') for vals in self.browse(cr, uid, ids, context=context): - if vals.ref and vals.ref.user_id: - mod_obj = self.pool[vals.ref._name] - res=mod_obj.read(cr,uid,[vals.ref.id],['duration','class'],context) - defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']} - mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context) meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) if meeting_id: - meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Accept the meeting") % (vals.cn)), context=context) + meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s Accept Invitation") % (vals.cn)), context=context) self.write(cr, uid, vals.id, {'state': 'accepted'}, context) return True @@ -546,11 +537,13 @@ property or property parameter."), """ if context is None: context = {} - meeting_obj = self.pool.get('crm.meeting') - vals=self.browse(cr, uid, ids, context=context)[0] - meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) - meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Reject the meeting") % (vals.cn)), context=context) - return self.write(cr, uid, ids, {'state': 'declined'}, context) + meeting_obj = self.pool.get('crm.meeting') + for vals in self.browse(cr, uid, ids, context=context): + meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) + if meeting_id: + meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s Reject Invitation") % (vals.cn)), context=context) + self.write(cr, uid, vals.id, {'state': 'declined'}, context) + return True def create(self, cr, uid, vals, context=None): """ diff --git a/addons/base_calendar/security/calendar_security.xml b/addons/base_calendar/security/calendar_security.xml index dbc493c73f4..5fa6fcc8e85 100644 --- a/addons/base_calendar/security/calendar_security.xml +++ b/addons/base_calendar/security/calendar_security.xml @@ -5,5 +5,11 @@ Survey / User + + Show Only Personal Invitation + + + [('user_id','=',user.id)] + From 05544e1522cb1b72f21981594fb14691d73f7290 Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Fri, 5 Jul 2013 18:49:28 +0530 Subject: [PATCH 028/450] [REM][IMP]: Unwanted import statement and improve code bzr revid: aja@tinyerp.com-20130705131928-1za77dhq23vtge53 --- addons/base_calendar/base_calendar.py | 2 -- addons/base_calendar/controllers/main.py | 2 +- addons/base_calendar/static/src/js/base_calendar.js | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 1823deeabdf..53dadecd437 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -31,8 +31,6 @@ import time from openerp import tools, SUPERUSER_ID import openerp.service.report -from urllib import urlencode -from urlparse import urljoin months = { 1: "January", 2: "February", 3: "March", 4: "April", \ 5: "May", 6: "June", 7: "July", 8: "August", 9: "September", \ diff --git a/addons/base_calendar/controllers/main.py b/addons/base_calendar/controllers/main.py index 4bc690833f8..599e602b180 100644 --- a/addons/base_calendar/controllers/main.py +++ b/addons/base_calendar/controllers/main.py @@ -15,7 +15,7 @@ class crm_meetting_importstatus(http.Controller): 'js': js, 'css': css, 'modules': simplejson.dumps(webmain.module_boot(db)), - 'init': 's.base_calendar.do_accept("%s", "%s", "%s", "%s", "%s");'% (db, token, action, view_type, status), + 'init': 's.base_calendar.event("%s", "%s", "%s", "%s", "%s");'% (db, token, action, view_type, status), } diff --git a/addons/base_calendar/static/src/js/base_calendar.js b/addons/base_calendar/static/src/js/base_calendar.js index 5ac24e7c23e..196ac0e424b 100644 --- a/addons/base_calendar/static/src/js/base_calendar.js +++ b/addons/base_calendar/static/src/js/base_calendar.js @@ -2,7 +2,7 @@ openerp.base_calendar = function(instance) { var _t = instance.web._t; instance.base_calendar = {} - instance.base_calendar.DoAccept = instance.web.Widget.extend({ + instance.base_calendar.invite = instance.web.Widget.extend({ init: function(parent,db,token,action,view_type,status) { this._super(); @@ -61,9 +61,9 @@ instance.base_calendar = {} }); } }); - instance.base_calendar.do_accept = function (db, token, action, view_type, status) { + instance.base_calendar.event = function (db, token, action, view_type, status) { instance.session.session_bind(instance.session.origin).done(function () { - new instance.base_calendar.DoAccept(null,db,token,action,view_type,status).appendTo($("body").addClass('openerp')); + new instance.base_calendar.invite(null,db,token,action,view_type,status).appendTo($("body").addClass('openerp')); }); } }; From 6b91bc24d7e8f3191db4aa76387c057f6fc11a21 Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Thu, 11 Jul 2013 17:06:24 +0530 Subject: [PATCH 029/450] [ADD]:widget for invitation status on many2many field , will see the status of attendee if accepted then green, declined then red otherwise grey buttton [IMP]: onclick accept/decline open form view of meeting and if click on direct to openerp will open calneder view of meeting -> Message in chatter when accept/decline. bzr revid: aja@tinyerp.com-20130711113624-baqko9b4b1fjoh8o --- addons/base_calendar/__openerp__.py | 4 + addons/base_calendar/base_calendar.py | 10 +- addons/base_calendar/base_calendar_data.xml | 4 +- addons/base_calendar/crm_meeting_view.xml | 2 +- .../static/src/css/base_calender.css | 15 ++ .../static/src/js/base_calendar.js | 131 +++++++++++++++++- .../static/src/xml/base_calender.xml | 13 ++ 7 files changed, 170 insertions(+), 9 deletions(-) create mode 100644 addons/base_calendar/static/src/css/base_calender.css create mode 100644 addons/base_calendar/static/src/xml/base_calender.xml diff --git a/addons/base_calendar/__openerp__.py b/addons/base_calendar/__openerp__.py index 7d5b82a3cdf..6ca94ecd7f4 100644 --- a/addons/base_calendar/__openerp__.py +++ b/addons/base_calendar/__openerp__.py @@ -50,6 +50,10 @@ If you need to manage your meetings, you should install the CRM module. 'js': [ 'static/src/js/*.js' ], + 'qweb': ['static/src/xml/*.xml'], + 'css': [ + 'static/src/css/base_calender.css' + ], 'test' : ['test/base_calendar_test.yml'], 'installable': True, 'application': True, diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 53dadecd437..c92b4dc325f 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -450,7 +450,7 @@ property or property parameter."), 'responsible': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', 'company': company, 'description': res_obj.description or '-', - 'attendees': ', ' .join(att_info), + 'attendees': ',\n' .join(att_info), 'time': time, 'tz': tz, 'location': res_obj.location or '-', @@ -518,8 +518,8 @@ property or property parameter."), meeting_obj = self.pool.get('crm.meeting') for vals in self.browse(cr, uid, ids, context=context): meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) - if meeting_id: - meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s Accept Invitation") % (vals.cn)), context=context) + if meeting_id and vals.state != 'accepted': + meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Accept Invitation") % (vals.cn)), context=context) self.write(cr, uid, vals.id, {'state': 'accepted'}, context) return True @@ -538,8 +538,8 @@ property or property parameter."), meeting_obj = self.pool.get('crm.meeting') for vals in self.browse(cr, uid, ids, context=context): meeting_id = meeting_obj.search(cr, uid, [('attendee_ids','=',vals.id)],context = context) - if meeting_id: - meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s Reject Invitation") % (vals.cn)), context=context) + if meeting_id and vals.state != 'declined': + meeting_obj.message_post(cr, uid, meeting_id, body=_(("%s has Declined Invitation") % (vals.cn)), context=context) self.write(cr, uid, vals.id, {'state': 'declined'}, context) return True diff --git a/addons/base_calendar/base_calendar_data.xml b/addons/base_calendar/base_calendar_data.xml index 0f58f52c202..d7addfddcfd 100644 --- a/addons/base_calendar/base_calendar_data.xml +++ b/addons/base_calendar/base_calendar_data.xml @@ -177,9 +177,9 @@
You, %(organizer)s - Organizer
%(attendees)s
- + -
--
Sent by %(responsible)s from %(company)s.View this meeting detail directly in OpenERP
+
--
Sent by %(responsible)s from %(company)s.View this meeting detail directly in OpenERP
diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml index 4298b193ea7..8b2efb8b44c 100644 --- a/addons/base_calendar/crm_meeting_view.xml +++ b/addons/base_calendar/crm_meeting_view.xml @@ -43,7 +43,7 @@