OpenERP 7 integration with Moodle

OpenERP 7.0, The full featured ERP making the switch from an ERP to a suite of integrated business applications. So far, the world was split between ERPs and best of breed applications. With 7.0, OpenERP combines the key benefits of stand-alone apps (ease of use, quick to deploy, highly customizable, …) with the integrations and feature coverage only ERPs used to provide to their customers.

Moodle (Modular Object-Oriented Dynamic Learning Environment) is a free source e-learning software platform, also known as a Learning Management System, or Virtual Learning Environment (VLE).It was originally developed by Martin Dougiamas to help educators create online courses with a focus on interaction and collaborative construction of content, and is in continual evolution. The first version of Moodle was released on 20 August 2002.

Moodle has several features considered typical of an e-learning platform, plus some original innovations (like its filtering system). Moodle is very similar to a learning management system. Moodle can be used in many types of environments such as in education, training and development, and business settings.

Some typical features of Moodle are:

  • Assignment submission
  • Discussion forum
  • Files download
  • Grading
  • Moodle instant messages
  • Online calendar
  • Online news and announcement (College and course level)
  • Online quiz

To integrate openERP with moodle, first you need to install a moodle server(I used moodle 2.4.3 version).Then create an Admin user and activate the web service in moodle.

For activate web service in moodle.

  1. In moodle, site administration ->plugins ->web services ->manage protocols -> activate the xmlrpc web service.
  2. In moodle, site administration ->plugins ->web services ->manage tokens -> create a token: When creating token, you need to select a web service.So you can select the existing web service or can create new service for this particular   integration.If you want to create seprate web services for this integration, Goto site administration ->plugins ->web services -> External services -> add external service and add the functions.Ex:
  3. In moodle, site administration ->plugins ->web services ->overview -> activate webservice.

In openERP 7.0, there is a module named ‘event_moodle’ which help us to interact with a Moodle platform.So first install ‘event_moodle’ module, when you installing, it will shows a pop up window to set up the configuration such as server name, token, user and password.Provide the server name, created token and the username, password of the admin user(admin user have all the privileges).

Configuration window

Fig: Configuration window when installing module in OpenERP

In this integration, the openERP event is mapped to moodle courses and the registrations of event is mapped to moodle users.So when you create and confirming an event, correspondig course will be created in your moodle server.Similarly when you create and confirming a registration for a particular event, corresponding user will be created in moodle server and a role such as student, teacher etc is assigned to this created user.Here the default role is student.

Fig: Event created in OpenERP

The username and password of this user is randomly generated and it is stored in registration form of OpenERP(‘Moodle username’ and ‘Password for Moodle User’ fields).This user can login to the moodle server and he can add his own course,blogs,messages etc.

Fig: Registration form in OpenERP with moodle user and password after confirmation

The corresponding course created in moodle server is as shown below:

Fig: Course created in Moodle

The User created corresponding to the confirmed registration of a selected event is shown below. And if we modify the ‘Event Confirmation’ mail by including the url of moodle, username and password of the registration, help the registrant to get the login details of moodle account.

Fig: User created in Moodle

The role assigned to this created user is as shown below:

Fig: Role of user in Moodle

As OpenERP is a concrete ERP solution and moodle is a good e-learning platform, so developers can extend the functionality by adding new plugins in moodle and corresponding changes in OpenERP.

Comments

