Commit Graph
12325 Commits
Author SHA1 Message Date
Pierre Paridans 9f7e6bb798 [IMP] web: Deactivate swipe between form view in mobile
The swipe between the form view is taking too long to load, and the pager is a
more clean option to switch between form view.
Moreover, the swipe on tabs is not clear anymore.

- Deactivate swipe between form view
- Swipe should only be available on tabs when tabs are too long to fit in one screen.

Was originally introduced by https://github.com/odoo/odoo/commit/f4ee61f950dc1eeb7b3653ca96ea72721512b5e5

Related task: 1924764

closes odoo/odoo#30413
2019-01-25 13:02:46 +00:00
Lucas Lefèvre ad0c5768f0 [IMP] hr_payroll: improve general usability
This commit improves general usability.

Specification
=============

Screens usability:

1/ Benefits
 1.1/ Calendar
    - Add a sidebar filter to filter employees. The filters are saved per user.
      If no filter exists for the user the 'Everybody' filter should be true by default.
    - Generate benefits when clicking on the menu -> remove the wizard (popup): generate benefits for all running contracts
    - Once generated, don't show again the generate benefits button: only show the Validate button
    - Generate Payslips button: remove the wizard. It generates payslip of validated benefits
      and jumps to the payslip batch form view.
 1.2/ Form:
    - rename: Start into "From"
    - rename: End into "To"
    - rename: Hours into "Period" (add 'hours' as unit on the right of the field)

2/ Payslip
 2.1/ Form:
    - Remove Payslip stat button.
    - a computed payslip should be editable

 2.2/ List:
    - show: Reference | Employee | Batch Name | From | To | Gross Salary | Net Salary | Status
    - In action buttons add a "Confirm" to confirm multiple payslips
    - add a quick search on contract
    - filters: rename 'draft' into "To Compute"
    - filter: add "To Confirm"

Menus:

1/ Salary Computation
    - Benefits (object: hr.benefit ;  view: calendar, list, form, pivot. Group: hr officer ;  filters: group by employee in the view)
    - Payslips (objetc: hr.payslip ; Views: list, form, pivot. Group: hr officer ; filters: last batch ; Sort: employee name alphabetically)
