Commit Graph
8157 Commits
Author SHA1 Message Date
Christophe Simonis fbd6ae3cb3 [FIX] web: correct test
Since 29e4394af9, `read` is called before
action execution.
2017-07-14 16:57:27 +02:00
Christophe Simonis de5a6e3a8f [MERGE] forward port branch saas-16 up to 29e4394af9 2017-07-14 15:53:24 +02:00
Christophe Simonis db2f82d5f1 [MERGE] forward port branch saas-16 up to 4ca3d9cadf 2017-07-14 15:51:59 +02:00
Géry Debongnie 29e4394af9 [FIX] web: properly reload record data before doing another action
When a user edit a record, then click on a stat button, the web client was a
little too aggressive in avoiding to reload data.  It was assuming that
even if the server overrides the create method, the web client did not
need to know anything about the record before executing the action from
the stat button.

However, that assumption is incorrect: the display_name property is
needed to correctly display the breadcrumbs.  For example, here is a scenario
that was not correct: open a res.partner in a form view, edit its name, then
click on one of the stat button. You will see that the breadcrumb is not
properly updated.

To fix this issue, we have to reload the record, and to properly update
the title property.  In this commit, we also add a getName method in the
model.
2017-07-14 14:47:13 +02:00
Géry Debongnie 04c3b99cb7 [FIX] web: disable debounce functionality
With the new views, we introduced a system where some fields could
notify immediately the rest of the system that they have been changed.
It is really cool, it allows real time edition (with onchanges).

However, this was a little too much.  In some cases (an onchange that
returns a warning), it was counterproductive.  So, we decided to simply
remove the feature.  This commit only make sure that it does not happen,
and we will do a deeper pass later to make sure that no useless code is
left behind.

Note that this means that we can reintroduce the functionality really
easily later, eventually protected by an attribute.
2017-07-14 14:47:11 +02:00
Khoi Nguyen f2c7e44efe [FIX] web: no M2ODialog when pressing enter in a many2one
Before this revision, pressing ENTER when inside a many2one field
triggers a 'focus out' event. In particular, if one creates a many2one
record and uses the ENTER key to click "Create and Edit", two dialog
windows appear: one to actually create the associated record, and a
second to alert the user that they are creating an associated record.
The latter appears every time the many2one field loses focus.

This commit changes the 'key up' event for many2one fields to ensure
that the ENTER key does not trigger a 'focus out' event.
2017-07-14 10:35:35 +02:00
qsm-odoo 110c895368 [FIX] web: move 'SwitchCompanyMenu' xml in the right file
Since commit https://github.com/odoo/odoo/commit/09659cca30a98dd9a522c53918e389e0d8f667eb:
The switch company menu feature has been introduced, which is a backend
one. The associated static XML was placed in the common xml file by
mistake.
2017-07-13 18:19:52 +02:00
Elkasitu 0c496136a9 [FIX] web: Discard from form view to form view
Clicking on the discard button in a form view whose previous view is
another form view wouldn't do anything.

This is fixed by making the view_manager trigger_up a history_back event
and then the history_back callback will handle cases in which there is
only one view and only one action, which used to be rejected
2017-07-13 13:10:30 +02:00
fwi-odoo bb908979e9 [FIX] web: avoid interactions between drag and drop tests
The commit 5854bb7d12 introduces a new option
to drag element without dropping them.

But it's not allowed to start a new drag and drop until the first one is
completely done.

So when the element is removed from the dom (the test is finished), we complete
the drag and drop in order to let next tests perform drag and drop.
2017-07-13 11:38:53 +02:00
fwi-odoo ce36cbdcb9 [FIX] web: load subviews in the correct function
Before this commit, it was impossible to load the x2many fields subviews when
they were not defined inline.
Now it is possible to call the method "_loadSubviews" to do so.
Used mainly in studio, to be able to display the x2many fields without inline
views.
2017-07-12 16:40:42 +02:00
Thibault Delavallée b9a9922b62 [FIX] web: execute action with null active_id instead of undefined
Indeed pyeval that evaluates the context explicitly handles null value
differently from undefined values. Let us therefore avoid crashes when
it manipulates the context.

Example of crash

 * click on forecast in project kanban view without having already created
   forecasts;
 * click on 'Assign' to create a new forecast;
 * selecting a task crashes because of the domain on task field that is
   evaluated using pyeval with an undefined active_id in context that
   pyeval cannot handle;
2017-07-12 14:47:09 +02:00
Dharmraj Jhala 4330ea0267 [ADD] web, *: add rainbowification
This commit introduces the 'rainbowification' feature to the web client
(and to some affected addons).  This feature is essentially a way to
display a nice friendly message when some business event happens.  For
example, a encouraging message is displayed when the user clear her/his
inbox, or when a salesman closes a deal.