Jasad: Hi Josue, I used Ubuntu 12.04 for testing.The error you getting is 'Page not found' error. So please ensure the configuration part you done is correct.".

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Josue Rodriguez says:

    Thanks for this example. In that OS run your OpenERP? Ihave installed OpenERP 7.0 in Centos 6,3 and Moodle 2.4.4, but when i confirm an event, an server error appear: “Fault 404: Unknown error”.
    Thanks for your answer.

    1. Jasad says:

      Hi Josue,
      I used Ubuntu 12.04 for testing.The error you getting is ‘Page not found’ error. So please ensure the configuration part you done is correct.

      1. Josué Rodríguez says:

        Thanks for answer. I installed now in Ubuntu 12.04 LTS, and error appear:
        OpenERP Server Error
        Client Traceback (most recent call last):
        File “/opt/openerp/server/openerp/addons/web/http.py”, line 204, in dispatch
        response[“result”] = method(self, **self.params)
        File “/opt/openerp/server/openerp/addons/web/controllers/main.py”, line 1134, in call_button
        action = self._call_kw(req, model, method, args, {})
        File “/opt/openerp/server/openerp/addons/web/controllers/main.py”, line 1122, in _call_kw
        return getattr(req.session.model(model), method)(*args, **kwargs)
        File “/opt/openerp/server/openerp/addons/web/session.py”, line 42, in proxy
        result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
        File “/opt/openerp/server/openerp/addons/web/session.py”, line 30, in proxy_method
        result = self.session.send(self.service_name, method, *args)
        File “/opt/openerp/server/openerp/addons/web/session.py”, line 103, in send
        raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
        Server Traceback (most recent call last):
        File “/opt/openerp/server/openerp/addons/web/session.py”, line 89, in send
        return openerp.netsvc.dispatch_rpc(service_name, method, args)
        File “/opt/openerp/server/openerp/netsvc.py”, line 292, in dispatch_rpc
        result = ExportService.getService(service_name).dispatch(method, params)
        File “/opt/openerp/server/openerp/service/web_services.py”, line 626, in dispatch
        res = fn(db, uid, *params)
        File “/opt/openerp/server/openerp/osv/osv.py”, line 188, in execute_kw
        return self.execute(db, uid, obj, method, *args, **kw or {})
        File “/opt/openerp/server/openerp/osv/osv.py”, line 131, in wrapper
        return f(self, dbname, *args, **kwargs)
        File “/opt/openerp/server/openerp/osv/osv.py”, line 197, in execute
        res = self.execute_cr(cr, uid, obj, method, *args, **kw)
        File “/opt/openerp/server/openerp/osv/osv.py”, line 185, in execute_cr
        return getattr(object, method)(cr, uid, *args, **kw)
        File “/opt/openerp/server/openerp/addons/event/event.py”, line 125, in button_confirm
        self.check_registration_limits(cr, uid, ids, context=context)
        File “/opt/openerp/server/openerp/addons/event_moodle/event_moodle.py”, line 185, in check_registration_limits
        response_courses = moodle_pool.create_moodle_courses(cr, uid, moodle_config_wiz_id, dic_courses, context=context)
        File “/opt/openerp/server/openerp/addons/event_moodle/event_moodle.py”, line 107, in create_moodle_courses
        return sock.core_course_create_courses(courses)
        File “/usr/lib/python2.7/xmlrpclib.py”, line 1224, in __call__
        return self.__send(self.__name, args)
        File “/usr/lib/python2.7/xmlrpclib.py”, line 1578, in __request
        verbose=self.__verbose
        File “/usr/lib/python2.7/xmlrpclib.py”, line 1264, in request
        return self.single_request(host, handler, request_body, verbose)
        File “/usr/lib/python2.7/xmlrpclib.py”, line 1297, in single_request
        return self.parse_response(response)
        File “/usr/lib/python2.7/xmlrpclib.py”, line 1473, in parse_response
        return u.close()
        File “/usr/lib/python2.7/xmlrpclib.py”, line 793, in close
        raise Fault(**self._stack[0])
        Fault:
        Thanks for your help!

        1. Jasad Moozhiyan says:

          This due to failing the connection establishment to your moodle server. because you may not be correctly activated the web services.So first check that you are activated the web services in your moodle. If activated, then better to create an external services and add functions to it.

          ie, In moodle server,Site Administration -> Plugins -> Web services -> External services. Add an external services here and add functions to it. when adding functions ,please make sure that you added atleast the following functions :

          •  core_course_create_courses
          • core_user_create_users
          • enrol_manual_enrol_users

          After this create token by selecting this web service, and change the token details in your openerp. when changing the token , make sure that there is no other configuration data in your database. 

          1. Josué Rodríguez says:

            Thanks for your answer! At create an external service, add functions and create a new token, the integration works! Thanks for your support.
            Now i have a new inconvenient. When i register an member in the event appear this message:
            OpenERP Server Error
            Client Traceback (most recent call last):
            File “/opt/openerp/server/openerp/addons/web/http.py”, line 204, in dispatch
            response[“result”] = method(self, **self.params)
            File “/opt/openerp/server/openerp/addons/web/controllers/main.py”, line 1134, in call_button
            action = self._call_kw(req, model, method, args, {})
            File “/opt/openerp/server/openerp/addons/web/controllers/main.py”, line 1122, in _call_kw
            return getattr(req.session.model(model), method)(*args, **kwargs)
            File “/opt/openerp/server/openerp/addons/web/session.py”, line 42, in proxy
            result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
            File “/opt/openerp/server/openerp/addons/web/session.py”, line 30, in proxy_method
            result = self.session.send(self.service_name, method, *args)
            File “/opt/openerp/server/openerp/addons/web/session.py”, line 103, in send
            raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
            Server Traceback (most recent call last):
            File “/opt/openerp/server/openerp/addons/web/session.py”, line 89, in send
            return openerp.netsvc.dispatch_rpc(service_name, method, args)
            File “/opt/openerp/server/openerp/netsvc.py”, line 292, in dispatch_rpc
            result = ExportService.getService(service_name).dispatch(method, params)
            File “/opt/openerp/server/openerp/service/web_services.py”, line 626, in dispatch
            res = fn(db, uid, *params)
            File “/opt/openerp/server/openerp/osv/osv.py”, line 188, in execute_kw
            return self.execute(db, uid, obj, method, *args, **kw or {})
            File “/opt/openerp/server/openerp/osv/osv.py”, line 131, in wrapper
            return f(self, dbname, *args, **kwargs)
            File “/opt/openerp/server/openerp/osv/osv.py”, line 197, in execute
            res = self.execute_cr(cr, uid, obj, method, *args, **kw)
            File “/opt/openerp/server/openerp/osv/osv.py”, line 185, in execute_cr
            return getattr(object, method)(cr, uid, *args, **kw)
            File “/opt/openerp/server/openerp/addons/event/event.py”, line 340, in registration_open
            res = self.confirm_registration(cr, uid, ids, context=context)
            File “/opt/openerp/server/openerp/addons/event_moodle/event_moodle.py”, line 253, in confirm_registration
            ‘city’: register.city,
            File “/opt/openerp/server/openerp/osv/orm.py”, line 486, in __getattr__
            raise AttributeError(e)
            AttributeError: “Field ‘city’ does not exist in object ‘browse_record(event.registration, 2)'”
            Thanks for your valious help!

          2. Jasad Moozhiyan says:

            Hi Josue,

            The data you are fetching to create the registration/user is not correct.So please fetch the correct data and try.

          3. Josue Rodriguez says:

            Thanks for you suggest, but no luck. If is possible can you send a copy of you event_moodle.py?
            I work with moodle 2.5 and i can see that field name to password is newpasswird, but in openerp module is password. And for example to register a new user in moodle the field country is required but in py file not appear.
            Thanks for your answer!

          4. Cira Brilla says:

            Hi to every body, it's my first pay a quick visit of this weblog; this weblog includes awesome and in fact excellent data for visitors.

          5. Jasad Moozhiyan says:

            Thanks Cira Brilla.

  2. JZA says:

    I wonder how does this consolidate a Knowledge Management strategy for example to train employees, or deploy on-going training programs.
    How does the processing of the courses interact back to the ERP, specially on HR, upper management and modules that interact with the employees performance.
    Por example, would a manager know his-her staff has completed the course on the new version of the XYZ software that will be deployed next week?

  3. Anonymous says:

    I just install moodle server and integrate it with openERP; i want to open moodle server for the second time and i follow the forum’s steps but the page is not reachable?!
    Please your helps

  4. Anonymous says:

    I followed your steps but it didn’t work. have you tried Moodle 2.6? i guess some of the functions were deprecated.

  5. Anonymous says:

    iam trying the same procedure, but the time i enter the moodle configuration in openerp, the popup just disappears, and not saving the data, pls help

  6. sanjay says:

    Client Traceback (most recent call last):
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/web/http.py”, line 204, in dispatch
    response[“result”] = method(self, **self.params)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/web/controllers/main.py”, line 1137, in call_button
    action = self._call_kw(req, model, method, args, {})
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/web/controllers/main.py”, line 1125, in _call_kw
    return getattr(req.session.model(model), method)(*args, **kwargs)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/web/session.py”, line 42, in proxy
    result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/web/session.py”, line 30, in proxy_method
    result = self.session.send(self.service_name, method, *args)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/web/session.py”, line 103, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
    Server Traceback (most recent call last):
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/web/session.py”, line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/netsvc.py”, line 296, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/service/web_services.py”, line 632, in dispatch
    res = fn(db, uid, *params)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/osv/osv.py”, line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
    File “/home/synconics/workspace/newproject/openerp-source/openerp/osv/osv.py”, line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/osv/osv.py”, line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/osv/osv.py”, line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/event/event.py”, line 125, in button_confirm
    self.check_registration_limits(cr, uid, ids, context=context)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/event_moodle/event_moodle.py”, line 189, in check_registration_limits
    response_courses = moodle_pool.create_moodle_courses(cr, uid, moodle_config_wiz_id, dic_courses, context=context)
    File “/home/synconics/workspace/newproject/openerp-source/openerp/addons/event_moodle/event_moodle.py”, line 111, in create_moodle_courses
    return sock.core_course_get_courses(courses)
    File “/usr/lib/python2.7/xmlrpclib.py”, line 1224, in __call__
    return self.__send(self.__name, args)
    File “/usr/lib/python2.7/xmlrpclib.py”, line 1578, in __request
    verbose=self.__verbose
    File “/usr/lib/python2.7/xmlrpclib.py”, line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
    File “/usr/lib/python2.7/xmlrpclib.py”, line 1297, in single_request
    return self.parse_response(response)
    File “/usr/lib/python2.7/xmlrpclib.py”, line 1467, in parse_response
    p.feed(data)
    File “/usr/lib/python2.7/xmlrpclib.py”, line 557, in feed
    self._parser.Parse(data, 0)
    ExpatError: not well-formed (invalid token): line 11, column 8

  7. kartik says:

    hi ,
    i followed all steps but course and user are not save in moodle also when i am try to configure event so it nit saved data every time when open configure form is empty also not dislpay any errors.
    please help,
    thanks in advanced!!!

© 2020 Zesty Beanz Pvt Ltd All Rights Reserved.