Commit Graph
808 Commits
Author SHA1 Message Date
Vincent Schippefilt 09125f78c3 [IMP] web: allow usage of computed unstored fields in pivot views 2018-05-15 14:55:00 +02:00
eco-odoo b19b9e756c [FIX] web: click on <a> with type="action" triggers the correct action
Without this fix, clicks on <a> with a sub html tag do not work.
2018-05-14 09:44:16 +02:00
qsm-odoo b2ad88e38d [FIX] web: form buttons should always get a btn style class
Here is the story of the problem: back in 10.0, everything *seemed*
fine with button rendering except it was very messy duplicated codes.
The system was still not consistent:

-> In Header, button with:
no class -> btn-default
btn-primary -> btn-default btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-default btn-link
oe_link -> btn-default oe_link
btn-danger -> btn-default btn-danger
some_class -> btn-default some_class

-> Not in header, button with:
no class -> no class
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> oe_link
btn-danger -> btn-danger
some_class -> some_class

So, outside the header, the system seemed to not process anything except
transforming the oe_highlight class. In the header, the btn-default was
always added, except if using the oe_highlight class. The style is fine
for those, except for .btn-default.btn-link and .btn-default.oe_link
where the link class has no effect (which is fine as header are not
supposed to contain links).

In 11.0, the new views were introduced alongside websitepocalypse. The
new system led to:

-> In Header, button with:
no class -> btn-default
btn-primary -> btn-default btn-primary
oe_highlight -> btn-default oe_highlight
btn-default -> btn-default
btn-link -> btn-default btn-link
oe_link -> btn-default oe_link
btn-danger -> btn-default btn-danger
some_class -> btn-default some_class

-> Not in header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> oe_highlight
btn-default -> btn-default
btn-link -> btn-link
oe_link -> oe_link
btn-danger -> btn-danger
some_class -> some_class

So, it worsened the header buttons by not processing the oe_highlight
class and adding the btn-default class in all cases. This is even
worse since in 11.0 .btn-default.btn-link do have a specific style and
thus not appear as .btn-default anymore. Those may be invisible "bugs"
though as .btn-link are not supposed to be in header and oe_highlight
is styled correctly in css. For buttons outside the header, a little
processing was added to add "btn-default" class for buttons which did
not specify a class (and oe_highlight is not processed anymore there
too).

In master, with the less2scss task, the system had to change again but
led this time to visible bugs:

-> In Header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> btn-link
btn-danger -> btn-danger
some_class -> some_class

-> Not in header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> btn-link
btn-danger -> btn-danger
some_class -> some_class

As you can see, the system is now the same for both header button and
normal buttons. The system is also better for all cases as it produce
only *one* *bootstrap* class for all cases. However, the problematic
case is the last one for header buttons: it did not receive the
btn-default class automatically. Even though this is the API for the
rest of odoo (dialogs, renderButton (old WidgetButton), ...), this is
a problem here as fixing this would require to add the 'btn-default'
class in every view which is using this case.

While waiting for a better solution, this commit is instead forcing
the btn-default class in that header case only (so only when a class
was mentioned but it did not contain any bootstrap btn type class).
So the new system gives:

-> In Header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> btn-link
btn-danger -> btn-danger
some_class -> btn-default some_class

-> Not in header, button with:
no class -> btn-default
btn-primary -> btn-primary
oe_highlight -> btn-primary
btn-default -> btn-default
btn-link -> btn-link
oe_link -> btn-link
btn-danger -> btn-danger
some_class -> some_class

This commit also adds tests which will prevent the system to change
again without noticing it.

Closes https://github.com/odoo/odoo/pull/24443
2018-04-26 16:23:39 +02:00
04c44c479d [IMP] base(_import),web: mute Add/Create button in x2m
... by setting it 'btn-default', because users hesitate between
that button, and those in the control panel.

Task 32950