The mechanism currently only displays a 'rainbowman', but could be
extended later to add other kind of animation.

There are a few different ways to display a 'rainbowman':
- any JS code can simply trigger_up an event ('show_effect') with some
  options: for example
    this.trigger_up('show_effect', {
        type: 'rainbow_man',
        fadeout: 'no',
        message: $done,
        click_close: false,
    });
- an action returned by the server can have an 'effect' key, with some
  options
- the do_execute_action method accepts a 'effect' option.  This is
  useful when one wants to specify a rainbow on an action button in a
  form view

Joint work with: dbh <dbh@odoo.com>, ged <ged@odoo.com>
2017-07-12 13:43:08 +02:00
Adrian Torres ed2a77e50e [FIX] web: Fix FieldRadio's o_horizontal/vertical (#18163) 2017-07-12 09:45:46 +02:00
Martin Geubelle 8881e61ec8 [FIX] mail: make many2many_tags_email widget work
This widget hasn't been rewritten with the new views.

The purpose of this widget is to open a popup for each invalid partners
(without email) in a many2many to fill the email. If the email is not set, the
partner will not appear in the tags and its id will not be sent (which should
not be the role of a widget but that's the way it is).
2017-07-11 17:22:43 +02:00
Christophe Simonis e90cd4aa73 [MERGE] forward port branch saas-16 up to 1581d31b3e 2017-07-11 16:28:36 +02:00
Mehul Patel 50b3b3c8d1 [FIX] web,odoo: Remove remaining workflow related code 2017-07-11 16:27:15 +02:00
Géry Debongnie 3d16453865 [FIX] web: only send fields present in view in onchange
Before this commit, all x2many fields values were sent to the server in the
onchange call. If a x2many field was not present in the view, then it
was sent as an empty list [], which is totally wrong.
2017-07-11 14:40:34 +02:00
stefanorigano 219edc67a2 [IMP] web, web_planner: remove navbar unnecessary borders
Although a dark 'border-bottom' is necessary in some occasions (to add
contrast between the page's content and the navbar itself), the other
borders were totally unnecessary.

Moreover, having a complete border causes complications to calculate the
sidebar height and to manage buttons' size and line-height.

This fix will keep the border-bottom only, removing the other ones.
Compensation rules ("- 2px") are no longer necessary.
2017-07-10 13:37:40 +02:00
Ankit Sathvara f41bd82f66 [ADD] web: Add new widget to toogle a boolean with a slider
Purpose
=======

Currently, it's not possible to activate a boolean on a non-editable list view without adding 2 buttons linked to a python method. These buttons aren't aligned and the result is not pretty.

This commit adds a new widget that allows to toggle a boolean record by record by clicking on the slider.
2017-07-07 16:18:23 +02:00
Christophe Simonis bf51fe55a1 [MERGE] forward port branch saas-16 up to 0f2b2c4e2b 2017-07-07 14:30:30 +02:00
Martin Geubelle e26ccdd0b6 [FIX] web: explicit color attribute for m2m_tags
Before this fix, the field 'color' was hardcoded in the m2m_tags widget,
which means that:
 - one couldn't specify another field (problem for custom models, with x_...)
 - if the related model didn't have the field 'color', a warning was raised
   by the server

Now, the color attribute needs to be specified on the widget options if one
wants to display colored tags.

If the color is not specified, the tags will be displayed in grey.
2017-07-07 13:40:36 +02:00
Géry Debongnie 56dae80994 [FIX] web: prevent crash with invisible x2m and onchanges
When an invisible x2many field is modified by an onchange, we had a
crash because the reset function did not return a deferred in that case.

This happens because the signature of _render in AbstractField allow for
an undefined return value, but the reset method should return a
deferred.

This was an issue for example in stock: editing the
pack_operation_product_ids one2many field in a stock.picking could
trigger an onchange on another invisible one2many (with no inline views).
2017-07-06 15:04:04 +02:00
Khoi Nguyen 5854bb7d12 [IMP] web: Add disableDrop option to dragAndDrop
In some situations, it would be desirable to be able to attempt a drag
and drop, without actually triggering the dropping action. As an
example, we would like to see whether dragging a new field in studio
ensures that a class 'o_web_studio_nearest_hook' be assigned. This can
only be tested *before* the new field is dropped.

This commit adds an optional argument 'disableDrop' to the
dragAndDrop method, and sets it by default to false. The dropping action
will then only be triggered if the aforementioned parameter is set to
false.
2017-07-06 11:50:35 +02:00
Cedric Snauwaert 1e30b30a8f [FIX] web: onchange with domain should not crash if field is not in view
In some cases (onchange in a purchase order), the onchange can return a
domain for a field that is not in view.  It should not be the case, but
it is really simple to protect the web client anyway.
2017-07-05 14:47:13 +02:00
Géry Debongnie a43b0464b2 [FIX] web: better handling for readonly modifiers
Before this commit, the web client read the readonly in the modifiers,
and if no readonly was in the modifiers, it fell back to the field
property.  But the field property was already taken into account in the
modifiers, so this was useless.  And worse, in some case, it could cause
an issue.  For example, a field with readonly=true, and readonly="0" in
the arch was considered readonly.
2017-07-05 14:47:11 +02:00
Christophe Simonis 780ae8a808 [MERGE] forward port branch saas-15 up to 10cb34bcac 2017-07-04 18:14:13 +02:00
Christophe Simonis 10cb34bcac [MERGE] forward port branch saas-14 up to 97258040d8 2017-07-04 14:40:20 +02:00
Khoi Nguyen 79c9f0a7a5 FIX web: clear cache after 'reload' client action
If the 'reload' action is triggered right after a view change, the
latter will only be effective if we refresh the page at the browser
level. To overcome this, we clear the cache every time the 'reload'
action is triggered.
2017-07-04 10:31:09 +02:00
David Monjoie 2e2ab4e954 [FIX] web: don't read events if no filter is enabled
Previously, enabling some filters created a domain of which events
to display, but disabling all filters resulted in a domain of []
which, instead of showing no events at all, actually showed all events.
2017-07-03 08:15:28 +02:00
David Monjoie 537181d4e3 [FIX] web: display indicator when many attendees in calendar event
In saas-15, when an event had more than 3 attendees, it used to
show a '+' at the left of the avatars. This behavior was lost in
saas-16 where it became 'display 5 avatars max and that's it'.

This commit brings back the behavior of saas-15 and improves it
such that the '+' sign displays the number of additional attendees
whose avatars are not shown and displays it on the right.

Example for 7 attendees, '[]' representing an avatar:
saas-15:        +[][][]
saas-16 before: [][][][][]
saas-16 now:    [][][]+4
2017-07-03 08:15:26 +02:00
David Monjoie 405681fa8b [FIX] web,google_calendar: fix google calendar sync 2017-07-03 08:15:24 +02:00
David Monjoie 0f7f3fc2f1 [FIX] web: prevent traceback on quickCreate in calendar 2017-07-03 08:15:23 +02:00
David Monjoie 58e130ced5 [FIX] web: fix calendar scale switching in same week
The scale should change to day when clicking on a day that is in
the current week or change to week if the day is not in the current
week.
2017-07-03 08:15:22 +02:00
Géry Debongnie 690446b5fd [FIX] web: protect logged object in mockserver
Before this commit, when whe loglevel was set to 2 in the mock server,
we simply logged the parameters in the console, then give the same
object to the _performRpc route.  Most of the time, it is not an issue,
but nothing prevents the _performRpc route to modify the args object.

And this happens with the /create route, which is very confusing: when
we have a breakpoint/debugger in the mock rpc function in a test, we see
the correct arguments passed to the function.  However, if we look at
the arguments in the console, after the end of the test, we see other
values (for all fields) in the args.args[0] object.

The solution is to simply deep copying everything, so any modification
in the mockserver will not affect the logged object.
2017-07-02 09:34:35 +02:00
Christophe Simonis 936f39886c [MERGE] forward port branch 10.0 up to cb01cfe9ff 2017-06-29 16:40:39 +02:00
Cedric Snauwaert 07fdcad343 [ADD] web: add parse monetary method
In field_utils, the parse monetary method was remapped to parsefloat. In this commit, we add a specific parseMonetary method to handle currency specific formatting.
2017-06-29 16:37:30 +02:00
Christophe Simonis cb01cfe9ff [MERGE] forward port branch saas-11 up to aa578e1bee 2017-06-29 16:34:59 +02:00
Aaron Bohy 8473bde80e [FIX] web: handle 'domain' key returned by onchanges
Onchange RPCs return an object that may contain a 'domain' key.
When it does, its value is an object whose keys are field names and
values are the new domain for the corresponding field.

Before this rev., the 'domain' key was totally ignored by the
BasicModel. This feature is used for example in the account.payment
form view (go to an open invoice, click on 'Register payment'): the
domain of field payment_method_id is updated by the onchanges (e.g.
when changing the journal_id). As the domain was ignored, it always
displayed all possible payment methods.
2017-06-29 14:58:04 +02:00
Aaron Bohy b954cd6483 [FIX] web: BasicModel: send correct context
... when reading and writing on a record (especially inside lists).

Before this rev., the context sent when reading a record, and when
writing records inside lists (editable list views) wasn't correct.
This caused an issue in Sales > Products (variant activated) >
open a product with variants > click on variant prices > edit the
prices of a variant: the value wasn't saved correctly (because the
inverse function requires 'active_id' to be in the context and it
wasn't the case).
2017-06-29 14:58:04 +02:00
Aaron Bohy 2846887ea8 [FIX] web: mockServer and mockEnvironment
Fixes two issues in the test environment:

- for unset fields, the mockRead is supposed to return 0 (numerical
  fields), empty array (x2many fields) or false (otherwise). Except
  for the first case, it was returning undefined, and this might
  cause crashes when evaluating contexts or domains.
- the mock environment allows overriding some global properties
  like the session, for the test case only. Once the widget is
  destroyed, those global properties are reset to their original
  value. This wasn't working for models tests, because the destroy
  function of the parent widget was never called. This could make
  tests fail as they could have been impacted by other tests.
2017-06-29 14:58:04 +02:00
Christophe Simonis aa578e1bee [MERGE] forward port branch 9.0 up to 4d4ff7c5e7 2017-06-29 13:12:53 +02:00
Géry Debongnie 514c8e5cd3 [FIX] web: prevent dirty state after test
The test changed in this commit had a big issue: it did not properly
destroy the second form view that it created.  Because of that, it was
still alive and could interact with other tests, such as the barcode
tests.

This is what happened:
1. var form was assigned to a form view
2. form was destroyed
3. in a try catch, form was reassigned to the result of createView, but
the evaluation of createView crashed (after creating a form view), so the
assignation was not done, and the var form was still pointing to the first
form view
4. form.destroy is called, which did nothing for the second form view.

There is no easy way to get the reference to the form view created by
createView without changing some other code, so we simply remove the
second part of the test, which was not particularly important.
2017-06-29 11:34:43 +02:00
Martin Geubelle ec3bc2eeaf [FIX] web: deal with reference fields
The reference fields haven't been correctly implemented with the new views.
This commit restores their behaviour.

Note that an small improvement has been introduced in this commit.
Before saas-16, a `name_get` was done for each record (so 80 if the field
was displayed in a full list view), which is not optimal. The calls are now
batched by model (so one `name_get` by model appearing in the field values).
2017-06-28 16:53:45 +02:00
Martin Geubelle 157732cfb1 [FIX] web: FieldText: keep editing the textarea after enter
In the editable list, when pressing enter, the cursor goes to the next line and
the current row is saved.

This should not be the case for a textarea (i.e. in the FieldText widget). In
this particular case, we just want to continue editing the textarea.
2017-06-28 16:53:45 +02:00
Jeremy Kersten 32423169af [FIX] web: namespace the event for Apps Widget.
With the new client web from v9, we start the new action before to destroy the old one.

When we switch from Apps (store) to Update and vice-versa, iframe was not loaded correctly.

In case of the Apps widget, we are binding event of the new iframe during the start,
and when it is ready, we destroy the old ifram and so unbind the listener of 'message.apps'.

Using a uniq id, we ensure to bind new event, and only unbind old event during the destroy.
2017-06-28 14:36:11 +02:00
Darshan Kalola 7ada921e67 [FIX] web_editor: make html widget translatable
The translate feature of widgets html and html_frame had been
broken by the new views refactoring. This commit restores it for
the html widget, and removes it completely for html_frame as it
wasn't working correctly before the new views anyway (moreover,
it had already been disabled for mass_mailing: de403dc1ab).

This commit also ensures that the changes are correctly saved for
the html_frame widget. Note that this widget still needs to be
converted to our new coding guidelines.
2017-06-28 12:41:35 +02:00
Adrien Dieudonne 9f4922a852 [FIX] web: test wrongly adapted in ceff4d460
A test has been adapted in ceff4d460 whereas it shoudn't.
Indeed this commit doesn't change anything in the case of 'Discard'
button clicked.
2017-06-28 11:47:33 +02:00
Adrien Dieudonne ceff4d4608 [FIX] web: basic_controller: wait for the mutex before discard changes
Before this commit, the discard confirm dialog was directly shown
without waiting for the write RPC. For instance, it the user clicked on 'Save'
after editing a record, and then directly clicked on another menu or on the
breadcrumb before the write RPC returned, the record was still considered
as dirty and thus the confirm dialog was displayed. We now wait for the RPC
to return before checking if the record is dirty, so that the confirm dialog
is only displayed when the record is actually dirty.
2017-06-28 10:40:35 +02:00
Aaron Bohy 964b7c378f [FIX] web: apps: correctly use this._rpc
session.rpc should not be used anymore. The function '_rpc'
available on widgets should be used instead (with the correct
params).

Also, 'session' is no longer a widget attribute.
2017-06-27 14:25:00 +02:00
Christophe Simonis dd43071638 [MERGE] forward port branch saas-16 up to 278e478d55 2017-06-27 14:19:31 +02:00