[IMP] Redo tuto to get api key, because Google have changed console UI during the dev

bzr revid: jke@openerp.com-20131219174536-msjd005fxhxgl9qq
This commit is contained in:
jke-openerp
2013-12-19 18:45:36 +01:00
parent 59c932477e
commit 4a1208b39b
10 changed files with 32 additions and 45 deletions
+13 -24
View File
@@ -242,12 +242,6 @@ class calendar_attendee(osv.osv):
the_mailmess = mail_pool.browse(cr,uid,mail_id,context=context).mail_message_id
mailmess_pool.write(cr,uid,[the_mailmess.id],vals,context=context)
mail_ids.append(mail_id)
#
# if not attendee.partner_id.opt_out:
# if 'partner_to' in vals:
# del vals['partner_to'] #hack between mail.mail and template.mail -> tde
if mail_ids:
try:
@@ -568,8 +562,6 @@ class calendar_alarm_manager(osv.osv):
if LastFound:
for alert in LastFound:
self.do_mail_reminder(cr,uid,alert,context=context)
#Purge all done
def get_next_event(self,cr,uid,context=None):
ajax_check_every_seconds = 300
@@ -627,31 +619,28 @@ class calendar_alarm_manager(osv.osv):
'declined':'red'
}
for attendee in event.attendee_ids:
for attendee in event.attendee_ids:
dummy,template_id = data_pool.get_object_reference(cr, uid, 'calendar', 'crm_email_template_meeting_reminder')
dummy,act_id = data_pool.get_object_reference(cr, uid, 'calendar', "view_crm_meeting_calendar")
body = template_pool.browse(cr, uid, template_id, context=context).body_html
#mail_from = tools.config.get('email_from',event.user_id.email)
if attendee.email:
local_context['att_obj'] = attendee
local_context['color'] = color
local_context['action_id'] = self.pool.get('ir.actions.act_window').search(cr, uid, [('view_id','=',act_id)], context=context)[0]
local_context['dbname'] = cr.dbname
local_context['base_url'] = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context)
vals = template_pool.generate_email(cr, uid, template_id, attendee.event_id.id, context=local_context)
vals = template_pool.send_mail(cr, uid, template_id, attendee.id, context=local_context)
vals = {}
if ics_file:
vals['attachment_ids'] = [(0,0,{'name': 'invitation.ics',
'datas_fname': 'invitation.ics',
'datas': str(ics_file).encode('base64')})]
vals['model'] = None #We don't want to have the mail in the tchatter while in queue!
vals['auto_delete'] = True #We don't need mail after it has been sended !
if (vals['email_to']== attendee.partner_id.email):
vals['email_to'] = ''
vals['recipient_ids'] = [(4,attendee.partner_id.id),]
if not attendee.partner_id.opt_out:
if 'partner_to' in vals:
del vals['partner_to'] #hack between mail.mail and template.mail -> tde
mail_ids.append(mail_pool.create(cr, uid, vals, context=local_context))
the_mailmess = mail_pool.browse(cr,uid,mail_id,context=context).mail_message_id
mailmess_pool.write(cr,uid,[the_mailmess.id],vals,context=context)
mail_ids.append(mail_id)
if mail_ids:
try:
res = mail_pool.send(cr, uid, mail_ids, context=local_context)
+8 -7
View File
@@ -416,13 +416,14 @@ class email_template(osv.osv):
#Convert Partner_to (a string of ID) into recipient_ids'
recipient_ids = []
if 'partner_to' in values and values['partner_to']:
partner_to = safe_eval(values['partner_to'])
# if not hasattr(partner_to, '__iter__'):
# partner_to = [partner_to]
for partner_id in partner_to:
recipient_ids.append((4,partner_id))
values['recipient_ids'] = recipient_ids
if 'partner_to' in values:
if values['partner_to']:
partner_to = safe_eval(values['partner_to'])
# if not hasattr(partner_to, '__iter__'):
# partner_to = [partner_to]
for partner_id in partner_to:
recipient_ids.append((4,partner_id))
values['recipient_ids'] = recipient_ids
del values['partner_to']
attachment_ids = values.pop('attachment_ids', [])
+1 -1
View File
@@ -21,7 +21,7 @@ class google_auth(http.Controller):
registry = openerp.modules.registry.RegistryManager.get(dbname)
with registry.cursor() as cr:
if kw.get('code'):
if kw.get('code',False):
registry.get('google.%s' % service).set_all_tokens(cr,request.session.uid,kw['code'])
return werkzeug.utils.redirect(url_return)
+1 -1
View File
@@ -100,7 +100,7 @@ class google_service(osv.osv_memory):
'client_id': client_id,
'client_secret': client_secret,
'grant_type' : 'authorization_code',
#'redirect_uri': base_url + '/google_account/authentication'
'redirect_uri': base_url + '/google_account/authentication'
}
headers = {"content-type": "application/x-www-form-urlencoded"}
+9 -12
View File
@@ -30,25 +30,22 @@
<br/> <img src='/google_calendar/static/src/img/setup_05.png' class='calendar_img_tuto'/>
</li>
<li>
In the menu on left side, select the sub menu <b>'Registered apps'</b> (from menu APIs and auth) and click on button "Register APP".
<br/> Fill in the Name of application and check that the platform is well on <b>'Web Application'</b> before to click on <b>'Register"</b>
In the menu on left side, select the sub menu <b>'Credentials'</b> (from menu APIs and auth) and click on button <b>'Create New Client ID'</b>
<br/><br/> <img src='/google_calendar/static/src/img/setup_06.png' class='calendar_img_tuto'/>
<br/> <img src='/google_calendar/static/src/img/setup_07.png' class='calendar_img_tuto'/>
</li>
<li>
Now, you can click on <b>"OAuth 2.0 Client ID"</b> and see your <u><i>Client ID</i></u> and your <u><i>Client Secret</i></u>.
</li>
<li> Fill in the Name of application and check that the platform is well on <b>'Web Application'</b>.<br/>
<br/> You should now configure the allowed pages on which you will be redirected. To do it, you need to complete the field <b>"Redirect RI"</b>
and set as value (your own domain followed by <i>"/google_account/authentication"</i>) :
<br/>==> <b><field name="server_uri" readonly="1" style='display:inline'/></b>
<br/><br/><img src='/google_calendar/static/src/img/setup_09.png' class='calendar_img_tuto'/>
</li>
<li>One the uri allowed, you need to regenerate your private token by clicking on "Generate".
<br/>Once done, you will have the both informations that you need to insert in the 2 fields below !
<br/> You can now click on <b>'Create Client ID'</b>
<br/><br/> <img src='/google_calendar/static/src/img/setup_07.png' class='calendar_img_tuto'/>
</li>
<li>Once done, you will have the both informations (<b>Client ID</b> and <b>Client Secret</b>) that you need to insert in the 2 fields below !
<br/><br/> <img src='/google_calendar/static/src/img/setup_08.png' class='calendar_img_tuto'/>
</li>
<li>
Remark : You can, if you want, personalize the consent screen that your users will see by clicking on "update" below <b>"Consent Screen"</b>.
<br/><br/> <img src='/google_calendar/static/src/img/setup_10.png' class='calendar_img_tuto'/>
Remark : You can, if you want, personalize the consent screen that your users will see by clicking on <b>"Consent Screen"</b> in the left menu.
<br/><br/> <img src='/google_calendar/static/src/img/setup_09.png' class='calendar_img_tuto'/>
</li>
<a href="#" class="oe_link">Return at Top</a>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB