Commit Graph
10240 Commits
Author SHA1 Message Date
Hiral Bhavsar da7b59045d [IMP] base_import, web: add view switcher and h 'Import' button in mobile
As there are a few chance that someone will import something on a mobile view.
So, we hide the button 'Import' in a mobile view.

For mobile view, we added a view switcher button and it'll display a list of
views buttons. Also set active view's icon as its icon.

Related to Task: 1857696
Co-authored-by: Mohammed Shekha <msh@openerp.com>
2018-07-25 12:48:38 +02:00
Martin Trigaux 7c8c27b9a9 [ADD] web: easy to change noupdate value
It is currently difficult to mark a record as noupdate
Make it doable in one click.

The choice of what should and should not be on noupdate is personal and depends
of the company need and how technical are the users.

Problem raised at #25748
The res.lang records are typically complicated and changing the date format may
break the database. Keeping it in noupdate=0 makes sense for most use but allow
to change it if needed.

Closes #25759
2018-07-25 11:17:51 +02:00
Christophe Simonis ba202dbe63 [MERGE] forward port branch saas-11.2 up to 3c521f6d05 2018-07-24 18:10:32 +02:00
Christophe Simonis 3c521f6d05 [MERGE] forward port branch 11.0 up to c51488c2f4 2018-07-24 16:43:26 +02:00
Alexandre Kühn b67b89c315 [FIX] web: correctly align value/text in stat button
Before this commit, the style of the value and text in some stat buttons were
broken.

The design of the stat button is to have a single value and a single text which
are stacked as follow:

  [CSS]                       [Visually]           [Example]

  .o_stat_info                +---------+          +------------+
     .o_stat_value            |         |          |            |
     .o_stat_text             |  value  |          | 10         |
                              |  text   |          | Forecasted |
                              |         |          |            |
                              +---------+          +------------+

However, some stat buttons use multiple values or texts. For example:

  [CSS]                       [Visually]           [Example]

  .o_stat_info                +-------------+      +------------+
     .o_stat_value            |             |      |            |
        .o_stat_info          |  value text |      | 3 Hour(s)  |
          .o_stat_value       |  text       |      | Lost       |
          .o_stat_text        |             |      |            |
     .o_stat_text             +-------------+      +------------+

  [CSS]                       [Visually]           [Example]

  .o_stat_info                +---------------+    +---------------+
     .o_stat_text             |               |    |               |
     .o_stat_text             |  text  value  |    |  Min:  10.00  |
  .o_stat_info                |  text  value  |    |  Max:  20.00  |
     .o_stat_value            |               |    |               |
     .o_stat_value            +---------------+    +---------------+

The latter is works fine with block, which guarantees vertical alignment.
However, the former case has some alignment issues like this:

    [Visually]

    +------------+
    |            |
    | 3          |
    |   Hour(s)  |
    | Lost       |
    |            |
    +------------+

This is due to the use of `display:block` for any `.o_stat_text` and `.o_stat_text`.

This commit fixes this issue, without affecting the other cases.

Task-ID 1841523
2018-07-24 12:51:14 +02:00
Xavier Morel a56372a4ca [FIX] various broken JS docstrings
Resulting in sphinx warnings or ill-formatted doc all the way to the
doc not building at all.
2018-07-24 12:06:13 +02:00
Christophe Simonis 4e76173a43 [MERGE] forward port branch 11.0 up to 219d2296d6 2018-07-23 16:03:25 +02:00
Priyanka Kakadiya 78a6124d5a [FIX] web: no traceback on button call action of type 'button'.
Before this commit, there was a traceback when clicking on a button
that generates a button call action with type `'button'`.

This is due to the handler of such an action that assumes only a small
set of button actions. Each of those cases correctly sets the local
variable `def` to a deferred, so that the post-processing is correct
(i.e. it handles this variable as a deferred). However, this is wrong
with a different button call action, so that this variable is `undefined`
instead of a deferred.

This commit fixes the issue by ensuring that the variable `def` is always
a deferred. As a result, the post-processing can make the correct assumption
that this variable is a deferred.

Steps to reproduce:

 - Install Google Drive Integration app
 - Go to General Settings
 - In the category "Google Drive", click on "Get Authorization Code"
   (displayed as "Get Author...")