Co-authored-by: dbh <dbh@odoo.com>
Co-authored-by: aab-odoo <aab@odoo.com>
2018-04-25 15:09:35 +02:00
Aaron Bohy f85a54257d [FIX] web: BasicRenderer: button's name attr in DOM
Rev. 374af56 changed the way 'button' nodes are rendered in basic
views (form, list, kanban). As a consequence, their 'name'
attribute wasn't transmitted to the produced html elements anymore.
However, this attribute is very convenient to debug views, and to
write selectors in tests. For instance, it broke the test added by
rev. 8d17a2a once forwardported in master.

This commit reverts 1ce5bea.
2018-04-25 15:08:53 +02:00
Hiral BhavsarandMohammed Shekha 5c651a09e1 [IMP] web: Kanban: allow to archive/restore column records
This feature has been removed in rev. odoo/odoo@e533085 but this commit
reintroduces it. It was considered as "too dangerous" for new users.

Instead of removing the feature, a confirmation request has been added to warn
the user about his potentially harmful action.

The same warning has also been added in List view when archiving records.

Task 60393

Co-authored-by: Mohammed Shekha <msh@openerp.com>
2018-04-25 09:50:44 +02:00
Christophe Simonis b192431aee [MERGE] forward port branch saas-11.3 up to ec5e27bb7c 2018-04-24 17:42:41 +02:00
Christophe Simonis ec5e27bb7c [MERGE] forward port branch saas-11.2 up to 7fd9dbdd9f 2018-04-24 16:35:06 +02:00
Christophe Simonis 7fd9dbdd9f [MERGE] forward port branch 11.0 up to b9ce1affbf 2018-04-24 15:55:17 +02:00
Mohammed Shekha c1bf1c6a54 [FIX] web: preserve new column order after creation
When a user creates a new column in a kanban view, leave the action and
comes back, the order is not preserved.  With this commit, we force a
call to resequence to ensure that the order does not change.
2018-04-24 10:18:33 +02:00
Christophe Simonis 1f22b81203 [MERGE] forward port branch saas-11.2 up to 7113b70762 2018-04-23 19:36:25 +02:00
Christophe Simonis e8bf128318 [MERGE] forward port branch 11.0 up to 3ab25b60bc 2018-04-23 18:15:25 +02:00
Christopher Ormaza 30490cae89 [FIX] web: handle nested x2m default values
The initial rev. odoo/odoo@2d3ecf2 that was supposed to handle this use case
was in fact only dealing with one command as default value for nested x2m, not
more.

The basic model can now handle multiple commands.

