diff --git a/doc/_extensions/odoo_ext/static/style.css b/doc/_extensions/odoo_ext/static/style.css index f721ec371c9..f7e15f8f028 100644 --- a/doc/_extensions/odoo_ext/static/style.css +++ b/doc/_extensions/odoo_ext/static/style.css @@ -1298,7 +1298,7 @@ small, mark, .mark { background-color: #fcf8e3; - padding: .2em; + padding: 0.2em; } .text-left { text-align: left; @@ -1601,13 +1601,71 @@ pre code { margin-left: -15px; margin-right: -15px; } -.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { +.col-xs-1, +.col-sm-1, +.col-md-1, +.col-lg-1, +.col-xs-2, +.col-sm-2, +.col-md-2, +.col-lg-2, +.col-xs-3, +.col-sm-3, +.col-md-3, +.col-lg-3, +.col-xs-4, +.col-sm-4, +.col-md-4, +.col-lg-4, +.col-xs-5, +.col-sm-5, +.col-md-5, +.col-lg-5, +.col-xs-6, +.col-sm-6, +.col-md-6, +.col-lg-6, +.col-xs-7, +.col-sm-7, +.col-md-7, +.col-lg-7, +.col-xs-8, +.col-sm-8, +.col-md-8, +.col-lg-8, +.col-xs-9, +.col-sm-9, +.col-md-9, +.col-lg-9, +.col-xs-10, +.col-sm-10, +.col-md-10, +.col-lg-10, +.col-xs-11, +.col-sm-11, +.col-md-11, +.col-lg-11, +.col-xs-12, +.col-sm-12, +.col-md-12, +.col-lg-12 { position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px; } -.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { +.col-xs-1, +.col-xs-2, +.col-xs-3, +.col-xs-4, +.col-xs-5, +.col-xs-6, +.col-xs-7, +.col-xs-8, +.col-xs-9, +.col-xs-10, +.col-xs-11, +.col-xs-12 { float: left; } .col-xs-12 { @@ -1764,7 +1822,18 @@ pre code { margin-left: 0%; } @media (min-width: 768px) { - .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { + .col-sm-1, + .col-sm-2, + .col-sm-3, + .col-sm-4, + .col-sm-5, + .col-sm-6, + .col-sm-7, + .col-sm-8, + .col-sm-9, + .col-sm-10, + .col-sm-11, + .col-sm-12 { float: left; } .col-sm-12 { @@ -1922,7 +1991,18 @@ pre code { } } @media (min-width: 992px) { - .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { + .col-md-1, + .col-md-2, + .col-md-3, + .col-md-4, + .col-md-5, + .col-md-6, + .col-md-7, + .col-md-8, + .col-md-9, + .col-md-10, + .col-md-11, + .col-md-12 { float: left; } .col-md-12 { @@ -2080,7 +2160,18 @@ pre code { } } @media (min-width: 1200px) { - .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { + .col-lg-1, + .col-lg-2, + .col-lg-3, + .col-lg-4, + .col-lg-5, + .col-lg-6, + .col-lg-7, + .col-lg-8, + .col-lg-9, + .col-lg-10, + .col-lg-11, + .col-lg-12 { float: left; } .col-lg-12 { @@ -4827,7 +4918,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { } .label { display: inline; - padding: .2em .6em .3em; + padding: 0.2em 0.6em 0.3em; font-size: 75%; font-weight: bold; line-height: 1; @@ -4835,7 +4926,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { text-align: center; white-space: nowrap; vertical-align: baseline; - border-radius: .25em; + border-radius: 0.25em; } a.label:hover, a.label:focus { @@ -6756,11 +6847,11 @@ button.close { } [class^="mdi-"].pull-left, [class*="mdi-"].pull-left { - margin-right: .3em; + margin-right: 0.3em; } [class^="mdi-"].pull-right, [class*="mdi-"].pull-right { - margin-left: .3em; + margin-left: 0.3em; } [class^="mdi-"].mdi-lg:before, [class*="mdi-"].mdi-lg:before, @@ -9293,6 +9384,16 @@ h6 { color: white; } } +.footnote-ref { + vertical-align: super; + font-size: 1ex; +} +.footnote-ref:before { + content: '['; +} +.footnote-ref:after { + content: ']'; +} article.doc-body > section { padding-bottom: 10px; } @@ -10585,7 +10686,7 @@ main.index .card figcaption { background-repeat: no-repeat; display: none; } -@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { +@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .o_main_header > .o_main_header_main > .o_primary_nav .o_secondary_nav > .container > .row > div .o_nav_app_family > span { background-image: url("img/2x_apps_families_s.png"); } @@ -11645,7 +11746,7 @@ aside { } body main article h2, body main article .h2 { - font-size: 1.642857143em; + font-size: 1.64285714em; } body main article h3, body main article .h3 { diff --git a/doc/_extensions/odoo_ext/static/typography.less b/doc/_extensions/odoo_ext/static/typography.less index 6c535739f6d..c22541843c4 100644 --- a/doc/_extensions/odoo_ext/static/typography.less +++ b/doc/_extensions/odoo_ext/static/typography.less @@ -33,6 +33,13 @@ h1, h2, h3, h4, h5, h6 { border-bottom: 2px solid #f4f6f7; } +.footnote-ref { + &:before {content: '[';} + &:after {content: ']';} + vertical-align: super; + font-size: 1ex; +} + article.doc-body { // Vertical rhythm @@ -171,4 +178,4 @@ article.doc-body { background-color: #fff7d1; } } -} \ No newline at end of file +} diff --git a/doc/howtos/backend.rst b/doc/howtos/backend.rst index b34bd5ddcaa..5a967c6ea97 100644 --- a/doc/howtos/backend.rst +++ b/doc/howtos/backend.rst @@ -275,6 +275,8 @@ be declared in the ``'data'`` list (always loaded) or in the ``'demo'`` list :ref:`odoo-bin -u openacademy ` to save the changes to your database. +.. _howtos/module/actions: + Actions and Menus ----------------- @@ -375,6 +377,8 @@ lists all the fields to display in the table (each field as a column): +.. _howtos/module/views/form: + Form views ---------- @@ -1353,6 +1357,8 @@ the same convention as the method :meth:`~odoo.models.Model.write` of the ORM. .. patch:: +.. _howto/module/wizard: + Wizards ======= @@ -1389,27 +1395,33 @@ session, or for a list of sessions at once. Launching wizards ----------------- -Wizards are launched by ``ir.actions.act_window`` records, with the field -``target`` set to the value ``new``. The latter opens the wizard view into a -popup window. The action may be triggered by a menu item. +Wizards are simply :ref:`window actions ` with a ``target`` +field set to the value ``new``, which opens the view +(usually :ref:`a form `) in a separate dialog. The +action may be triggered via a menu item, but is more generally triggered by a +button. -There is another way to launch the wizard: using an ``ir.actions.act_window`` -record like above, but with an extra field ``binding_model_id`` that specifies in the -context of which model the action is available. The wizard will appear in the -contextual actions of the model, above the main view. Because of some internal -hooks in the ORM, such an action is declared in XML with the tag ``act_window``. +An other way to launch wizards is through the :menuselection:`Action` menu of +a tree or form view. This is done through the ``binding_model_id`` field of the +action. Setting this field will make the action appear on the views of the model +the action is "bound" to. .. code:: xml - + + Launch the Wizard + wizard.model.name + form + new + + -Wizards use regular views and their buttons may use the attribute -``special="cancel"`` to close the wizard window without saving. +.. tip:: + + While wizards use regular views and buttons, normally clicking any button in + a form would first save the form then close the dialog. Because this is + often undesirable in wizards, a special attribute ``special="cancel"`` is + available which immediately closes the wizard without saving the form. .. exercise:: Launch the wizard @@ -1523,24 +1535,35 @@ Odoo uses a report engine based on :ref:`reference/qweb`, A report is a combination two elements: -* an ``ir.actions.report``, for which a ```` shortcut element is - provided, it sets up various basic parameters for the report (default - type, whether the report should be saved to the database after generation,…) - +* an ``ir.actions.report`` which configures various basic parameters for the + report (default type, whether the report should be saved to the database + after generation,…) .. code-block:: xml - + + Invoices + account.invoice + qweb-pdf + account.report_invoice + account.report_invoice + + (object.state in ('open','paid')) and + ('INV'+(object.number or '').replace('/','')+'.pdf') + + report + + + .. tip:: + + Because it largerly a standard action, as with :ref:`howto/module/wizard` + it is generally useful to add the report as a *contextual item* on the + tree and / or form views of the model being reported on via the + ``binding_model_id`` field. + + Here we are also using ``binding_type`` in order for the report to be in + the *report* contextual menu rather than the *action* one. There is no + technical difference but putting elements in the right place helps users. * A standard :ref:`QWeb view ` for the actual report: @@ -1556,13 +1579,13 @@ A report is a combination two elements: - the standard rendering context provides a number of elements, the most - important being: + the standard rendering context provides a number of elements, the most + important being: - ``docs`` - the records for which the report is printed - ``user`` - the user printing the report + ``docs`` + the records for which the report is printed + ``user`` + the user printing the report Because reports are standard web pages, they are available through a URL and output parameters can be manipulated through this URL, for instance the HTML diff --git a/doc/howtos/backend/exercise-report b/doc/howtos/backend/exercise-report index 68cc7b4b12e..9cf3e990f91 100644 --- a/doc/howtos/backend/exercise-report +++ b/doc/howtos/backend/exercise-report @@ -13,20 +13,22 @@ Index: addons/openacademy/__manifest__.py ], # only loaded in demonstration mode 'demo': [ -Index: addons/openacademy/reports.xml +Index: foo/openacademy/reports.xml =================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ addons/openacademy/reports.xml 2014-08-29 08:41:12.663540061 +0200 -@@ -0,0 +1,30 @@ +--- /dev/null ++++ foo/openacademy/reports.xml +@@ -0,0 +1,32 @@ + + -+ ++ ++ Session Report ++ openacademy.session ++ qweb-pdf ++ openacademy.report_session_view ++ openacademy.report_session ++ ++ report ++ + + + * If it appears that your PDF report is missing the styles, please check :ref:`these instructions `. @@ -282,12 +237,16 @@ Example:: Custom Reports ============== -The report model has a default ``get_html`` function that looks for a model -named :samp:`report.{module.report_name}`. If it exists, it will use it to -call the QWeb engine; otherwise a generic function will be used. If you wish -to customize your reports by including more things in the template (like -records of others models, for example), you can define this model, overwrite -the function ``_get_report_values`` and pass objects in the ``docargs`` dictionary: +By default, the reporting system builds rendering values based on the target +model specified through the ``model`` field. + +However, it will first look for a model named +:samp:`report.{module.report_name}` and call that model's +``_get_report_values(doc_ids, data)`` in order to prepare the rendering data for +the template. + +This can be used to include arbitrary items to use or display while rendering +the template, such as data from additional models: .. code-block:: python @@ -296,16 +255,24 @@ the function ``_get_report_values`` and pass objects in the ``docargs`` dictiona class ParticularReport(models.AbstractModel): _name = 'report.module.report_name' - @api.model def _get_report_values(self, docids, data=None): - report_obj = self.env['ir.actions.report'] - report = report_obj._get_report_from_name('module.report_name') - docargs = { - 'doc_ids': docids, - 'doc_model': report.model, - 'docs': self, + # get the report action back as we will need its data + report = self.env['ir.actions.report']._get_report_from_name('module.report_name') + # get the records selected for this rendering of the report + obj = self.env[report.model].browse(docids) + # return a custom rendering context + return { + 'lines': docids.get_lines() } - return docargs + +.. warning:: + + When using a custom report, the "default" document-related items + (``doc_ids``, ``doc_model`` and ``docs``) will *not* be included. If you + want them, you will need to include them yourself. + + In the example above, the rendering context will contain the "global" values + as well as the ``lines`` we put in there but nothing else. .. _reference/reports/custom_fonts: @@ -351,4 +318,9 @@ For example, you can access a Sale Order report in html mode by going to Or you can access the pdf version at \http:///report/pdf/sale.report_saleorder/38 +.. [#unzoned] it does not matter what timezone the :class:`python:datetime` + object is actually in (including no timezone), its timezone will + unconditionally be *set* to UTC before being adjusted to the + user's + .. _wkhtmltopdf: https://wkhtmltopdf.org