2/ Employee Payslips
    - Batches  (objetc: hr.payslip.run ;  Views:  list, form. Group: hr officer ; Sort: creation date (last one first)
    - All Payslips (objetc: hr.payslip ; Views:  list, form, pivot. Group: hr officer ; filters: no filters; Sort: employee name alphabetically)
3/ Configuration
    - Settings
    ---Salary---
	- Rules
	- Structure
	- Contributions Registers
    ---Benefits---
	- Benefits Type
    ---Repository---
	- Employees (list)
	- Contracts

When a benefit linked to a leave is cancelled, it should refuse the leave.
When a payslip batch is deleted, also delete associated payslips.
+ Refactoring of benefit js to use "Odoo style" event binding.
2019-01-18 15:19:35 +01:00
Lucas Lefèvre 70c6d3b04c [Fix] web: make sidebar filter generic
Adding `res_model` and `res_fields` attributes on a field of
a calendar view adds a filter in the sidebar.
It saves the result as the defined model and should save it
in the defined field.
However `partner_id` has been hardcoded in the rpc call that creates
the record. This breaks genericity, it cannot be used with another
field than `partner_id`.

This commit makes this generic by correctly setting the field name
in the rpc call.
2019-01-18 13:55:34 +01:00
Antoine GuenetandGorash eb0ea8efbe [ADD] web_editor,*: Tests for new structure of web editor
The refactoring also had to be done in order to create a set of unit
tests.
Each behavior can be tested, including the behaviors performed as a
consequence of keyboard interactions (for instance: Enter, Tab...).
This commit also contains some changes to test_utils that were
necessary given the new structure of the wysiwyg editor.

Co-authored-by: Gorash <chm@odoo.com>
2019-01-17 08:40:21 +00:00
Christophe MatthieuandAntoine Guenet f296992317 [IMP] web_editor,*: Refactoring the wysiwyg editor and 'html' field
* Creating a new structure by transforming all the plugins in the
  library using the odoo inheritance system. Plugins are easier to
  implement with the AbstractPlugin to add Odoo behaviors.

* From now on, the methods of the library (in this case Summernote) can
  no longer be called by other modules or files. Only the wysiwyg
  widgets can access it, to simplify the updating process. The wysiwyg
  object serves as an interface.

* Depending on the options the snippets will be loaded or not, the
  editor will be in an iframe or not... all of this is transparent from
  the outside.

* Regarding iframes, all controllers related to editing have been
  removed: the new API no longer needs them. This speeds up loading,
  eases testing and removes complexity for the same
  features.

PUBLIC FEATURES

There are several public methods on the Wysiwyg class:
* Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the
  library (xml, lazy, assets...) is loaded.
* Wysiwyg.getRange (DOM): returns the range (selection in the dom)
* Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates
  a range (selection in the dom)
* Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an
  element (option available to select all, start or end)

A jQuery selector was added: :o_editable, which indicates whether the
current element is editable. That is, if it is contained in a tag with
the attribute 'contentEditable = "true"' or in a tag with the class
o_editable.
Several methods are also present:
* focusIn: makes a focus and places the cursor at the beginning of the
  element
* focusInEnd: makes a focus and places the cursor at the end of the
  element
* selectContent: makes a focus and selects the content

HTML FIELD

The HTML field can receive different options:
* style-inline: {boolean} transforms a class into an inline style when
  saving and vice versa when reading.
* no-attachment: {boolean} prevents the use of attachments (in media
  dialog)
* cssEdit: {xml_id} to use a template containing the css to loaded in
  an iframe when editing
* cssReadonly: {xml_id} to use a template containing the css to load
  into an iframe when viewing in readonly
* snippets: {xml_id} snippets template (can be used with or without
  cssEdit)
* wrapper: {template} qweb static template (containing a tag:
  id = "wrapper") that will include the content during editing (removed
  on save)

MASS MAILING

A widget was created for mass mailing. There are now two fields:
body_html and body_arch.
body_arch contains the code with the class without conversion into
inline style, useful when editing and one with the inline style that is
visible in readonly mode and sent by email.
Advantage: no spreading errors, able to update css/theme, able to do
more changes when converting to inline style so that a maximum of mail
clients have an impeccable rendering.

Co-authored-by: Antoine Guenet <age@odoo.com>
2019-01-17 08:40:21 +00:00
Christophe Matthieu de444335b7 [REF] web_editor,*: Move and rename files to prepare refactoring
The refactoring of the wysiwyg editor and 'html' field allows us to
move some of the code that was in web_editor but only used in website or
in mass_mailing. Some parts are still in web_editor but will be
moved at a later time.
2019-01-17 08:40:21 +00:00
jem-odoo 958342bf16 [IMP] web: add example kanban background
The background example is a set of random fake column and card,
directly inspired from the kanban example modal.

We want to toggle this background depending on the kanban state;
the background will be displayed when there is no column yet,
and the quick create column is shown.

To do so, we need to update the state of the kanban when deleting
a column to (re)display the background in case of removal of the
last column. Now, on column deletion, the entire kanban is updated
and so entirely rerender (with aab's benediction).

Task-1893021
2019-01-16 08:28:09 +00:00
jem-odoo 92b6ea64ab [IMP] web: make kanban example support state bullets 2019-01-16 08:28:09 +00:00
jem-odoo 4b4e8508ef [IMP] project: improve kanban example sentences
This commit improves the sentences used in the kanban
example modal in order to be more concrete and precised
for the users

Task-1893021
2019-01-16 08:28:09 +00:00
jem-odoo e7268c201e [IMP] web: make kanban create button jump
This commit makes the create button of a kanban view
jumping when the user click on some zone on the kanban
background.
The purpose here is to educate the user, so he can learn
how to create its first kanban card.

Task-1893021
2019-01-16 08:28:09 +00:00
mgh-odoo 9ee9724a10 [Generic] unaccent search
- added unaccent search on POS customer/partner and product
- moved unaccent from "mail.utils" to "web.utils"
- added more character to make function accurate

We might use str.normalize(from ES6) but the problem is str.normalize method can not consider some double characters i.e. accented character when normalized it returns 2 normal characters and normalize method returns single character, so here custom unaccent method is used to normalize the string

What we can improve here: We can use str.normalize method and check if string is still have unaccented charaters that we can call our unaccent method but this unaccent method is also working and performing well

closes odoo/odoo#27671
2019-01-10 12:31:53 +00:00
qsm-odoo f87e56c571 [FIX] web, website: adapt accordion to bootstrap update
Some update to the accordion component made it incompatible with some of
our customization.
2019-01-09 14:03:48 +00:00
qsm-odoo 827f30abf1 [FIX] web: adapt the color-yiq BS function
Odoo overrides the color-yiq function of bootstrap to improve it. With
the last update, BS changed its signature so Odoo had to change it to.
2019-01-09 14:03:47 +00:00
qsm-odoo 0f6f108cbe [FIX] web: adapt BS import and assets to BS update 2019-01-09 14:03:47 +00:00
qsm-odoo f4503d09dc [FIX] web: remove bootstrap sourceMappingURL
Same as https://github.com/odoo/odoo/commit/8e17223c260add842d83b2549d7bdaa4c3cc4d6c
2019-01-09 14:03:47 +00:00
qsm-odoo 63e52e6acf [IMP] web: update bootstrap from 4.1.3 to 4.2.1
This commit only updates the existing bootstrap files and add the new
ones the update brings.
2019-01-09 14:03:47 +00:00
Christophe Simonis d7c5bc02cc [MERGE] forward port branch saas-12.1 up to 8aa8548d8a 2019-01-09 19:59:27 +01:00
Martin Geubelle b4e9410f6a [IMP] web: use showSearchInput in model field selector
The option `showSearchInput`, which is used on the model field selector to display a search
input that filters the displayed fields, is not set by default.

This includes the model field selector instantiated in the `domain` field widget.

closes odoo/odoo#29986
2019-01-08 13:46:01 +00:00
Géry Debongnie 68eefe3cee [FIX] web: do not render invisible filters in search view
In some cases, the web client may receive a search view with invisible
filters.  This is due to the way field_view_get works.  For
example, if there is a group on a filter, then this will be transformed
into an invisible attribute.

In that case, the search view should simply ignore the filter and not
display it.  This was broken in the recent control panel refactoring
(note that the search view lacked the possibility of testing that kind
of situation).

closes odoo/odoo#29430
cherry-pick of 13aae100e2

closes odoo/odoo#29965
2019-01-06 16:54:29 +00:00
qsm-odoo 52ec536cef [REF] *: make stronger bootstrap assets
* portal, theme_bootswatch, web, web_editor, website

With less2sass and bs3tobs4 tasks, the assets structure was reviewed to
handle the specificities of both framework and to prepare for our next
odoo tasks. In particular, the assets_helpers and bootstrap overrides
were basically split into 4 parts: utils, primary variables, secondary
variables and bootstrap variables.
(see https://github.com/odoo/odoo/commit/6e4db7d13a926845bf82f5b035afede42d6d5a89)

Using the !default system for the bootstrap variables parts seems now
a good improvement. This is part of what this commit does: adding the
default flag for all bootstrap variables overrides and inverting the
order of the files in the _assets_backend_helpers and
_assets_frontend_helpers templates. This allows to avoid code like this:

portal:
```
$body-bg: white;
```

website:
```
@​if $var != null {
    $body-bg: $var;
}
```

This code makes the body white with portal or equal to $var with website
if $var has a value. The same behavior in the new file order is achieved
with:

website:
```
$body-bg: $var !default;
```

portal:
```
$body-bg: white !default;
```

This order is now also followed for the _assets_secondary_variables
templates (there are only a few).

This commit also make better assets hierarchy by making website inherit
from portal assets (instead of web) and portal inherit from web_editor
assets (instead of web) (thus relying on strong dependencies instead of
installation order which is not always right for migrated databases).

closes odoo/odoo#29757
2018-12-26 17:25:23 +00:00
Aaron Bohy 4df0a1e31a [FIX] web: wrong tests
This commit fixes two tests that became meaningless after tweaks
in production code:

 - form_tests: use two char fields, as integer fields can't be
   unset since rev. c62a4edcb
 - pivot_tests: the button is disabled since rev. 4f4f111, but
   simulating a click with jQuery bypasses the disabled attribute

This commit also removes unecessary overrides of mockRPC. Those
overrides existed  because the attachments part of the sidebar
used to make a search_read RPC, but this has been removed at rev.
1dbb555.

closes odoo/odoo#28650
2018-11-13 19:56:55 +00:00
Lucas Perais (lpe) 7525455534 [WIP] looking good babe 2018-11-13 16:40:30 +00:00
Aurélien Warnon e3246845c3 [FIX] web: fix KanbanRenderer state management for date/datetime fields
In the KanbanRenderer, the _setState method extracts the groupBy field name and tries
to get the field information from that string.

When the field is a date/datetime grouped by day/week/month/..., the field name becomes "my_date:month".
This prevents the gathering of state information since those information are stored in a dictionary with a 'my_date' key.

This commit will detect if the field has additional grouping info (:month, :week, ...) and clean the name
with a substring before accessing the state dictionary.
2018-12-19 09:10:34 +00:00
Aurélien Warnon 06c05983e3 [FIX] web: fix KanbanRecord config in KanbanRenderer
The KanbanRecord config was not correctly taken into account when
initializing the columnOptions (for the KanbanColumn).

This completely prevented overriding the KanbanRecord in the kanban view if the KanbanColumn
was used for rendering (= when the view was grouped by a field).
2018-12-12 07:39:40 +00:00
Xavier Morel 43e062fabf [FIX] *: JS doc/docstring errors & warnings
closes odoo/odoo#29439
2018-12-11 15:24:09 +00:00
Christophe Monniez ab376d60cb [FIX] web: adapt clickeverywhere test to the controlpanel refactor
Since 4cd379cf6e the ControlPanel is now a child of the viewController.
This breaks the clickEveryWhere test.

With this commit, the view_controller selector is adapted in the clickEverywhere
test.

cheery-pick of 5e92adb39c

closes odoo/odoo#29396
2018-12-10 15:59:07 +00:00
Lucas Perais (lpe) 3a0f9da0eb [FIX] web: load SubViews without previous' view _view_ref context keys
On a form view (of model A), define a many2one (model B) with a [form|tree]_view_ref context key
In that view, have a x2m field (model C) with a different [form|tree]_view_ref context key

Before this commit, the second load_views (i.e. on the model C) crashed because
the wrong context key was sent to the server, which returned the view to which the _view_ref points
i.e. the view of the model B

After this commit, we clean the context of subviews loading, because those keys are only useful for the python
and one shot. Hence, there is no crash

OPW 1903780

closes odoo/odoo#28260
2018-11-13 09:02:24 +00:00
Vincent Schippefilt fe7fd9c0d7 [FIX] web: fix qweb test that fails on windows
When the qunit tests runs they are expecting the new line to be the character 10,
but in windows the new line is 10+13.
The test has been updated to ignore the character 13.

closes odoo/odoo#28599
2018-11-13 08:14:07 +00:00
Aaron Bohy ce611ae439 [FIX] web: wrong tests
This commit fixes two tests that became meaningless after tweaks
in production code:

 - form_tests: use two char fields, as integer fields can't be
   unset since rev. c62a4edcb
 - pivot_tests: the button is disabled since rev. 4f4f111, but
   simulating a click with jQuery bypasses the disabled attribute

This commit also removes unecessary overrides of mockRPC. Those
overrides existed  because the attachments part of the sidebar
used to make a search_read RPC, but this has been removed at rev.
1dbb555.

closes odoo/odoo#28651
2018-11-13 20:00:17 +00:00
Lucas Perais (lpe) 293f9d27ad [WIP] another testable solution 2018-11-12 16:12:29 +00:00
Lucas Perais (lpe) bd83517fec [FIXUP] testable solution 2018-11-12 15:29:07 +00:00
Lucas Perais (lpe) c346428397 [FIX] web: search input date in another timezone
Put the browser in timezone Sao Paulo (Or like West of UTC)

Trigger the autocomplete (and the subsequent search) on a date field
by writing a date (in the locale format) in the search view

Before this commit, the domain sent to the server contained the date as the day
**before** the one asked for in the input

This is because, the string input is parsed and gives:
input = 12/02/2018
When creating the moment object:
> since there is no explicit time, moment will interpret it as 12am (midnight)
> We force moment to consider the string as being UTC (function: moment.utc())
> the moment contains, as output the time ** 2018-02-12T00:00:00 UTC **

When getting the facet value for making the domain
> we call toDate on the moment object, which, according to the browser is UTC and will
be converted to the locale timezone before formatting
> And the domain will use the date 2018-02-11T22:00:00 Brazil/SaoPaulo
which gives the day before the one we asked for

After this commit, this issue doesn't arise, because we use the string representation of
the moment object in search_inputs (i.e 2018-02-12T00:00:00 UTC), to create a new one
*BUT* we create it with a date format that excludes the time from being interpreted.
Also, the resulting moment object in this case is not flagged as UTC anymore

OPW 1903224
2018-11-12 14:07:36 +00:00
Lucas Perais (lpe) e713ed2a69 [FIX] web: implement filter orderedBy
related to: #28446

On a pure list view, click on a column to sort the records by that field.

Save the filter as favorite

Reload, now apply the filter

Before this commit, there were two issues:
1. The order of the list was never propagated to search view, which couldn't save
the filter with its attribute "sort"

2. There was no mechanism to load the attribute sort from a loading Filter

After this commit, those two issues are corrected
Unfortunately, complex search view flows are not testable in v11.0

OPW 1906968

closes odoo/odoo#28766
2018-11-20 13:53:52 +00:00
Nicolas Martinelli 7e840a39a6 [FIX] web: External Link
In the case of a One2many list view in a `<group>` tag, the 'External
Link' button of a Many2one field (which allows opening the form view) is
not visible.

The `flex: 1 0 auto;` should not be applied in the list view.

Corresponding PR in v12: #28741
opw-1903158

closes odoo/odoo#28812
2018-11-19 19:21:38 +00:00
Nicolas Lempereur cac9173122 [FIX] web: m2o+o2m in o2m onchange no lose data
Steps:

- open a modal form view from tree view first line and make a change
- open a modal from the second line and make a change
- open the second line back: the change were lost

In a given number of conditions (a many2one inside the form view, there
is a one2many in the form view not inside the tree view, ....) this
happened because:

- when we save the first line, we get onchange data for the second one
- this onchange data can't be applied before second line is loaded, but
  it is saved so it can be applied if second line is ever opened
- when the second line is opened the saved change is applied => OK
- when the second line is opened a second time the saved change is
  applied again, possibly overwriting posterious change => BAD

With this changeset, when the record with unapplied onchange is loaded
for the first time, the unapplied onchange is applied only once.

Added test without the change failed with:

- only 1 turtle for second partner (result: 0 not 1)
- second partner turtle is Michelangelo (result: "" not "Michelangelo")

opw-1846820
closes #28644
2018-11-19 12:57:52 +00:00
Odoo Translation Bot 1da3ff5a0a [I18N] Update translation terms from Transifex 2018-11-18 03:15:42 +01:00
Vincent Schippefilt 98936f79a1 [REF] web: split relational fields tests into multiple files
The file relation_fields_tests.js was a huge 12K lines files for which some editors have a
hard time managing.

We have split it in 4 files to be more managable and removed remove unused data
and import.

closes odoo/odoo#28561
2018-11-12 12:36:53 +00:00
Christophe Simonis 99d0e1b80e [MERGE] forward port branch 12.0 up to a403155dec 2018-11-12 13:06:48 +01:00
Odoo Translation Bot 8d77288a8c [I18N] Update translation terms from Transifex 2018-11-11 03:16:11 +01:00
Jeremy Kersten ae3997b8bf [FIX] web: guess resize placeholder
Before this commit, if you ask for a small image, you was waiting a picture of
64x64 but in case this image was not found, a placeholder with an other size
was returned.

Now, we try to guess the asked size, and return a resized placeholder.

This bug appear since we change the default placeholder picture with a big one

This will fix several issue and avoid to hard code size everywhere in the code

Eg: commit 92f837c and commit https://github.com/odoo/odoo/commit/154fc7d9dd550d35b7266af024e54c20e18938fc#diff-9af1af2039d16d6b544d481b4ee1ed7cR144

closes odoo/odoo#27695
2018-11-06 18:37:29 +01:00
Odoo Translation Bot dcc077afc5 [I18N] Update translation terms from Transifex 2018-11-11 01:26:46 +01:00
Aaron Bohy 45bc7c92f8 [FIX] web: extend the fieldsInfo of a view with the origin view to evaluate extra fields
Suppose you are editing a SO to add a new line. Depending on the configuration,
a sale order line wizard may open (e.g. if packages are activated).
This wizard is a form view, opened from the tree view of the sale order lines.
We have commit 8e5156938a
that adds extra fields from the originating view.
(However it doesn't work if the other view is inlined, so we modify this part to
add the extra field even in this case.)
Then we need the field info from the origin view in the target view;
we do so by extending the former with the content of the latter.

opw 1904337

closes odoo/odoo#28441
2018-11-09 15:04:18 +00:00
Lucas Perais (lpe) 23313583b2 [FIX] web: progressbar updates on field reset
Have a form record with a progress bar
Modify the max_value of the progress, as well as the current_value bar through an onchange

Before this commit, the new max_value was not taken into account

After this commit, it is.

closes odoo/odoo#29056
2018-11-27 08:53:17 +00:00
Lucas Perais (lpe) ac5a1662f2 [FIX] web: propagate can_create into the search popup
When creating a SO line and clicking on search more for product_id

Before this commit, every user had the button "Create" to create a product.product

After this commit, only user in groups that actually can create a product have the button

OPW 1910371

closes odoo/odoo#28924
2018-11-26 14:54:21 +00:00
Lucas Perais (lpe) c9e32872c0 [FIX] web: list default_sort with multiple fields
Define a x2m tree view with a default_sort including more than 1 field to order the list against

Before this commit, the second field was never used

After this commit, it is used

OPW 1909785

closes odoo/odoo#28840
2018-11-26 09:28:55 +00:00
Odoo Translation Bot 387c1edb9c [I18N] Update translation terms from Transifex 2018-11-25 03:17:33 +01:00
Christophe Simonis c6e7adfb95 [REV] web: revert f8b38f64 "keep col group by on 2nd reload"
It broke other pivot tests.

closes odoo/odoo#31630

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-06 12:28:02 +00:00
Olivier Dony ffc6df3c99 [REV] web: revert 08b2d1f9 "margin-top on top of report"
This reverts commit 08b2d1f9ac and the
subsequent commit a75533daf2be325e059f0d4badfb0cf3a2f7590f, because they
caused more problems than they solved.

Not only did we get issues with missing footers in some cases, but the
address box also gets misplaced on the left in many layouts.

See #31184, #31533, #31531
See opw-1925894 (reason for patch), opw-1948160 and similar ones (regressions)

Closes #31626
2019-03-06 12:23:36 +01:00
Christophe Simonis afe0133302 [MERGE] forward port branch saas-11.3 up to 3e54704e66 2019-03-06 10:59:32 +01:00
Odoo Translation Bot 77692a84be [I18N] Update translation terms from Transifex 2019-03-03 01:36:23 +01:00