Task-ID 1861630
2018-07-23 13:48:09 +02:00
Kishan Gajjar 7fa1525921 [FIX] web: correctly render "font awesome" icons on buttons
Revision on https://github.com/odoo/odoo/commit/9de1bc0

From the commit above, the style of some field binary images are broken.
This is due to changes from `<span>` to `<button>`. The style has been
altered by the default browser's style, which does the following on
Google Chrome:

```
    border-color: white;
    border: 1px solid;
    padding: 1px 7px 2px;
```

Most browsers set a border and some padding on buttons. This commit fixes
the style specifically for "font awesome" icons on buttons, by removing
the border and by overwriting the padding.

Tested browsers:

  - Google Chrome 67
  - Mozilla Firefox 61
  - Safari 11

Task-ID 1864027

Closes #25691
2018-07-23 13:34:33 +02:00
eco-odoo 872cf9160d [FIX] web: controller update now waits for _update to resolve
Before this, the deffered returned by _update was not taken into
account.
2018-07-20 11:59:12 +02:00
eco-odoo c1498ff36b [IMP] web: add option to display a banner above a view
Add a banner_route attribute to AbstractView to allow fetching html from a
controller route and displaying it above the view.

The initial use case was the onboarding panels.

Supported views are the ones inheriting both AbstractView and AbstractController.
2018-07-20 11:59:12 +02:00
eco-odoo 0dd6a0b2bf [IMP] web: core: ajax: loadCSS now returns a promise
It is useful to know when the stylesheet has been loaded in order to prevent displaying unstyled content.

CalendarView and the dashboard_graph widget (JournalDashboardGraph) use loadCSS through cssLibs / loadLibs so the tests now have to use createAsyncView instead of createView.
2018-07-20 11:59:12 +02:00
eco-odoo 7c6bc684a9 [IMP] base: some cleaning in general settings
Use a new view to choose the document template.
Remove layout fields from base company form.
Reword Edit Header -> Edit Layout
Set a default logo for a new company in data instead of demo data

task: 60668
2018-07-20 11:59:12 +02:00
Christophe Simonis 49f634e472 [MERGE] forward port branch saas-11.4 up to 1f7a39964b 2018-07-19 16:36:03 +02:00
Christophe Simonis 1f7a39964b [MERGE] forward port branch saas-11.3 up to 0c42dcfc22 2018-07-19 15:36:54 +02:00
len-odoo bc12428e17 [FIX] web: format value of statinfo widget
The value of the statinfo widget is rendered by the qweb after a t-esc.
Say if the python rounding returned 14.0000000001
(supposed to be a two digits precision number through the magic of floats)
then the statinfo widget would print it as-is.

We now format the value at assignation.

opw 1865426
2018-07-19 13:19:09 +02:00
Christophe Simonis e5fab318d9 [MERGE] forward port branch saas-11.2 up to 02f38beffb 2018-07-18 17:59:23 +02:00
Christophe Simonis 5b9a51bb1d [MERGE] forward port branch 11.0 up to 44b77d3702 2018-07-17 17:48:34 +02:00
Jigar Patel b60de0db41 [IMP] import/export UIs
Task 40692

Various changes to import/export (mainly) UIs:

* default to excel & "full" (non-import-compatible) export
* auto-detect encoding of CSV using chardet
* remember column -> field mapping after having imported a file (useful
   for repeated imports where auto-matching failed)
* better handle localised booleans & column names
* automatically select source list view's fields when exporting
* better integrate import templates feature and add a number of templates
2018-07-17 15:19:05 +02:00
Ravi Gadhia 762adedece [IMP] various: improve section and add note on sale order and invoice
The goal is to be able to more easily create section and notes on sale order, invoice, and quote.

================================
Problems of the existing feature
================================

The problematic part in the existing feature was that the same section had to be defined again and again for every line, instead of being defined only once where it needed to be. There was also no easy way to move them. Those concerns are solved here.

Moreover, due to the complexity of the feature, it was hidden by default, requiring a setting and multiple overrides. The new feature is simple enough that it will always be present.

==================
New implementation
==================

Sections are lines solely used for display purpose, there is no business logic attached to them. They will show as a nice header at the top of the section, and a subtotal at the bottom of the section.

We also take the opportunity to add notes, which are just like sections except they are displayed differently and don't include a subtotal.

