Google Calendar for OpenERP 7.0 installation notes

Hello Malaysia , Singapore openERP community , how are you , lately what are you working on ? And this time i want to share something that i use a lot that is project calendar of openERP and if you are like me been a heavy user of both Gmail and openERP , then you must be wishing for a module to sync both of your calendar , in the past , we have this ical but in the latest version , the support was gone and it has been a disappointment for many but fear not as I found this great module and want to share here so that you all are aware of it .

The installation procedures are:

  • To install google api client 

Before you are able running this module you must install google api client for python :https://developers.google.com/api-client-library/python/start/installationNow install the google_api module in your OpenERP 7.0 system. If any errors occur this has to do with the needed dependencies the module need (apiclient, httplib2, oauth2client, uritemplate, argparse).

  • Setup google account to use google api

In Settings->Users->Users enable “Google API / Manager” in “Access Rights” for those users having admin rights. Enable “Google API / User” for those users you want to have synchronization enabled for there calendars.
Setup a google account for using google api:https://code.google.com/apis/console/Follow the instructions by google to create such an account if you haven’t got one yet. In the console create a new project. Give it a name (for example: API Project). Go to the “Services” section of your created project and switch “calendar API” to “on”.Now go to the “API settings” section of your project and click on “Create another client ID …” and select “Installed application” as Application type. Select “other” as Installed application type (this option will be visible after selecting the correct Application type). Now click on “Create client ID”.Now you have a “Client ID for installed applications” with a Client ID, Client secret, Redirect URIs. On the right you see a button “Download JSON”. Click on this button and save this file on a location where your OpenERP system has access to it (read/write).

  • Authorize the google calendar to be managed by openERP

In OpenERP login as admin, you have a menu “Google API”. Create an account for accessing your google API. Go to “Google API->Configuration->Accounts”. Click on the create button ,give your account a name.In “Secrets path” enter the full path of your json file you just have downloaded (example: d:openerpspecialgoogle_calendarclient_secrets.json). In “Credential path” enter a full path (filename included) where google_api will find/create the credential file (example: d:openerpspecialgoogle_calendar credentials.dat). The first time this credentials file does not exists.When you’re done save your account,  click on this button “Authorize” becomes red. To test if everything is correct.It’s important that you have your browser opened on the same machine as OpenERP-Server is running.If everything goes well a new page opens in your browser, asking to accept that the openERP module google_api wants to manage your calendars and to view your calendars (if not visible you have to login first). Click the accept button. Now the credential file is created.If you have problems using this method deactivate “Use local browser” in “Google Api->Configuration->Accounts->[your account]”, stop your OpenERP-Server and run it in interactive mode (on ubuntu from the location where you installed OpenERP-Server: ./openerp-server -c /etc/openerp-server.conf).After clicking the “Authorize” button in your terminal you see a link. Copy this link and paste it in a browser on a device where this is possible. Here you will receive a code, enter this code in your terminal where the system is waiting for it. Stop OpenERP-Server and start it again the way you always do.

  • Setup Calendar you want to sync.

The last thing you have to do is to create calendars in your account you want to sync with OpenERP. For each user you want to have this option you must create one calendar. See http://www.google.com/calendar to create your calendars. Don’t forget to share this calendar with the user for whom this calendar is. This user also must have a google account.In the calendar settings you have a Privat address with a little xml button.Click on it and copy the link into an text editor.

The link looks like:https://www.google.com/calendar/feeds/ghzfw33qcgtoahz1hq7cdsj321%40group.calendar.google.com/private-35403bc2f4aad7ce56b21a976516b21/basic

Now copy the string between “feeds/” and “/private”, you have something like this:ghzfw33qcgtoahz1hq7cdsj321%40group.calendar.google.com

Replace “%40” with the “@” sign, resulted in the following Google calendar id:ghzfw33qcgtoahz1hq7cdsj321@group.calendar.google.com

Go back to OpenERP and create a calendar (Google Api->Configuration->Calendars”. Here you must select the account you just have created, the user this calendar belongs to and the “Google calendar id”.Save your data and click the button “Synchronize” to test it. In Messaging->Organizer->Calendar you can see if events were created/changed and/or deleted.The module google_api synchronizes every 15 minutes. You can change this in Settings->Technical->Scheduler.

You also have the possibility you use the notifications option of google, in this case google triggers some link you must define. In this trigger you can call the do_synchronize method of the google_api module.
For downloading the module please visit OpenERP Applications