Closes #24241
2018-04-23 17:35:03 +02:00
pka-odooandMohammed Shekha 3fd24cba2a [FIX] web: calendar: show Undefined label if sidebar filter has no value
and keep all those filters at last. (PR#20463)

e.g. If field used in color attribute of calendar view does not have value then such sidebar filters will not have string besides filter checkbox
in such cases we should set Undefined string and put all those filters at last in filter list
Currently we can see issue in calendar of manufacturing orders in db with demo data

Related to Issue #1778360

Co-authored-by: Mohammed Shekha <msh@openerp.com>
2018-04-20 16:29:50 +02:00
Géry Debongnie 47cf31b539 [FIX] web: prevent web client from blocking some view
In some situations, it could happen that the action manager had a
rejected deferred representing the creation of a view, and was blocked
from doing any other interaction with that view.

For example, imagine that a read operation crashes for record 1 on the
model res.partner.  If the user is on the kanban view and click on
record 1, there will be an error dialog informing him of the error.
However, if the user clicks then on another record, nothing will happen
because the action manager is blocked (only the form view in this case).

With this commit, whenever the view creation process failed, we also
remove the rejected deferred so the action manager will be allowed to
try again.
2018-04-20 14:24:21 +02:00
Christophe Matthieu 07cd24b1ec [IMP] web: convert notification popup in service and add buttons params
this.call('web.Notification', 'notify', params)

Display a notification at the appropriate location, and returns the
reference id to the same widget. Note that this method does not wait
for the appendTo method to complete.

@param {Object} params
@param {string} params.title notification title
@param {string} params.message notification main message
@param {string} params.type 'notification' or 'warning'
@param {boolean} [params.sticky=false] if true, the notification will stay
  visible until the user clicks on it.
@param {string} [params.className] className to add on the dom
@param {function} [params.onClose] callback when the user click on the x
  or when the notification is auto close (no sticky)
@param {Array<Object>} params.buttons
@param {function} params.buttons[0].click callback on click
@param {Boolean} [params.buttons[0].primary] display the button as primary
@param {string} [params.buttons[0].text] button label
@param {string} [params.buttons[0].icon] font-awsome className or image src
@returns {Number} notification id

this.call('web.Notification', 'close', notificationId)
2018-04-19 17:17:54 +02:00
Géry Debongnie b8bf945335 [FIX] web: do not change pager when discarding changes
Here is a scenario that could happen before this commit:
1. go to a list view with more than one record, say 3
2. click on the 3rd record to open the form view
3. the pager says 3/3
4. click on edit button
5. click on discard button
6. the pager says 1/3 (but the record displayed is still the same)

It is often necessary to restore the offset for the sub records, because
the number of pages in a one2many could have changed.  However, it is
not a good idea to do that for the main record, since it interferes with
the usual flow of operations.
2018-04-19 17:15:26 +02:00
Christophe Simonis e56be854ab [MERGE] forward port branch saas-11.3 up to 204935119d 2018-04-19 11:58:44 +02:00
Christophe Simonis c309ccd7b3 [MERGE] forward port branch saas-11.2 up to fed775bc0c 2018-04-18 18:30:35 +02:00
Christophe Simonis fed775bc0c [MERGE] forward port branch 11.0 up to 8c64159b88 2018-04-18 18:20:40 +02:00
Aaron Bohy 05589db823 [FIX] web: don't ignore required attrs on image fields
Before this rev., falsy image fields could be saved even if they
were required.
2018-04-18 17:40:09 +02:00
qsm-odoo 1a007c1a96 [REF] *: stop mentioning "LESS" where this is not required
* web, web_editor, website, im_livechat
2018-04-18 15:59:07 +02:00
qsm-odoo e88913bd28 [IMP] web, *: do not use 'oe_highlight' and 'oe_link' class in the DOM
* test_main_flows

The style of a primary/link button is given by the
'btn-primary'/'btn-link' class. The old 'oe_highlight'/'oe_link'
class should still be supported in views but not rendered in the DOM.
2018-04-18 14:47:42 +02:00
Mathieu Duckerts-Antoine d082fa0d95 [REF] web: simplify calls to read_group in pivot model
The commit [3079415fb17232117b0d5059a23ae89232eaf5e8] allows the read_group groupby parameter not to be contained in the fields parameter. This makes possible the simplification made here. Similar changes could certainly be applied elsewhere.
2018-04-18 11:38:57 +02:00
Christophe Simonis 0cd2cff259 [MERGE] forward port branch saas-11.3 up to fdef30fc29 2018-04-17 16:24:27 +02:00
Martin Geubelle cd934f307d [FIX] web: handle x2m commands with reference as default
Before this rev. it was not possible to define a value for a reference field
in x2m commands as default value.

Courtesy of @kaerdsar.

Closes #24070
2018-04-17 15:31:33 +02:00
Martin Geubelle 9e6c616130 [FIX] web: focus select in reference widget
In the reference widget, the focus was always on the input (many2one) even
though the first select (with the model) was not set.

Thanks to @kaerdsar for the original PR.

Partially closes #24070
2018-04-17 15:31:32 +02:00
Lucas Perais (lpe) df02dc37fd [FIX] web: pivot: correctly save and restore groupbys on rows and cols
On a pivot view expand a field in column
another one in row
Then put a domain in the search view
Save the whole thing (ir.filter) as favorite

Before this commit, the ir.filter was not saved the right way when a domain was present
(Let alone its restoration)
This was because of
- the internal default groupbys of the pivot model was not updated, and what we got in the params was overwritten
by what existed before
- a slight typo in the code made the row updated with the col values

OPW 1835865
OPW 1829925

closes #24215
2018-04-17 13:43:46 +02:00
Christophe Simonis 5dca782100 Revert "[FIX] web: remove &shy; when saving phone number"
This reverts commit b8b0f947bf.
2018-04-16 20:26:21 +02:00
Christophe Simonis 74033eb007 [MERGE] forward port branch saas-11.2 up to 90f8f17fb4 2018-04-16 19:50:50 +02:00
Christophe Simonis 5f2d080cf8 [MERGE] forward port branch 11.0 up to ad825b673b 2018-04-16 18:34:56 +02:00
Nicolas Lempereur 7680635c54 [FIX] web: setDate mixing utc+tz and local date
In the calendar view there is some mixing of moment with:

- a local date with given timezone
- a UTC date with added timezone manually applied

The setDate function of calendar model sometimes received either of the
two types, and always transforms them to UTC date with added timezone.

This cause eg. the following issues:

- in the minicalendar, if we click on a day (eg. 12) the day highlighed
  will be the one of 12th at midnight with timezone applied. So with a
  negative timezone the 11th would be highlighted in the mini calendar
  (but the 12th would still be the day shown).

- if we change scale (week/day/month) or open calendar or use next or
  previous button: we call `setDate` with a UTC+timezone moment. So each
  time this is done, we get an additional timezone

  eg. when opening the calendar view on the 12th at 5:00 with GMT-0200:
      -> the target date is 12th at 1:00
      -> if we set the day mode: target date is 11th at 23:00
      -> if we set the week mode: target date is 11th at 21:00

With this change we keep target_date and highlight_date as local date so
setDate always receives a local date and jquery-ui DatePicker gets the
date in the expected format.

opw-1831368
closes #24188
2018-04-16 00:22:18 -12:00
Vincent Schippefilt 263f81f65d [FIX] web: allow default behavior for unmanaged keyboard navigation
Reproduce the issue:
- open the manual reconciliation (it is a client action)
- add a reconciliation (using the + sign)
- expand it (using the > sign)
- put the focus on the first field and hit TAB
--> you would expect that the focus moves to the second field
--> what happens is: the focus stays on the first field

Before this fix, when in a client action (or any place that contains
fields) that contains fields, the keyboard navigation did not occur
correctly because the default behavior of the TAB key was prevented.

After this fix, if the navigation_move event was not stopped, we allow
the default behavior of the TAB key.
2018-04-16 09:35:33 +02:00
Vincent Schippefilt 65d8a082df [FIX] web: fix keyboard related crash in client actions 2018-04-16 09:35:33 +02:00
Géry Debongnie e6fd9ccdf0 [FIX] web: properly display buttonbox for large screens
In the form view, a new problem appeared since we introduced the extra device
size_class: the buttonbox was folded for large screens, even if there is
only two buttons.

The reason is that the form renderer code used a list to map size class
numbers to the number of buttons allowed to be displayed.  With the
extra size class, this number was undefined, which caused an issue.
2018-04-13 17:19:34 +02:00
Géry Debongnie 9b2b5eddd4 [FIX] web: properly display buttonbox for large screens
In the form view, a new problem appeared since we introduced the extra device
size_class: the buttonbox was folded for large screens, even if there is
only two buttons.

The reason is that the form renderer code used a list to map size class
numbers to the number of buttons allowed to be displayed.  With the
extra size class, this number was undefined, which caused an issue.
2018-04-13 17:18:10 +02:00
Alexandre Kühn 8bdc650f79 [FIX] web: always update breadcrumb on change title
Revision on https://github.com/odoo/odoo/commit/32b8cec5361174c92c45a4975d4e02f1fb448aa2

Before this commit, when we switch channels in the Discuss app, the breadcrumb
was visually not updated: it keeps the name of the first opened channel.

With this commit, the breadcrumb is updated on each change of channel, so that
it displays the name of the currently opened channel.

Technical details:

	This is due to a change of logic of updating the GUI of the breadcrumb:
	before the refactoring above, discuss had to pass the content of the
	breadcrumb to the control panel, in order to update the breadcrumb visually.

	After the refactoring, the action manager should warn the control panel to
	update the breadcrumb on any change of the title. This is already the case
	for `ir.actions.act_window`, but not for all types of client actions.
2018-04-13 16:21:58 +02:00
Nicolas Lempereur b8b0f947bf [FIX] web: remove &shy; when saving phone number
When Odoo display a phone number number, on phone or if VOIP is
installed a invisible `&shy;` character was added from 9.0 up to
saas-11.2 so an applications such as skype would not be concerned with
the number.

But if someone copy-pasted from this to somewhere else in Odoo, we would
get incorrect number with this invisible caracter. So this change make a
special case for the "FieldPhone" so the character is removed from data
saved.

opw-1834858
closes #24223
2018-04-13 15:35:33 +02:00
Aaron Bohy 52cd52e624 [FIX] web: BasicModel: default_get on o2m with date field
Before this rev., a crash occured when a default_get returned a
command 0 (CREATE) for a one2many, with a value for a date(time)
field (e.g. [0, false, {some_date_field: '2018-12-08'}]). This
was because the related values (inside the commands) weren't
parsed. This only impacted date and datetime fields, for which the
parsing converts the string into a moment instance.

Fixes #23672
2018-04-13 14:59:48 +02:00
Lucas Perais (lpe) 8e5156938a [FIX] web: o2m list with field datetime from server
Have the create_date field displays on a one2many list
Try to add a record onto the list

Before this commit, when the virtual record is added onto the list
it crashes because the datetime field is undefined and cannot be parsed

After this commit, It doesn't crash though the value would have to wait the save on the main record
to be updated (because it is the create_date)

OPW 1834250
closes #24097
2018-04-13 13:41:39 +02:00
Géry Debongnie fddf2a722e [FIX] web: prevent race condition with client actions
Here is the issue that initiated this work: the bank reconciliation tour
sometimes failed in community.  The reason was that the discuss client
action seemed to be loaded after the tour started, and interfered with
the second step of the tour.

What happened exactly was the following:
- web client is loaded
- initial action is starting (but not complete) (this is discuss)
- tour manager is loaded and starts the reconciliation tour
- the reconciliation tour changes the url to trigger an hash change
- the web client calls loadState on the action manager
- the action manager perform a doAction with the tour url
- the discuss client action is now ready, and replace the reconciliation
  action
- the tour is broken.

The underlying cause is really a generic problem: the action manager
does not add the client action starting process in its 'dropprevious'
concurrency primitive.  This is probably not really an issue for the
act_window actions, since they have custom loading code that make sure
the loading process is put in the drop previous, but it is definitely a
problem for all client actions.

The solution is quite simple, and should also protect the act window
renderers: put the action controller in the drop previous
2018-04-12 17:05:25 +02:00
Géry Debongnie 220ba0d320 [FIX] web: prevent destroyed widget from calling start
Whenever a widget is destroyed, it should be as inactive as possible.
Before this commit, it could happen that a widget was destroyed after
the willstart method, but before the start method. In that case, bad
things could happen.

For example, the discuss client action tries to look up some information
into the session, with the getSession method. This causes a crash
whenever the widget is destroyed.
2018-04-12 16:58:41 +02:00
Géry Debongnie 611c836a46 [IMP] web: add fail fast feature to qunit test suite
With this commit, we introduce a new 'fail fast' feature to our qunit
test suite: when it is activated, the qunit test suite will immediately
stop after the first failed test.

It is accessible as a flag in the url (failfast), or by clicking the
checkbox in the UI. It is currently not activated by default.

Note that this commit also change the url for the runbot phantomjs test
in order to activate this feature.  This allows us to increase the global
timeout for the js test suite without fear!
2018-04-12 16:58:40 +02:00
Mohammed Shekha e968c17848 [IMP] web: disable checkbox in listview if new record
It doesn't have res_id then there is no meaning to select that record and
perform operation on it.

Related to issue #1776814
2018-04-12 16:19:40 +02:00
Géry Debongnie 1440c8be03 [FIX] web: prevent destroyed widget from calling start
Whenever a widget is destroyed, it should be as inactive as possible.
Before this commit, it could happen that a widget was destroyed after
the willstart method, but before the start method. In that case, bad
things could happen.

For example, the discuss client action tries to look up some information
into the session, with the getSession method. This causes a crash
whenever the widget is destroyed.
2018-04-12 12:11:55 +02:00
Géry Debongnie 5dbb2fc834 [IMP] web: add fail fast feature to qunit test suite
With this commit, we introduce a new 'fail fast' feature to our qunit
test suite: when it is activated, the qunit test suite will immediately
stop after the first failed test.

It is accessible as a flag in the url (failfast), or by clicking the
checkbox in the UI. It is currently not activated by default.

Note that this commit also change the url for the runbot phantomjs test
in order to activate this feature.  This allows us to increase the global
timeout for the js test suite without fear!
2018-04-12 12:11:55 +02:00
Géry Debongnie 52f0f21ada [FIX] web: prevent race condition with client actions
Here is the issue that initiated this work: the bank reconciliation tour
sometimes failed in community.  The reason was that the discuss client
action seemed to be loaded after the tour started, and interfered with
the second step of the tour.

What happened exactly was the following:
- web client is loaded
- initial action is starting (but not complete) (this is discuss)
- tour manager is loaded and starts the reconciliation tour
- the reconciliation tour changes the url to trigger an hash change
- the web client calls loadState on the action manager
- the action manager perform a doAction with the tour url
- the discuss client action is now ready, and replace the reconciliation
  action
- the tour is broken.

The underlying cause is really a generic problem: the action manager
does not add the client action starting process in its 'dropprevious'
concurrency primitive.  This is probably not really an issue for the
act_window actions, since they have custom loading code that make sure
the loading process is put in the drop previous, but it is definitely a
problem for all client actions.

The solution is quite simple, and should also protect the act window
renderers: put the action controller in the drop previous
2018-04-12 12:11:55 +02:00
Géry Debongnie 2f16d6bfe3 [FIX] web: prevent destroyed widget from calling start
Whenever a widget is destroyed, it should be as inactive as possible.
Before this commit, it could happen that a widget was destroyed after
the willstart method, but before the start method. In that case, bad
things could happen.

For example, the discuss client action tries to look up some information
into the session, with the getSession method. This causes a crash
whenever the widget is destroyed.
2018-04-12 11:27:20 +02:00
Géry Debongnie 473edda86e [IMP] web: add fail fast feature to qunit test suite
With this commit, we introduce a new 'fail fast' feature to our qunit
test suite: when it is activated, the qunit test suite will immediately
stop after the first failed test.

It is accessible as a flag in the url (failfast), or by clicking the
checkbox in the UI. It is currently not activated by default.

Note that this commit also change the url for the runbot phantomjs test
in order to activate this feature.  This allows us to increase the global
timeout for the js test suite without fear!
2018-04-12 11:27:15 +02:00
Géry Debongnie d5f6d1eb4a [FIX] web: prevent race condition with client actions
Here is the issue that initiated this work: the bank reconciliation tour
sometimes failed in community.  The reason was that the discuss client
action seemed to be loaded after the tour started, and interfered with
the second step of the tour.

What happened exactly was the following:
- web client is loaded
- initial action is starting (but not complete) (this is discuss)
- tour manager is loaded and starts the reconciliation tour
- the reconciliation tour changes the url to trigger an hash change
- the web client calls loadState on the action manager
- the action manager perform a doAction with the tour url
- the discuss client action is now ready, and replace the reconciliation
  action
- the tour is broken.

The underlying cause is really a generic problem: the action manager
does not add the client action starting process in its 'dropprevious'
concurrency primitive.  This is probably not really an issue for the
act_window actions, since they have custom loading code that make sure
the loading process is put in the drop previous, but it is definitely a
problem for all client actions.

The solution is quite simple, and should also protect the act window
renderers: put the action controller in the drop previous
2018-04-12 11:25:31 +02:00