From ac99ad7abd49acb7ceaa7935fe93bea88fddc3bb Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Mon, 10 May 2021 13:42:17 +0200 Subject: [PATCH] [REM] *: patchqueue extension Remove the patchqueue extension from the doc requirements since it isn't maintained anymore (raising warnings for recent sphinx versions) and the patches to specify code blocks aren't easy to maintain. Remove hidden code patches, and replaces shown patches by code block / literalincludes to keep the useful content. --- conf.py | 3 - content/developer/howtos/backend.rst | 286 --------- .../howtos/backend/exercise-access-rights | 40 -- .../howtos/backend/exercise-access-rules | 27 - .../howtos/backend/exercise-advanced-treeview | 19 - .../howtos/backend/exercise-basic-action | 54 -- .../howtos/backend/exercise-calendar | 78 --- .../howtos/backend/exercise-computed | 40 -- .../howtos/backend/exercise-constraint-python | 25 - .../howtos/backend/exercise-constraint-sql | 24 - .../howtos/backend/exercise-copy-override | 28 - .../howtos/backend/exercise-creation | 152 ----- .../howtos/backend/exercise-dashboard | 95 --- .../howtos/backend/exercise-defaults | 28 - .../developer/howtos/backend/exercise-demo | 48 -- .../howtos/backend/exercise-domain-advanced | 42 -- .../howtos/backend/exercise-domain-basic | 17 - .../howtos/backend/exercise-formview | 29 - .../backend/exercise-formview-notebooks | 24 - .../developer/howtos/backend/exercise-gantt | 61 -- .../developer/howtos/backend/exercise-graph | 56 -- .../developer/howtos/backend/exercise-kanban | 78 --- .../howtos/backend/exercise-many2many | 22 - .../howtos/backend/exercise-many2one | 95 --- .../developer/howtos/backend/exercise-model | 19 - .../howtos/backend/exercise-model-inheritance | 78 --- .../howtos/backend/exercise-onchange | 28 - .../howtos/backend/exercise-one2many | 36 -- .../developer/howtos/backend/exercise-report | 50 -- .../howtos/backend/exercise-searchview | 28 - .../howtos/backend/exercise-searchview-basic | 24 - .../developer/howtos/backend/exercise-session | 58 -- .../howtos/backend/exercise-translations | 56 -- .../developer/howtos/backend/exercise-wizard | 25 - .../howtos/backend/exercise-wizard-action | 30 - .../howtos/backend/exercise-wizard-launch | 45 -- .../howtos/backend/exercise-wizard-multi | 38 -- content/developer/howtos/backend/series | 35 -- content/developer/howtos/website.rst | 560 +++++++++++++++++- content/developer/howtos/website/basic-acl | 23 - .../developer/howtos/website/basic-controller | 22 - content/developer/howtos/website/basic-model | 18 - .../developer/howtos/website/biography-esc | 23 - .../developer/howtos/website/biography-field | 18 - .../developer/howtos/website/chatter-backend | 29 - .../developer/howtos/website/converter-model | 44 -- content/developer/howtos/website/course-m2o | 24 - .../developer/howtos/website/course-no-price | 21 - content/developer/howtos/website/course-o2m | 33 -- .../developer/howtos/website/course-product | 142 ----- .../howtos/website/course-products-sidebar | 18 - content/developer/howtos/website/course-views | 57 -- .../howtos/website/data-retrieval-orm | 30 - content/developer/howtos/website/demo-data | 42 -- content/developer/howtos/website/field-format | 16 - content/developer/howtos/website/field-raw | 15 - content/developer/howtos/website/field-widget | 16 - content/developer/howtos/website/module-empty | 153 ----- .../howtos/website/product-dependency | 16 - .../developer/howtos/website/routing-basic | 19 - .../howtos/website/routing-converter | 20 - content/developer/howtos/website/series | 27 - .../developer/howtos/website/teacher-links | 27 - .../howtos/website/teachers-formview | 26 - .../developer/howtos/website/teachers-menu | 35 -- content/developer/howtos/website/template | 42 -- .../developer/howtos/website/website-support | 50 -- content/developer/webservices/iap.rst | 214 +++++-- content/developer/webservices/iap/01-init | 16 - content/developer/webservices/iap/02-button | 34 -- content/developer/webservices/iap/03-callback | 40 -- content/developer/webservices/iap/series | 3 - .../developer/webservices/iap_service/01-init | 16 - .../developer/webservices/iap_service/02-tnx | 48 -- .../webservices/iap_service/03-template | 56 -- .../developer/webservices/iap_service/series | 3 - requirements.txt | 1 - 77 files changed, 696 insertions(+), 3222 deletions(-) delete mode 100644 content/developer/howtos/backend/exercise-access-rights delete mode 100644 content/developer/howtos/backend/exercise-access-rules delete mode 100644 content/developer/howtos/backend/exercise-advanced-treeview delete mode 100644 content/developer/howtos/backend/exercise-basic-action delete mode 100644 content/developer/howtos/backend/exercise-calendar delete mode 100644 content/developer/howtos/backend/exercise-computed delete mode 100644 content/developer/howtos/backend/exercise-constraint-python delete mode 100644 content/developer/howtos/backend/exercise-constraint-sql delete mode 100644 content/developer/howtos/backend/exercise-copy-override delete mode 100644 content/developer/howtos/backend/exercise-creation delete mode 100644 content/developer/howtos/backend/exercise-dashboard delete mode 100644 content/developer/howtos/backend/exercise-defaults delete mode 100644 content/developer/howtos/backend/exercise-demo delete mode 100644 content/developer/howtos/backend/exercise-domain-advanced delete mode 100644 content/developer/howtos/backend/exercise-domain-basic delete mode 100644 content/developer/howtos/backend/exercise-formview delete mode 100644 content/developer/howtos/backend/exercise-formview-notebooks delete mode 100644 content/developer/howtos/backend/exercise-gantt delete mode 100644 content/developer/howtos/backend/exercise-graph delete mode 100644 content/developer/howtos/backend/exercise-kanban delete mode 100644 content/developer/howtos/backend/exercise-many2many delete mode 100644 content/developer/howtos/backend/exercise-many2one delete mode 100644 content/developer/howtos/backend/exercise-model delete mode 100644 content/developer/howtos/backend/exercise-model-inheritance delete mode 100644 content/developer/howtos/backend/exercise-onchange delete mode 100644 content/developer/howtos/backend/exercise-one2many delete mode 100644 content/developer/howtos/backend/exercise-report delete mode 100644 content/developer/howtos/backend/exercise-searchview delete mode 100644 content/developer/howtos/backend/exercise-searchview-basic delete mode 100644 content/developer/howtos/backend/exercise-session delete mode 100644 content/developer/howtos/backend/exercise-translations delete mode 100644 content/developer/howtos/backend/exercise-wizard delete mode 100644 content/developer/howtos/backend/exercise-wizard-action delete mode 100644 content/developer/howtos/backend/exercise-wizard-launch delete mode 100644 content/developer/howtos/backend/exercise-wizard-multi delete mode 100644 content/developer/howtos/backend/series delete mode 100644 content/developer/howtos/website/basic-acl delete mode 100644 content/developer/howtos/website/basic-controller delete mode 100644 content/developer/howtos/website/basic-model delete mode 100644 content/developer/howtos/website/biography-esc delete mode 100644 content/developer/howtos/website/biography-field delete mode 100644 content/developer/howtos/website/chatter-backend delete mode 100644 content/developer/howtos/website/converter-model delete mode 100644 content/developer/howtos/website/course-m2o delete mode 100644 content/developer/howtos/website/course-no-price delete mode 100644 content/developer/howtos/website/course-o2m delete mode 100644 content/developer/howtos/website/course-product delete mode 100644 content/developer/howtos/website/course-products-sidebar delete mode 100644 content/developer/howtos/website/course-views delete mode 100644 content/developer/howtos/website/data-retrieval-orm delete mode 100644 content/developer/howtos/website/demo-data delete mode 100644 content/developer/howtos/website/field-format delete mode 100644 content/developer/howtos/website/field-raw delete mode 100644 content/developer/howtos/website/field-widget delete mode 100644 content/developer/howtos/website/module-empty delete mode 100644 content/developer/howtos/website/product-dependency delete mode 100644 content/developer/howtos/website/routing-basic delete mode 100644 content/developer/howtos/website/routing-converter delete mode 100644 content/developer/howtos/website/series delete mode 100644 content/developer/howtos/website/teacher-links delete mode 100644 content/developer/howtos/website/teachers-formview delete mode 100644 content/developer/howtos/website/teachers-menu delete mode 100644 content/developer/howtos/website/template delete mode 100644 content/developer/howtos/website/website-support delete mode 100644 content/developer/webservices/iap/01-init delete mode 100644 content/developer/webservices/iap/02-button delete mode 100644 content/developer/webservices/iap/03-callback delete mode 100644 content/developer/webservices/iap/series delete mode 100644 content/developer/webservices/iap_service/01-init delete mode 100644 content/developer/webservices/iap_service/02-tnx delete mode 100644 content/developer/webservices/iap_service/03-template delete mode 100644 content/developer/webservices/iap_service/series diff --git a/conf.py b/conf.py index a92ac09d4..922709e57 100644 --- a/conf.py +++ b/conf.py @@ -102,9 +102,6 @@ extensions = [ 'exercise_admonition', - # Build code from git patches - 'patchqueue', - # Redirection generator 'redirects', diff --git a/content/developer/howtos/backend.rst b/content/developer/howtos/backend.rst index 14d6842f3..4fd02f7ed 100644 --- a/content/developer/howtos/backend.rst +++ b/content/developer/howtos/backend.rst @@ -1,6 +1,4 @@ -.. queue:: backend/series - ================= Building a Module ================= @@ -111,14 +109,6 @@ or XML. The usage of most of those files will be explained along this tutorial. Use the command line above to create an empty module Open Academy, and install it in Odoo. - .. only:: solutions - - #. Invoke the command ``odoo-bin scaffold openacademy addons``. - #. Adapt the manifest file to your module. - #. Don't bother about the other files. - - .. patch:: - Object-Relational Mapping ------------------------- @@ -213,12 +203,6 @@ overridden by setting :attr:`~odoo.models.Model._rec_name`. Define a new data model *Course* in the *openacademy* module. A course has a title and a description. Courses must have a title. - .. only:: solutions - - Edit the file ``openacademy/models/models.py`` to include a *Course* class. - - .. patch:: - Data files ---------- @@ -257,12 +241,6 @@ be declared in the ``'data'`` list (always loaded) or in the ``'demo'`` list Create demonstration data filling the *Courses* model with a few demonstration courses. - .. only:: solutions - - Edit the file ``openacademy/demo/demo.xml`` to include some data. - - .. patch:: - .. tip:: The content of the data files is only loaded when a module is installed or updated. @@ -310,14 +288,6 @@ action more easily. - display a list of all the courses - create/modify courses - .. only:: solutions - - #. Create ``openacademy/views/openacademy.xml`` with an action and - the menus triggering the action - #. Add it to the ``data`` list of ``openacademy/__manifest__.py`` - - .. patch:: - Basic views =========== @@ -410,22 +380,12 @@ elements (groups, notebooks) and interactive elements (buttons and fields): Create your own form view for the Course object. Data displayed should be: the name and the description of the course. - .. only:: solutions - - .. patch:: - .. exercise:: Notebooks In the Course form view, put the description field under a tab, such that it will be easier to add other tabs later, containing additional information. - .. only:: solutions - - Modify the Course form view as follows: - - .. patch:: - Form views can also use plain HTML for more flexible layouts: .. code-block:: xml @@ -473,10 +433,6 @@ searching on the ``name`` field. Allow searching for courses based on their title or their description. - .. only:: solutions - - .. patch:: - Relations between models ======================== @@ -493,18 +449,6 @@ client data; it is also related to its sale order line records. duration and a number of seats. Add an action and a menu item to display them. Make the new model visible via a menu item. - .. only:: solutions - - #. Create the class *Session* in ``openacademy/models/models.py``. - #. Add access to the session object in ``openacademy/view/openacademy.xml``. - - .. patch:: - - .. note:: ``digits=(6, 2)`` specifies the precision of a float number: - 6 is the total number of digits, while 2 is the number of - digits after the comma. Note that it results in the number - digits before the comma is a maximum 4 - Relational fields ----------------- @@ -555,25 +499,11 @@ Relational field types are: of the model ``openacademy.course`` and is required. - Adapt the views. - .. only:: solutions - - #. Add the relevant ``Many2one`` fields to the models, and - #. add them in the views. - - .. patch:: - .. exercise:: Inverse one2many relations Using the inverse relational field one2many, modify the models to reflect the relation between courses and sessions. - .. only:: solutions - - #. Modify the ``Course`` class, and - #. add the field in the course form view. - - .. patch:: - .. exercise:: Multiple many2many relations Using the relational field many2many, modify the *Session* model to relate @@ -581,13 +511,6 @@ Relational field types are: partner records, so we will relate to the built-in model ``res.partner``. Adapt the views accordingly. - .. only:: solutions - - #. Modify the ``Session`` class, and - #. add the field in the form view. - - .. patch:: - Inheritance =========== @@ -687,21 +610,6 @@ instead of a single view its ``arch`` field is composed of any number of the session-partner relation * Using view inheritance, display this fields in the partner form view - .. only:: solutions - - .. note:: - - This is the opportunity to introduce the developer mode to - inspect the view, find its external ID and the place to put the - new field. - - #. Create a file ``openacademy/models/partner.py`` and import it in - ``__init__.py`` - #. Create a file ``openacademy/views/partner.xml`` and add it to - ``__manifest__.py`` - - .. patch:: - Domains ####### @@ -734,31 +642,12 @@ records for the relation when trying to select records in the client interface. When selecting the instructor for a *Session*, only instructors (partners with ``instructor`` set to ``True``) should be visible. - .. only:: solutions - - .. patch:: - - .. note:: - - A domain declared as a literal list is evaluated server-side and - can't refer to dynamic values on the right-hand side, a domain - declared as a string is evaluated client-side and allows - field names on the right-hand side - .. exercise:: More complex domains Create new partner categories *Teacher / Level 1* and *Teacher / Level 2*. The instructor for a session can be either an instructor or a teacher (of any level). - .. only:: solutions - - #. Modify the *Session* model's domain - #. Modify ``openacademy/view/partner.xml`` to get access to - *Partner categories*: - - .. patch:: - Computed fields and default values ================================== @@ -828,13 +717,6 @@ field whenever some of its dependencies have been modified:: * Display that field in the tree and form views * Display the field as a progress bar - .. only:: solutions - - #. Add a computed field to *Session* - #. Show the field in the *Session* view: - - .. patch:: - Default values -------------- @@ -865,15 +747,6 @@ float, string), or a function taking a recordset and returning a value:: * Add a field ``active`` in the class Session, and set sessions as active by default. - .. only:: solutions - - .. patch:: - - .. note:: - - Odoo has built-in rules making fields with an ``active`` field set - to ``False`` invisible. - Onchange ======== @@ -919,10 +792,6 @@ the ``taken_seats`` progressbar is automatically updated. Add an explicit onchange to warn about invalid values, like a negative number of seats, or more participants than seats. - .. only:: solutions - - .. patch:: - Model constraints ================= @@ -950,10 +819,6 @@ raise an exception if its invariant is not satisfied:: Add a constraint that checks that the instructor is not present in the attendees of his/her own session. - .. only:: solutions - - .. patch:: - SQL constraints are defined through the model attribute :attr:`~odoo.models.Model._sql_constraints`. The latter is assigned to a list of triples of strings ``(name, sql_definition, message)``, where ``name`` is a @@ -968,10 +833,6 @@ and ``message`` is the error message. #. CHECK that the course description and the course title are different #. Make the Course's name UNIQUE - .. only:: solutions - - .. patch:: - .. exercise:: Exercise 6 - Add a duplicate option Since we added a constraint for the Course name uniqueness, it is not @@ -981,10 +842,6 @@ and ``message`` is the error message. Re-implement your own "copy" method which allows to duplicate the Course object, changing the original name into "Copy of [original name]". - .. only:: solutions - - .. patch:: - Advanced Views ============== @@ -1028,12 +885,6 @@ behavior: 5 days are colored blue, and the ones lasting more than 15 days are colored red. - .. only:: solutions - - Modify the session tree view: - - .. patch:: - Calendars --------- @@ -1063,19 +914,6 @@ their most common attributes are: Add a Calendar view to the *Session* model enabling the user to view the events associated to the Open Academy. - .. only:: solutions - - #. Add an ``end_date`` field computed from ``start_date`` and - ``duration`` - - .. tip:: the inverse function makes the field writable, and allows - moving the sessions (via drag and drop) in the calendar view - - #. Add a calendar view to the *Session* model - #. And add the calendar view to the *Session* model's actions - - .. patch:: - Search views ------------ @@ -1125,10 +963,6 @@ default and behave as booleans (they can only be enabled by default). responsible in the course search view. Make it selected by default. #. Add a button to group courses by responsible user. - .. only:: solutions - - .. patch:: - Gantt ----- @@ -1153,14 +987,6 @@ their root element is ````. Add a Gantt Chart enabling the user to view the sessions scheduling linked to the Open Academy module. The sessions should be grouped by instructor. - .. only:: solutions - - #. Create a computed field expressing the session's duration in hours - #. Add the gantt view's definition, and add the gantt view to the - *Session* model's action - - .. patch:: - Graph views ----------- @@ -1212,13 +1038,6 @@ the values: Add a Graph view in the Session object that displays, for each course, the number of attendees under the form of a bar chart. - .. only:: solutions - - #. Add the number of attendees as a stored computed field - #. Then add the relevant view - - .. patch:: - Kanban ------ @@ -1239,13 +1058,6 @@ Kanban views define the structure of each card as a mix of form elements Add a Kanban view that displays sessions grouped by course (columns are thus courses). - .. only:: solutions - - #. Add an integer ``color`` field to the *Session* model - #. Add the kanban view and update the action - - .. patch:: - Security ======== @@ -1282,16 +1094,6 @@ rights are usually created by a CSV file named after its model: Create a new user "John Smith". Then create a group "OpenAcademy / Session Read" with read access to the *Session* model. - .. only:: solutions - - #. Create a new user *John Smith* through - :menuselection:`Settings --> Users --> Users` - #. Create a new group ``session_read`` through - :menuselection:`Settings --> Users --> Groups`, it should have - read access on the *Session* model - #. Edit *John Smith* to make them a member of ``session_read`` - #. Log in as *John Smith* to check the access rights are correct - .. exercise:: Add access control through data files in your module Using data files, @@ -1300,17 +1102,6 @@ rights are usually created by a CSV file named after its model: OpenAcademy models * Make *Session* and *Course* readable by all users - .. only:: solutions - - #. Create a new file ``openacademy/security/security.xml`` to - hold the OpenAcademy Manager group - #. Edit the file ``openacademy/security/ir.model.access.csv`` with - the access rights to the models - #. Finally update ``openacademy/__manifest__.py`` to add the new data - files to it - - .. patch:: - Record rules ------------ @@ -1344,12 +1135,6 @@ the same convention as the method :meth:`~odoo.models.Model.write` of the ORM. to the responsible of a course. If a course has no responsible, all users of the group must be able to modify it. - .. only:: solutions - - Create a new rule in ``openacademy/security/security.xml``: - - .. patch:: - Wizards ======= @@ -1377,12 +1162,6 @@ session, or for a list of sessions at once. Create a wizard model with a many2one relationship with the *Session* model and a many2many relationship with the *Partner* model. - .. only:: solutions - - Add a new file ``openacademy/wizard.py``: - - .. patch:: - Launching wizards ----------------- @@ -1416,28 +1195,16 @@ Wizards use regular views and their buttons may use the attribute #. Define a default value for the session field in the wizard; use the context parameter ``self._context`` to retrieve the current session. - .. only:: solutions - - .. patch:: - .. exercise:: Register attendees Add buttons to the wizard, and implement the corresponding method for adding the attendees to the given session. - .. only:: solutions - - .. patch:: - .. exercise:: Register attendees to multiple sessions Modify the wizard model so that attendees can be registered to multiple sessions. - .. only:: solutions - - .. patch:: - Internationalization ==================== @@ -1477,40 +1244,6 @@ for editing and merging PO/POT files. Choose a second language for your Odoo installation. Translate your module using the facilities provided by Odoo. - .. only:: solutions - - #. Create a directory ``openacademy/i18n/`` - #. You will need to activate the developer mode - to access the menus mentioned below ( - :menuselection:`Settings --> Activate the developer mode` - ) - #. Install whichever language you want ( - :menuselection:`Settings --> Translations --> Load a - Translation`) - #. Generate the missing terms (:menuselection:`Settings --> - Translations --> Application Terms --> Generate Missing Terms`) - #. Create a template translation file by exporting ( - :menuselection:`Settings --> Translations -> Import/Export - --> Export Translation`) without specifying a language, save in - ``openacademy/i18n/`` - #. Create a translation file by exporting ( - :menuselection:`Settings --> Translations --> Import/Export - --> Export Translation`) and specifying a language. Save it in - ``openacademy/i18n/`` - #. Open the exported translation file (with a basic text editor or a - dedicated PO-file editor e.g. POEdit_ and translate the missing - terms - - #. In ``models.py``, add an import statement for the function - ``odoo._`` and mark missing strings as translatable - - #. Repeat steps 3-6 - - .. patch:: - - .. todo:: do we never reload translations? - - Reporting ========= @@ -1599,10 +1332,6 @@ http://localhost:8069/report/pdf/account.report_invoice/1. For each session, it should display session's name, its start and end, and list the session's attendees. - .. only:: solutions - - .. patch:: - Dashboards ---------- @@ -1614,21 +1343,6 @@ Dashboards and automatically displayed in the web client when the OpenAcademy main menu is selected. - .. only:: solutions - - #. Create a file ``openacademy/views/session_board.xml``. It should contain - the board view, the actions referenced in that view, an action to - open the dashboard and a re-definition of the main menu item to add - the dashboard action - - .. note:: Available dashboard styles are ``1``, ``1-1``, ``1-2``, - ``2-1`` and ``1-1-1`` - - #. Update ``openacademy/__manifest__.py`` to reference the new data - file - - .. patch:: - WebServices =========== diff --git a/content/developer/howtos/backend/exercise-access-rights b/content/developer/howtos/backend/exercise-access-rights deleted file mode 100644 index 465dffea8..000000000 --- a/content/developer/howtos/backend/exercise-access-rights +++ /dev/null @@ -1,40 +0,0 @@ -# HG changeset patch -# Parent 303a5f4f011822dcb42b5833d579eabd3f03f4bf - -Index: addons/openacademy/__manifest__.py -=================================================================== ---- addons.orig/openacademy/__manifest__.py 2014-08-26 17:26:18.143783102 +0200 -+++ addons/openacademy/__manifest__.py 2014-08-26 17:26:18.135783102 +0200 -@@ -25,7 +25,8 @@ - - # always loaded - 'data': [ -- # 'security/ir.model.access.csv', -+ 'security/security.xml', -+ 'security/ir.model.access.csv', - 'templates.xml', - 'views/openacademy.xml', - 'views/partner.xml', -Index: addons/openacademy/security/ir.model.access.csv -=================================================================== ---- addons.orig/openacademy/security/ir.model.access.csv 2014-08-26 17:26:18.143783102 +0200 -+++ addons/openacademy/security/ir.model.access.csv 2014-08-26 17:26:18.135783102 +0200 -@@ -1,2 +1,5 @@ - id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink --access_openacademy_openacademy,openacademy.openacademy,model_openacademy_openacademy,,1,0,0,0 -+course_manager,course manager,model_openacademy_course,group_manager,1,1,1,1 -+session_manager,session manager,model_openacademy_session,group_manager,1,1,1,1 -+course_read_all,course all,model_openacademy_course,,1,0,0,0 -+session_read_all,session all,model_openacademy_session,,1,0,0,0 -Index: addons/openacademy/security/security.xml -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/security/security.xml 2014-08-26 17:26:18.135783102 +0200 -@@ -0,0 +1,7 @@ -+ -+ -+ -+ OpenAcademy / Manager -+ -+ -+ diff --git a/content/developer/howtos/backend/exercise-access-rules b/content/developer/howtos/backend/exercise-access-rules deleted file mode 100644 index d6290dfdb..000000000 --- a/content/developer/howtos/backend/exercise-access-rules +++ /dev/null @@ -1,27 +0,0 @@ -# HG changeset patch -# Parent 0602022dc2a428f9995c886df33b699b6d3bcb69 - -Index: addons/openacademy/security/security.xml -=================================================================== ---- addons.orig/openacademy/security/security.xml 2014-08-26 17:26:18.971783090 +0200 -+++ addons/openacademy/security/security.xml 2014-08-26 17:26:18.967783090 +0200 -@@ -3,5 +3,19 @@ - - OpenAcademy / Manager - -+ -+ -+ Only Responsible can modify Course -+ -+ -+ -+ -+ -+ -+ -+ ['|', ('responsible_id','=',False), -+ ('responsible_id','=',user.id)] -+ -+ - - diff --git a/content/developer/howtos/backend/exercise-advanced-treeview b/content/developer/howtos/backend/exercise-advanced-treeview deleted file mode 100644 index 3d674bb25..000000000 --- a/content/developer/howtos/backend/exercise-advanced-treeview +++ /dev/null @@ -1,19 +0,0 @@ -# HG changeset patch -# Parent f8d2422e87b3ff566dc947ad582608db3b15e077 - -Index: addons/openacademy/views/openacademy.xml -=================================================================== ---- addons.orig/openacademy/views/openacademy.xml 2014-08-26 17:26:09.283783234 +0200 -+++ addons/openacademy/views/openacademy.xml 2014-08-26 17:26:09.279783234 +0200 -@@ -116,9 +116,10 @@ - session.tree - openacademy.session - -- -+ - - -+ - - - diff --git a/content/developer/howtos/backend/exercise-basic-action b/content/developer/howtos/backend/exercise-basic-action deleted file mode 100644 index 277e88bed..000000000 --- a/content/developer/howtos/backend/exercise-basic-action +++ /dev/null @@ -1,54 +0,0 @@ -# HG changeset patch -# Parent 16e4cb131d9f7f3a72a8a1b0bc46c2ce9ac76435 -Index: addons/openacademy/__manifest__.py -=================================================================== ---- addons.orig/openacademy/__manifest__.py 2014-08-26 17:25:53.519783468 +0200 -+++ addons/openacademy/__manifest__.py 2014-08-26 17:25:53.511783468 +0200 -@@ -27,6 +27,7 @@ - 'data': [ - # 'security/ir.model.access.csv', - 'templates.xml', -+ 'views/openacademy.xml', - ], - # only loaded in demonstration mode - 'demo': [ -Index: addons/openacademy/views/openacademy.xml -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/views/openacademy.xml 2014-08-26 17:25:53.511783468 +0200 -@@ -0,0 +1,35 @@ -+ -+ -+ -+ -+ -+ -+ Courses -+ openacademy.course -+ form -+ tree,form -+ -+

Create the first course -+

-+
-+
-+ -+ -+ -+ -+ -+ -+ -+ -+ -+
diff --git a/content/developer/howtos/backend/exercise-calendar b/content/developer/howtos/backend/exercise-calendar deleted file mode 100644 index 1ef0cbe2c..000000000 --- a/content/developer/howtos/backend/exercise-calendar +++ /dev/null @@ -1,78 +0,0 @@ -# HG changeset patch -# Parent 85a8d7317b9e13480f39ad739955442d15144451 -# Parent 16fcdc4c6462a7872636f3c19550c16879af5281 - -diff --git a/openacademy/models.py b/openacademy/models.py ---- a/openacademy/models.py -+++ b/openacademy/models.py -@@ -1,5 +1,6 @@ - # -*- coding: utf-8 -*- - -+from datetime import timedelta - from odoo import models, fields, api, exceptions - - class Course(models.Model): -@@ -57,6 +58,8 @@ class Session(models.Model): - attendee_ids = fields.Many2many('res.partner', string="Attendees") - - taken_seats = fields.Float(string="Taken seats", compute='_taken_seats') -+ end_date = fields.Date(string="End Date", store=True, -+ compute='_get_end_date', inverse='_set_end_date') - - @api.depends('seats', 'attendee_ids') - def _taken_seats(self): -@@ -83,6 +86,27 @@ class Session(models.Model): - }, - } - -+ @api.depends('start_date', 'duration') -+ def _get_end_date(self): -+ for r in self: -+ if not (r.start_date and r.duration): -+ r.end_date = r.start_date -+ continue -+ -+ # Add duration to start_date, but: Monday + 5 days = Saturday, so -+ # subtract one second to get on Friday instead -+ duration = timedelta(days=r.duration, seconds=-1) -+ r.end_date = r.start_date + duration -+ -+ def _set_end_date(self): -+ for r in self: -+ if not (r.start_date and r.end_date): -+ continue -+ -+ # Compute the difference between dates, but: Friday - Monday = 4 days, -+ # so add one day to get 5 days instead -+ r.duration = (r.end_date - r.start_date).days + 1 -+ - @api.constrains('instructor_id', 'attendee_ids') - def _check_instructor_not_in_attendees(self): - for r in self: -diff --git a/openacademy/views/openacademy.xml b/openacademy/views/openacademy.xml ---- a/openacademy/views/openacademy.xml -+++ b/openacademy/views/openacademy.xml -@@ -125,11 +125,22 @@ - - - -+ -+ -+ session.calendar -+ openacademy.session -+ -+ -+ -+ -+ -+ -+ - - Sessions - openacademy.session - form -- tree,form -+ tree,form,calendar - - - - - -+ - - - - diff --git a/content/developer/howtos/backend/exercise-constraint-python b/content/developer/howtos/backend/exercise-constraint-python deleted file mode 100644 index 248507a24..000000000 --- a/content/developer/howtos/backend/exercise-constraint-python +++ /dev/null @@ -1,25 +0,0 @@ -# HG changeset patch -# Parent 7a7d003fe38426a405ce0657a627a139133ec4dd -# Parent 52f54b46487c8224a5aade4b921be77360ed3eae - -diff --git a/openacademy/models.py b/openacademy/models.py ---- a/openacademy/models.py -+++ b/openacademy/models.py -@@ -1,6 +1,6 @@ - # -*- coding: utf-8 -*- - --from odoo import models, fields, api -+from odoo import models, fields, api, exceptions - - class Course(models.Model): - _name = 'openacademy.course' -@@ -58,3 +58,9 @@ class Session(models.Model): - 'message': "Increase seats or remove excess attendees", - }, - } -+ -+ @api.constrains('instructor_id', 'attendee_ids') -+ def _check_instructor_not_in_attendees(self): -+ for r in self: -+ if r.instructor_id and r.instructor_id in r.attendee_ids: -+ raise exceptions.ValidationError("A session's instructor can't be an attendee") diff --git a/content/developer/howtos/backend/exercise-constraint-sql b/content/developer/howtos/backend/exercise-constraint-sql deleted file mode 100644 index 5595a6db3..000000000 --- a/content/developer/howtos/backend/exercise-constraint-sql +++ /dev/null @@ -1,24 +0,0 @@ -# HG changeset patch -# Parent 121bbfe120be3007f5e04611dbc27038abafcce8 - -Index: addons/openacademy/models.py -=================================================================== ---- addons.orig/openacademy/models.py -+++ addons/openacademy/models.py -@@ -14,6 +14,16 @@ - session_ids = fields.One2many( - 'openacademy.session', 'course_id', string="Sessions") - -+ _sql_constraints = [ -+ ('name_description_check', -+ 'CHECK(name != description)', -+ "The title of the course should not be the description"), -+ -+ ('name_unique', -+ 'UNIQUE(name)', -+ "The course title must be unique"), -+ ] -+ - - class Session(models.Model): - _name = 'openacademy.session' diff --git a/content/developer/howtos/backend/exercise-copy-override b/content/developer/howtos/backend/exercise-copy-override deleted file mode 100644 index 3099526ad..000000000 --- a/content/developer/howtos/backend/exercise-copy-override +++ /dev/null @@ -1,28 +0,0 @@ -# HG changeset patch -# Parent 7d14b75cdfd4c7a272a13572947de5d47f3e851f -# Parent f400352a70963801f0b4732d33a0183e4f6800ff - -diff --git a/openacademy/models.py b/openacademy/models.py ---- a/openacademy/models.py -+++ b/openacademy/models.py -@@ -14,6 +14,20 @@ class Course(models.Model): - session_ids = fields.One2many( - 'openacademy.session', 'course_id', string="Sessions") - -+ @api.multi -+ def copy(self, default=None): -+ default = dict(default or {}) -+ -+ copied_count = self.search_count( -+ [('name', '=like', u"Copy of {}%".format(self.name))]) -+ if not copied_count: -+ new_name = u"Copy of {}".format(self.name) -+ else: -+ new_name = u"Copy of {} ({})".format(self.name, copied_count) -+ -+ default['name'] = new_name -+ return super(Course, self).copy(default) -+ - _sql_constraints = [ - ('name_description_check', - 'CHECK(name != description)', diff --git a/content/developer/howtos/backend/exercise-creation b/content/developer/howtos/backend/exercise-creation deleted file mode 100644 index b5cf55584..000000000 --- a/content/developer/howtos/backend/exercise-creation +++ /dev/null @@ -1,152 +0,0 @@ -# HG changeset patch -# Parent 0000000000000000000000000000000000000000 -Index: addons/openacademy/__manifest__.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/__manifest__.py 2014-08-26 17:25:49.787783523 +0200 -@@ -0,0 +1,35 @@ -+# -*- coding: utf-8 -*- -+{ -+ 'name': "Open Academy", -+ -+ 'summary': """Manage trainings""", -+ -+ 'description': """ -+ Open Academy module for managing trainings: -+ - training courses -+ - training sessions -+ - attendees registration -+ """, -+ -+ 'author': "My Company", -+ 'website': "http://www.yourcompany.com", -+ -+ # Categories can be used to filter modules in modules listing -+ # Check https://github.com/odoo/odoo/blob/12.0/odoo/addons/base/data/ir_module_category_data.xml -+ # for the full list -+ 'category': 'Test', -+ 'version': '0.1', -+ -+ # any module necessary for this one to work correctly -+ 'depends': ['base'], -+ -+ # always loaded -+ 'data': [ -+ # 'security/ir.model.access.csv', -+ 'templates.xml', -+ ], -+ # only loaded in demonstration mode -+ 'demo': [ -+ 'demo.xml', -+ ], -+} -Index: addons/openacademy/__init__.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/__init__.py 2014-08-26 17:25:49.791783523 +0200 -@@ -0,0 +1,3 @@ -+# -*- coding: utf-8 -*- -+from . import controllers -+from . import models -Index: addons/openacademy/controllers.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/controllers.py 2014-08-26 17:25:49.791783523 +0200 -@@ -0,0 +1,20 @@ -+# -*- coding: utf-8 -*- -+from odoo import http -+ -+# class Openacademy(http.Controller): -+# @http.route('/openacademy/openacademy/', auth='public') -+# def index(self, **kw): -+# return "Hello, world" -+ -+# @http.route('/openacademy/openacademy/objects/', auth='public') -+# def list(self, **kw): -+# return http.request.render('openacademy.listing', { -+# 'root': '/openacademy/openacademy', -+# 'objects': http.request.env['openacademy.openacademy'].search([]), -+# }) -+ -+# @http.route('/openacademy/openacademy/objects//', auth='public') -+# def object(self, obj, **kw): -+# return http.request.render('openacademy.object', { -+# 'object': obj -+# }) -Index: addons/openacademy/demo.xml -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/demo.xml 2014-08-26 17:25:49.791783523 +0200 -@@ -0,0 +1,25 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -Index: addons/openacademy/models.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/models.py 2014-08-26 17:25:49.791783523 +0200 -@@ -0,0 +1,8 @@ -+# -*- coding: utf-8 -*- -+ -+from odoo import models, fields, api -+ -+# class openacademy(models.Model): -+# _name = 'openacademy.openacademy' -+ -+# name = fields.Char() -Index: addons/openacademy/security/ir.model.access.csv -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/security/ir.model.access.csv 2014-08-26 17:25:49.791783523 +0200 -@@ -0,0 +1,2 @@ -+id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink -+access_openacademy_openacademy,openacademy.openacademy,model_openacademy_openacademy,,1,0,0,0 -Index: addons/openacademy/templates.xml -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/templates.xml 2014-08-26 17:25:49.791783523 +0200 -@@ -0,0 +1,22 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ diff --git a/content/developer/howtos/backend/exercise-dashboard b/content/developer/howtos/backend/exercise-dashboard deleted file mode 100644 index 01876e651..000000000 --- a/content/developer/howtos/backend/exercise-dashboard +++ /dev/null @@ -1,95 +0,0 @@ -# HG changeset patch -# Parent 643813940cbea07bec792f9e1c60022a9292fa90 - -Index: addons/openacademy/__manifest__.py -=================================================================== ---- addons.orig/openacademy/__manifest__.py 2014-08-26 17:26:21.535783052 +0200 -+++ addons/openacademy/__manifest__.py 2014-08-26 17:26:21.531783052 +0200 -@@ -21,7 +21,7 @@ - 'version': '0.1', - - # any module necessary for this one to work correctly -- 'depends': ['base'], -+ 'depends': ['base', 'board'], - - # always loaded - 'data': [ -@@ -30,6 +30,7 @@ - 'templates.xml', - 'views/openacademy.xml', - 'views/partner.xml', -+ 'views/session_board.xml', - 'reports.xml', - ], - # only loaded in demonstration mode -Index: addons/openacademy/views/session_board.xml -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/views/session_board.xml 2014-08-26 17:26:21.531783052 +0200 -@@ -0,0 +1,66 @@ -+ -+ -+ -+ -+ Attendees by course -+ openacademy.session -+ form -+ graph -+ -+ -+ -+ Sessions -+ openacademy.session -+ form -+ calendar -+ -+ -+ -+ Courses -+ openacademy.course -+ form -+ tree,form -+ -+ -+ Session Dashboard Form -+ board.board -+ form -+ -+
-+ -+ -+ -+ -+ -+ -+ -+ -+ -+
-+
-+
-+ -+ Session Dashboard -+ board.board -+ form -+ form -+ menu -+ -+ -+ -+ -+ -+
diff --git a/content/developer/howtos/backend/exercise-defaults b/content/developer/howtos/backend/exercise-defaults deleted file mode 100644 index 6c61e9b1e..000000000 --- a/content/developer/howtos/backend/exercise-defaults +++ /dev/null @@ -1,28 +0,0 @@ -Index: addons/openacademy/models.py -=================================================================== ---- addons.orig/openacademy/models.py -+++ addons/openacademy/models.py -@@ -20,9 +20,10 @@ - _description = "OpenAcademy Sessions" - - name = fields.Char(required=True) -- start_date = fields.Date() -+ start_date = fields.Date(default=fields.Date.today) - duration = fields.Float(digits=(6, 2), help="Duration in days") - seats = fields.Integer(string="Number of seats") -+ active = fields.Boolean(default=True) - - instructor_id = fields.Many2one('res.partner', string="Instructor", - domain=['|', ('instructor', '=', True), -Index: addons/openacademy/views/openacademy.xml -=================================================================== ---- addons.orig/openacademy/views/openacademy.xml -+++ addons/openacademy/views/openacademy.xml -@@ -95,6 +95,7 @@ - - - -+ - - - diff --git a/content/developer/howtos/backend/exercise-demo b/content/developer/howtos/backend/exercise-demo deleted file mode 100644 index 50a956442..000000000 --- a/content/developer/howtos/backend/exercise-demo +++ /dev/null @@ -1,48 +0,0 @@ -# HG changeset patch -# Parent 84e2b0b43fc61fd0bcbb44c1929755d44ee58ae5 - -Index: addons/openacademy/demo.xml -=================================================================== ---- addons.orig/openacademy/demo.xml 2014-08-26 17:25:52.683783480 +0200 -+++ addons/openacademy/demo.xml 2014-08-26 17:25:52.679783480 +0200 -@@ -1,25 +1,19 @@ - - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -+ -+ Course 0 -+ Course 0's description -+ -+Can have multiple lines -+ -+ -+ -+ Course 1 -+ -+ -+ -+ Course 2 -+ Course 2's description -+ - - diff --git a/content/developer/howtos/backend/exercise-domain-advanced b/content/developer/howtos/backend/exercise-domain-advanced deleted file mode 100644 index 9b96a4459..000000000 --- a/content/developer/howtos/backend/exercise-domain-advanced +++ /dev/null @@ -1,42 +0,0 @@ -# HG changeset patch -# Parent 69d1f2d359eb8ef304a9d99f17790c78b35eda1a - -Index: addons/openacademy/models.py -=================================================================== ---- addons.orig/openacademy/models.py -+++ addons/openacademy/models.py -@@ -25,7 +25,8 @@ - seats = fields.Integer(string="Number of seats") - - instructor_id = fields.Many2one('res.partner', string="Instructor", -- domain=[('instructor', '=', True)]) -+ domain=['|', ('instructor', '=', True), -+ ('category_id.name', 'ilike', "Teacher")]) - course_id = fields.Many2one('openacademy.course', - ondelete='cascade', string="Course", required=True) - attendee_ids = fields.Many2many('res.partner', string="Attendees") -Index: addons/openacademy/views/partner.xml -=================================================================== ---- addons.orig/openacademy/views/partner.xml -+++ addons/openacademy/views/partner.xml -@@ -29,4 +29,20 @@ - parent="configuration_menu" - action="contact_list_action"/> - -+ -+ Contact Tags -+ res.partner.category -+ tree,form -+ -+ -+ -+ -+ Teacher / Level 1 -+ -+ -+ Teacher / Level 2 -+ -+ - diff --git a/content/developer/howtos/backend/exercise-domain-basic b/content/developer/howtos/backend/exercise-domain-basic deleted file mode 100644 index 71ee608cf..000000000 --- a/content/developer/howtos/backend/exercise-domain-basic +++ /dev/null @@ -1,17 +0,0 @@ -# HG changeset patch -# Parent 142c5065ff1b7266d944d4ef5239e814ae22f0df - -Index: addons/openacademy/models.py -=================================================================== ---- addons.orig/openacademy/models.py -+++ addons/openacademy/models.py -@@ -24,7 +24,8 @@ - duration = fields.Float(digits=(6, 2), help="Duration in days") - seats = fields.Integer(string="Number of seats") - -- instructor_id = fields.Many2one('res.partner', string="Instructor") -+ instructor_id = fields.Many2one('res.partner', string="Instructor", -+ domain=[('instructor', '=', True)]) - course_id = fields.Many2one('openacademy.course', - ondelete='cascade', string="Course", required=True) - attendee_ids = fields.Many2many('res.partner', string="Attendees") diff --git a/content/developer/howtos/backend/exercise-formview b/content/developer/howtos/backend/exercise-formview deleted file mode 100644 index 9f80bc2f7..000000000 --- a/content/developer/howtos/backend/exercise-formview +++ /dev/null @@ -1,29 +0,0 @@ -# HG changeset patch -# Parent 4a0db1d29257764f4df5cb1ee0be7e59e8c8d0d8 - -Index: addons/openacademy/views/openacademy.xml -=================================================================== ---- addons.orig/openacademy/views/openacademy.xml 2014-08-26 17:25:54.291783456 +0200 -+++ addons/openacademy/views/openacademy.xml 2014-08-26 17:25:54.283783457 +0200 -@@ -1,6 +1,21 @@ - - - -+ -+ course.form -+ openacademy.course -+ -+
-+ -+ -+ -+ -+ -+ -+
-+
-+
-+ - - -+
-+ -+ -+ - - Sessions - openacademy.session - form -- tree,form,calendar -+ tree,form,calendar,gantt - - - - - -+ -+ openacademy.session.graph -+ openacademy.session -+ -+ -+ -+ -+ -+ -+ -+ - - Sessions - openacademy.session - form -- tree,form,calendar,gantt -+ tree,form,calendar,gantt,graph - - - -+
-+ -+
-+ -+
    -+
  • -+ Delete -+
  • -+
  • -+
      -+ -+
    -+
-+
-+
-+
-+ -+ Session name: -+ -+
-+ Start date: -+ -+
-+ duration: -+ -+
-+ -+ -+ -+ -+ -+ -+ - - Sessions - openacademy.session - form -- tree,form,calendar,gantt,graph -+ tree,form,calendar,gantt,graph,kanban - - - - - -+