diff --git a/doc/howto/howto_website.rst b/doc/howto/howto_website.rst index aa15236fed7..67b13482583 100644 --- a/doc/howto/howto_website.rst +++ b/doc/howto/howto_website.rst @@ -473,11 +473,92 @@ fix this, we have to create an explicit list view for lectures: .. todo:: link to list view documentation -.. todo:: have lectures extend events -> reuse in OpenERP? +Reusing and customizing existing work +------------------------------------- + +OpenERP and its standard modules provide a number of models which may already +solve your problem or part of your problem. Part of being a good OpenERP +developer is having an idea of existing models and how they can be retrofit +to your purposes. + +For our courses, instead of developing teaching assistants and lectures from +scratch we could reuse existing OpenERP *users* (for teaching assistants) and +*events* (for lectures)\ [#bonus]_, as well as the built-in website support +for events. + +Install ``website_event`` (which will also install ``events``) by restarting +the server as: + +.. code-block:: console + + $ ./openerp-server --addons-path=../web/addons,../addons,../my-modules \ + -d academy -i website_event --db-filter=academy + +We'll also add it as a dependency to our module: + +.. patch:: + +Reload `your openerp`_, click on the new :menuselection:`Events` item which +was added to the menu. This will be our new lectures page, but there are a few +adaptations to perform + +Fixing the menu +~~~~~~~~~~~~~~~ + +The menu title is currently a generic *Events*, we only want lectures so we +will rename it to *Lectures*. Website menu items are defined through the +``website.menu`` model, *Events* is defined by ``website_event`` and has the +external id ``website_event.menu_events``, renaming it is as simple as +overwriting the ``name`` field for that record: + +.. patch:: + +Restart the server with + +.. code-block:: console + + $ ./openerp-server --addons-path=../web/addons,../addons,../my-modules \ + -d academy -i academy --db-filter=academy + +and the menu item has been renamed to Lectures. + +Removing the sidebar +~~~~~~~~~~~~~~~~~~~~ + +The filters sidebar is not necessary for our lectures. It can be removed in +the UI via :menuselection:`Customize --> Filters` (and new filters can be +added to the current filtering by date). Template customization is done by +adding and removing extension views, so much like the renaming of the menu, +we simply need to find the right record (here the Filters template view +extending the basic event page) and set its value correctly: + +.. todo:: documentation for view inheritance/in-place extension + +.. patch:: + +Note that the option is still available in :menuselection:`Customize`, we +have merely flipped the default around. + +Simplifying templates +~~~~~~~~~~~~~~~~~~~~~ + +There are still two things to fix in the lectures list. First, remove the +*Our Events* link in the top-left corner, simply replace the breadcrumb +element by nothing: + +.. patch:: + +Second, remove the "organized by" and type rows in the event's description, +keep only the datetime and location: + +.. patch:: .. [#taprofile] the teaching assistants profile view ends up broken for now, but don't worry we'll get around to it +.. [#bonus] as a bonus, we get access rights and TA access to the + administrative backend "for free" + .. _bootstrap: http://getbootstrap.com .. _converter pattern: diff --git a/doc/howto/howto_website/disable-events-filters b/doc/howto/howto_website/disable-events-filters new file mode 100644 index 00000000000..353b00bfe28 --- /dev/null +++ b/doc/howto/howto_website/disable-events-filters @@ -0,0 +1,15 @@ +# HG changeset patch +# Parent a86395d8fd5fba9d902c6796a991ffd6e414d1c5 +diff -r a86395d8fd5f -r 01f5cbb40de0 data/records.xml +--- a/data/records.xml Tue Apr 15 16:19:30 2014 +0200 ++++ b/data/records.xml Tue Apr 15 16:19:47 2014 +0200 +@@ -3,5 +3,9 @@ + + Lectures + ++ ++ ++ ++ + + diff --git a/doc/howto/howto_website/events-dependency b/doc/howto/howto_website/events-dependency new file mode 100644 index 00000000000..a04dbb068e5 --- /dev/null +++ b/doc/howto/howto_website/events-dependency @@ -0,0 +1,14 @@ +# HG changeset patch +# Parent 6a562e55935fe44a57220b0dcd9c389aa0b39e7e +diff -r 6a562e55935f -r a5a363ca0a78 __openerp__.py +--- a/__openerp__.py Mon Apr 14 17:04:36 2014 +0200 ++++ b/__openerp__.py Tue Apr 15 16:03:34 2014 +0200 +@@ -15,7 +15,7 @@ + 'version': '0.1', + + # any module necessary for this one to work correctly +- 'depends': ['website'], ++ 'depends': ['website', 'website_event'], + 'data': [ + 'security/ir.model.access.csv', + 'views/templates.xml', diff --git a/doc/howto/howto_website/events-menu-rename b/doc/howto/howto_website/events-menu-rename new file mode 100644 index 00000000000..e1f096f31a3 --- /dev/null +++ b/doc/howto/howto_website/events-menu-rename @@ -0,0 +1,26 @@ +# HG changeset patch +# Parent a5a363ca0a784718f504d476d18e8ad4b0f4ec24 + +diff --git a/__openerp__.py b/__openerp__.py +--- a/__openerp__.py ++++ b/__openerp__.py +@@ -19,6 +19,7 @@ + 'data': [ + 'security/ir.model.access.csv', + 'views/templates.xml', ++ 'data/records.xml', + 'data/views.xml', + ], + 'demo': [ +diff --git a/data/records.xml b/data/records.xml +new file mode 100644 +--- /dev/null ++++ b/data/records.xml +@@ -0,0 +1,7 @@ ++ ++ ++ ++ Lectures ++ ++ ++ diff --git a/doc/howto/howto_website/events-remove-breadcrumbs b/doc/howto/howto_website/events-remove-breadcrumbs new file mode 100644 index 00000000000..5b61a67d4df --- /dev/null +++ b/doc/howto/howto_website/events-remove-breadcrumbs @@ -0,0 +1,14 @@ +# HG changeset patch +# Parent 01f5cbb40de08d2a195c6a2ac3310efdbd3e1cbd +diff -r 01f5cbb40de0 -r eb4fbe025c90 views/templates.xml +--- a/views/templates.xml Tue Apr 15 16:19:47 2014 +0200 ++++ b/views/templates.xml Tue Apr 15 17:11:13 2014 +0200 +@@ -66,5 +66,8 @@ + + + ++ + + diff --git a/doc/howto/howto_website/series b/doc/howto/howto_website/series index 30efad5d7b5..18f3e6aba0e 100644 --- a/doc/howto/howto_website/series +++ b/doc/howto/howto_website/series @@ -16,3 +16,8 @@ data-to-demo lectures-action-and-menus field-label lecture-view-list +events-dependency +events-menu-rename +disable-events-filters +events-remove-breadcrumbs +simplify-lectures-list diff --git a/doc/howto/howto_website/simplify-lectures-list b/doc/howto/howto_website/simplify-lectures-list new file mode 100644 index 00000000000..27b65133daa --- /dev/null +++ b/doc/howto/howto_website/simplify-lectures-list @@ -0,0 +1,18 @@ +# HG changeset patch +# Parent eb4fbe025c90df79b12a3fb18bf884c6c169e652 +diff -r eb4fbe025c90 -r 30b20b46dbb2 views/templates.xml +--- a/views/templates.xml Tue Apr 15 17:11:13 2014 +0200 ++++ b/views/templates.xml Tue Apr 15 17:21:18 2014 +0200 +@@ -66,8 +66,11 @@ + + + +-