=========
Reasoning
=========

We decided to implement it this way, as opposed to creating a proper section model, because it creates less changes in the code.

Creating a intermediary section model between the sale order/invoice/quote and their lines would have required to rewrite the entirety of the code associated to them. It would also have required to create a new JS widget to handle on the same view a double-level One2many (or a One2many + group by).

The current solution is much easier because it just requires adding 2 buttons, 1 simple field on the corresponding models which even has a NULL default value, and making some business checks (don't apply business to section/note).

We tried our best to impact as less as possible the existing models. Notably we didn't want to add any extra field if this was avoidable. This also makes the migration easier.

No matter the implementation choice the views/reports had to be updated to display the sections and notes correctly, which has been done.

===========
Limitations
===========

The current solution has several limitations:

* since the sections don't have business logic, it's not possible to make any reporting based on them

* any business related to sections has to be computed on the fly by browsing in order all of the lines, notably the subtotal has to be computed on the fly at every display

- when sections are moved (drag&drop) on the back-end, the following lines that are part of the section are not moving with the section

===========
Technically
===========

The commit will:

* update the models to add the display_type field (along with related sql constraints to guarantee integrity)

* add new buttons at the bottom of the lists to allow creating section and note, along with the existing add a line/product button

* add some business checks to not apply business to section/note (product_id and account_id became non-required fields)

!!! The most likely cause of potential bugs introduced in this commit would be to have forgotten to add those checks on some places where they would be needed. This is tedious to check but fortunately easy to fix.

* update the views to display sections and notes correctly, also made various improvements/fixes to those views (notably to apply B2B/B2C setting more consistently)

!!! This is the second likely cause of potential bugs: if the updated views are inherited in a way that is not compatible with the changes. Or if we forgot to apply the changes to some other views. Again this is tedious to check but fortunately easy to fix.

Task #53996
PR #25209
2018-07-17 11:50:35 +02:00
Sébastien Theys 73d54999df [IMP] web: make X2Many Renderer more extensible
This allows a custom widget to cleanly override the Renderer of a X2Many.

PR #25209
2018-07-17 11:50:35 +02:00
Sébastien Theys f241441433 [IMP] web: add control + create tags to customize "add a line"
The default "add a line" button creates a new line with the default values from the model. Sometimes we want to create a new line with different default values (or more generally a customized context), which is possible with this commit. Moreover it is possible to create multiple buttons for multiple default values/contexts.

This works both for in-line creation ("editable=") and dialog creation.

The new tags are:

<control> defines custom controls for the current view.

Does not support any attribute, but can have children:

<create> adds a button to create a new element on the current list.

This makes sense when the parent tree view is inside a One2many field.

If any create is defined, it will overwrite the default "add a line" button.

For more information and example, have a look at the Views documentation.

Technically, the commit will:
- parse the new XML tags (+ add appropriate validation)
- display the buttons based on the XML
- on button click/keyboard: pull up the additional context information from the button event up to the default_get
- add unit tests
- add documentation

PR #25209
2018-07-17 11:50:35 +02:00
Sébastien Theys d1f1cc9c27 [FIX] web: prevent tab shortcut from crashing when no input field
Currently, using the shortcut "tab" inside a list will crash if the list has no input field (ex. if it has only a textarea field).

This commit prevents the bug.

Also moved the test for the orderedResIDs crash in the correct module.

PR #25209
2018-07-17 11:50:35 +02:00
Christophe Simonis 3656999f5e [MERGE] forward port branch saas-15 up to f0e280e5eb 2018-07-16 17:53:02 +02:00
Christophe Simonis f0e280e5eb [MERGE] forward port branch saas-14 up to ed99894ac6 2018-07-16 16:40:46 +02:00
Christophe Simonis ed99894ac6 [MERGE] forward port branch 10.0 up to 13e321325b 2018-07-16 16:25:59 +02:00
Alexandre Kühn 3210f10827 [IMP] web: provide infos for close action
With this commit, when we perform a close action, we can provide infos to
the `on_close` handler, so that it can handle different cases that caused
the close action.
2018-07-16 14:08:40 +02:00
Christophe Simonis 182c2c6919 [MERGE] forward port branch saas-11.4 up to 8285630ad2 2018-07-16 12:34:20 +02:00
len-odoo 02afc0e0aa [FIX] web: groupby product on package types triggers a js error
On a database where many modules are installed (e.g.  runbot all), with
the option "manage available packaging options per products", doing a groupby
"product" on the "package type" list view triggers a js error.
It comes from the fact that the fixed_group variable contains a "length"
attribute; the _().each function uses this to determine (erroneously)
that the object is an array.
It thus uses fixed_group[0] to get an undefined, and then tries to access
a method of undefined.

We replace the each by a simple js loop.

opw 1863576
2018-07-16 08:47:06 +02:00
Xavier Morel 233874d5ef [IMP] web: use builtin crash manager hooks for special handling
* having a special case for session expiration seems unnecessary when
  the CM specifically supports hooking on the exception name
* and properly implement the special handling of HTTP 504 (Gateway
  Timeout) from #24854 using that same hook
2018-07-13 17:31:23 +02:00
Xavier Morel 35d452cffb [IMP] web: replace iframe-based get_file by XHR
The error handling in get_file has always been somewhat problematic
(sarcasm ho!). Pending PR #24854 attempts to add special handling for
gateway timeout aside from its base stuff, and that's really quite
terrible due to get_file's limitation of only being able to read the
content of the document loaded in the iframe (no proper access to status
codes & al).

That was the occasion to look up modern API and see if we could do
file downloads in JS without iframe crap.

Turns out we can: xhr2 is well supported so we can POST, get a blob
back, and create a "local download" for that in-memory blob using either
a[download] (most browsers) or msSaveBlob (IE10+, that's actually a
convenient-to-great API and it's a shame there's nothing like it in the
standard).

The changes are not trivial but save ~30LOC and most of the overhead
is replicating the old/weird error handling as that requires
additionally decoding the blob to a string & parsing that string to
a document before being able to get the content (whereas before we'd
just access to the document loaded in the iframe).

OTOH we can now properly forward non-200 status codes to the
crash manager (as name) which will allow using regular CM hooks to
provide custom warning and error messages.

Note that this requires two libraries:

* a stripped down version of the content-disposition NPM lib, as
  download file names are provided via that header and parsing the
  header is decidedly non-trivial
* the download.js library as it handles the various edge cases from
  different browsers, I'm don't think all of it is necessary for our
  use case but the library is not that big so no real point in trying
  to strip it out and potentially break it in the process
2018-07-13 17:31:22 +02:00
Christophe Simonis 8285630ad2 [MERGE] forward port branch saas-11.3 up to 609491ad0e 2018-07-13 17:12:07 +02:00
Christophe Simonis f3929aa0f7 [MERGE] forward port branch saas-11.2 up to 87dadc5bc8 2018-07-13 14:32:05 +02:00
Christophe Simonis c952a11770 [MERGE] forward port branch 11.0 up to 6e6e3d4c96 2018-07-13 10:47:18 +02:00
qsm-odoo dc9f942e0a [FIX] website, *: restore publish buttons' design
* web

Those were broken with https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548
This commit takes advantage of the bug to also improve their design and
html validity a little bit.
2018-07-12 17:13:23 +02:00
Lucas Perais (lpe) c9a2b9a00a [FIX] web: keep searchview floating content on update
In a search view, write text in the input, then hit enter to select
the facet.

Before this commit, the search view was detached and then reattached
when the control panel was refreshed. This led to loosing the focus
momentarily and erasing any supplementary input one might have typed
*during* the rpc call.

After this commit, if the search view is the same as before, we don't
detach it in the first place. Thus, the input is conserved in this
situation.

OPW 1861941
OPW 185614t

closes #25546
2018-07-12 13:01:05 +02:00
RomainLibert 8a21e27377 [IMP] web: add auto sorting on pivot view
We add the attribute default_order on the pivot view (already present in
graph view), this attribute will sort the pivot view on the given
measure.

Closes: #25675
2018-07-11 13:47:01 +02:00
RomainLibert dc75248b89 [IMP] web: sort measures in graph view and pivot view 2018-07-10 12:25:24 +02:00
qsm-odoo 2c966909e2 [FIX] *: fix some side-effects of https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548
- JS Modals were not correctly built anymore, their .modal-body element
  was duplicated and many without-effect JS lines were introduced (as a
  side effect, the form view design was broken when inside modals)

- Tests were changed to make bugs go unnoticed. For example, the media
  dialog functionnality was entirely broken because the .modal-dialog
  element was not receiving the correct class anymore.

- The JS translation function is _t, not _

- Do not use the <title/> tag as a regular DOM element, it is meant to
  be unique, in the <head/> section

- CSS rules were added to the utils.scss file, which is meant to contain
  functions and mixins, otherwise, the rule is duplicated in every asset

- Some icons were still broken, as missed by https://github.com/odoo/odoo/commit/f90cf060a3cfeb37a67bec83264c0aaab8892b56

- Tests were changed to use [role="dialog"]/footer/header in their
  selectors without any reason, this commit restores some of that to
  avoid rebase conflicts with the BS4 work.

- ...

Note: other elements should still be discussed, like the direct use of
the 'o_form_label' class in views definition... but those do not cause
direct problems.
2018-07-09 11:59:30 +02:00
Adrien Dieudonne a548e77b6f [FIX] web: groups of filters ordered correctly
In the filters menus, the order of groups of filters comming
from the search view arch was not always preserved in the filters menu.
This commit fixes that situation.

forward-port of @4094f755
2018-07-06 15:39:06 +02:00
Mathieu Duckerts-Antoine dc1904d3ab [FIX] web: manage correctly deletion of facets
This commit fixes many synchronization problems between search view bar
and the filters and groupby menus.

forward-port of @94c027efd
2018-07-06 14:30:40 +02:00
Mathieu Duckerts-Antoine 097464de6f [IMP] web: easy selection of a period in filters menu
This commit allow to create easily a range of periods (related to a field
of date or datetime type) to select in the filters menu.

Two new attributes on elements with tag 'filter' are now usable
in combination in a search view arch:

- date: string.

		A valid field name with associated type date or datetime

- default_period: string (optional).

		To choose in the following list:
			- 'today'
			- 'this_week'
			- 'this_month' (default)
			- 'this_quarter'
			- 'this_year'
			- 'yesterday'
			- 'last_week'
			- 'last_month'
			- 'last_quarter'
			- 'last_year'
			- 'last_7_days'
			- 'last_30_days'
			- 'last_365_days'

Example:

<filter string="Creation Date" name="period_generator" date="create_date" default_period="this_quarter"/>

Note: the attribute 'domain' can not be used for such filters.
The generated domains are dynamic and can be saved as such
via the favorites menu.
2018-07-06 14:09:09 +02:00
Géry Debongnie 9756109e67 [IMP] web: add tz_offset function in python eval context 2018-07-06 14:09:09 +02:00
Mathieu Duckerts-Antoine 5d3f42a9ad [IMP] web: implement assemble domain utility function
In this commit, we implement a function which allow to combine
a list of domains into a single normalized using a 'OR' or an
'AND' operator.
We also refactor slightly py_utils.
2018-07-06 14:09:09 +02:00
Géry Debongnie 0194d85b67 [IMP] web: implement normalize domain utility function
In this commit, we implement a function which normalize a domain
represented as a py.js syntax tree.
2018-07-06 14:09:09 +02:00
Géry Debongnie 3248498f48 [IMP] web: implement formatAST utility function
In this commit, we implement a function which format a py.js abstract
syntax tree into a string.  This is really useful whenever we need to
manipulate python expressions.
2018-07-06 14:09:09 +02:00
Géry Debongnie eed4d586a0 [REF] *: rename web.pyeval into web.py_utils
The pyeval name is quite confusing, given that there is already an eval
and an evaluate function in py.js, and that the web.pyeval exports two
evaluate functions.

Since this file is more about odoo specific customization to py.js, it
is renamed in py_utils to better express its intended use.
2018-07-06 14:09:09 +02:00
Géry Debongnie dcc4d71623 [REF] web: move some code from pyeval to lib py_extras
Some functions that were in web.pyeval were actually "odoo independant".
To make them easier to manage/understand, this commit move them in the
library py.js, as an extra file.
2018-07-06 14:09:09 +02:00
Mathieu Duckerts-Antoine 64f3580af7 [IMP] web: add support of modulo in pyeval 2018-07-06 14:09:09 +02:00
Mathieu Duckerts-Antoine c71148cc70 [DOC] web: amelioration of inline documentation 2018-07-06 14:09:09 +02:00