Commit Graph
135 Commits
Author SHA1 Message Date
Christophe Simonis 8ef7af6afe [MERGE] forward port branch 11.0 up to f96a797fe6 2017-12-06 12:02:58 +01:00
Christophe Simonis f96a797fe6 [MERGE] forward port branch saas-16 up to b8540eefe3 2017-12-06 11:59:38 +01:00
Lucas Perais (lpe) 519555054a [FIX] web: BinaryFile not download when new record
Let's have:

- on res.company a binary file field named x_file
- on res.users a related binary field to company_id.x_file, and make it readonly
- On the res.users form view, display the new field
Before this commit in create mode, upon clicking on download the file, the server crashed, because the record id was empty.
Then, the JS crashed in turn because of the unhandled 404 from the server.

Since the id of a new record will always be unset, we choose to disable the download option in this very specific case

OPW 777042
2017-12-05 08:19:08 +01:00
Christophe Simonis a8d01cbf4e [MERGE] forward port branch saas-15 up to a447da75fd 2017-12-04 20:12:19 +01:00
Géry Debongnie 5faec34a3c [REF] web: update widget to new guidelines
- make delegate/undelegate events private
- remove $el before start
- make replaceElement private
- remove one _ from __render_and_insert... method
- update documentation
- remove make and improve make_descriptive (also, it is private)
- ...
2017-12-04 10:03:00 +01:00
Christophe Simonis 29590a61cd [MERGE] forward port branch 11.0 up to 8fb25e185b 2017-11-28 16:57:58 +01:00
Alexandre Kühn fb6c9c2443 [IMP] web: FieldChar trim its value by default
With this commit, we change the behaviour of the web client with respect
to spaces in char fields.  Most of the time, starting and ending spaces
have no value, and worse, make the data not so reliable.

After this commit, field char will trim by default (so, if the user input a
char as ' abc ', the string 'abc' will be sent to the server instead).
Note that this only applies when the value of the field is changed.  If
someone open a form view, then switches to edit mode and save, nothing
will change.

This is the desired behavior most of the time.  However, in some rare
cases, this is actually harmful.  For example, if we trim the
'decimal_point' field, it will not be possible to enter a whitespace as
decimal separator.  In those cases, we introduce a new attribute 'trim',
which allow the developer to desactivate that feature.
2017-11-24 13:09:10 +01:00
Alexandre Kühn 732f176fe1 [FIX] web: readonly monetary field onchange currency
Before this fix:
    A readonly monetary field was not updating
    its currency symbol when selecting another currency.

Scenario:
    1. Activate multi-currency with $ (default) and €
    2. In hr_expense, go to My Expenses to Submit
    3. Create a new expense
    4. Select 'EUR' as currency
        => Unit Price is correctly updated with €, but not Total.

With this fix:
    Total displays the correct currency in edit mode.

Explanation:
    Monetary fields in readonly are relying on _formatValue() to
    display their value.
    _formatValue() uses this.formatOptions.currency, which stores
    the currency at loading of the field. We must update its value
    whenever there is a change of currency.

opw-783378
2017-11-22 14:16:00 +01:00
Aaron Bohy 995610c065 [FIX] web: JournalDashboardGraph widget crash
The JournalDashboardGraph requires nv, which is lazyloaded. Before
this rev., a crash occurred when this widget was instantiated and
destroyed before the loading of the lib was complete (because a
function of the lib was called in destroy()).

For instance, press F5 (to ensure that nv isn't already loaded),
activate some throttling in the network tab, go to Accounting and
as soon as the dashboard shows up, click on another menu.

opw 781628
2017-11-13 11:18:56 +01:00
Christophe Simonis e918271f76 [MERGE] forward port branch saas-16 up to 8fdac4b6b2 2017-10-27 14:09:20 +02:00
Lucas Perais (lpe) f45edfbe6d [FIX] web: image widget is dependent on its record's last_update
As a way to optimize loading, images are not necessarily fetched in db.
They have, in their url a "unique" parameter, which is the last_update date on **the record** and controls on the python-side whether it should get the image from a cache or from the db.

Before this commit, this __last_update field wasn't present in the view, so it wasn't fetched, and writes on a model's image worked but did not refresh.
The image displayed was the old one.

After this commit, when the image field widget is present, we force the loading of the __last_update field of the record.
Upon update, the image displayed is the new one.

OPW 777552

closes #20457
2017-10-25 16:39:52 +02:00
Christophe Simonis 693f8dc68a [MERGE] forward port branch saas-16 up to 7bfde6e05d 2017-10-25 14:57:24 +02:00
Géry Debongnie 616eedb7e4 [FIX] web: allow onchange to modify origin field
With this commit, we allow an onchange coming from a field to modify the
same field.  This was not working for field widgets derived from an
input field.
2017-10-24 15:39:14 +02:00
Christophe Simonis 10128fa7e8 [MERGE] forward port branch saas-16 up to dc2a6c6cd2 2017-10-20 19:27:04 +02:00
Martin Geubelle 2455350c40 [FIX] web: deal with date widget on datetime
This use case was not correctly managed as the function evaluating if the
value has changed compares datetime and date.

This triggered an issue if the widget `date` was set on the field `date_order`
on a purchase order for example ; it was not possible to create a record as
the datapoint was set `dirty`.

This rev. ensures that a `field_changed` is not triggered if the day is the same
on a date widget.

This rev. also adds support of `datetime` fields on date widget, which appears
to be a valid use case.

Fixes https://github.com/odoo/odoo/issues/20311
2017-10-20 11:25:32 +02:00
Martin Geubelle 1312ee72cf [FIX] web: correctly render the field image
Before this commit, the image was directly built without using the corresponding
template, which set some properties on the image (class, width, etc.).
2017-10-20 11:04:08 +02:00
qsm-odoo 841f41f95b [FIX] web: domain field should never be considered unset
Indeed, false was already considered as "[]" in edit mode.
2017-10-18 18:14:33 +02:00
Khoi Nguyen 8191d6d72e [FIX] web: tab navigation with phone widgets in form view
This commit ensures that tab navigation works properly when editing a
form view that contains input fields with phone widgets. Previously,
pressing TAB would skip those fields.
2017-10-16 13:05:19 +02:00
Khoi Nguyen bb692c76d4 [FIX] web: tab navigation with phone widgets in form view
This commit ensures that tab navigation works properly when editing a
form view that contains input fields with phone widgets. Previously,
pressing TAB would skip those fields.
2017-10-16 11:34:39 +02:00
Christophe Simonis 99bf9e4563 [MERGE] forward port branch saas-16 up to 89df681b45 2017-09-28 13:24:14 +02:00
David Monjoie a3828dfed3 [FIX] web: fix o_row mechanism with phone field
The o_row class mechanism is supposed to be used to put another
element next to a field, like a button for example. However,
in the case of phone and email field, the o_text_overflow hack
gets in the way.

The problem that o_text_overflow is trying to solve is when you
have a long email, the table used to display the form view fields
tends to use very long cells (td) so it can display the whole email
address. This behavior completely breaks the form view, even though
the email address is clearly set to wrap in css. The o_text_overflow
class is a hack that forces the table to think that the email is
small, then defaulting to the width 50% css rules. If the email is
too long, it is correctly wrapped inside the cell, without breaking
the form view layout.

However, when we need to add a button next to those fields, this
hack gets in the way of the o_row class css rules, completely
wrecking it. We looked for a fix with qsm-odoo for hours but were
unable to find one that did not require a complete rewrite of the
form view css rules. In the end, we decided to remove the hack from
the phone field and keep it on the email field, as we think it is
less common to have a very long phone number than to have a very
long email.
2017-09-26 16:21:51 +02:00
Lucas Perais (lpe) e64762e535 [FIX] web, google_drive: fixed display of field link
Before this commit, a field handled with a widget url was given its value (href) as its text, fully displaying the url.
Moreover, the display was odd and did not match that of buttons

After this commit, if the field contains a text attribute, we use is as the text of the link.
The link also correctly displays and looks like a button (in a form view)

Of course, a test for this new field widget feature is implemented

closes #19587
2017-09-26 09:37:16 +02:00
Martin Trigaux eb75cb09b5 [ADD] web: link_button widget
Add a widget to make a link to an external page in a tree view
2017-09-25 15:26:54 +02:00
Deep Patel 9b9fcfe628 [FIX] web,base: document template widget in settings
Go to General Settings, click on 'Change Document Template', and
in the opened dialog, click on a template.

Before this rev., it automatically closed the dialog, which was
not really convenient.

This rev. introduces a new field widget (image_selection) for
this use case, and ensures that the dialog doesn't close when
a template is selected.

Test written by @mba-odoo
2017-09-20 10:56:57 +02:00
Christophe Simonis d15a31ae6d [MERGE] forward port branch saas-17 up to 2a343d7c9c 2017-09-19 11:58:01 +02:00
Christophe Simonis 2a343d7c9c [MERGE] forward port branch saas-16 up to c3a48da767 2017-09-19 11:06:46 +02:00
Pratima Gupta de48daf53a [FIX] web: FieldDomain: don't open record from selection
The FieldDomain allows to open a list in a dialog to display the
records matching the current domain. In this dialog, clicking on
a record should do nothing (this was the behavior before the new
views).

Before this rev., it actually tried to open the record and it
produced a crash.
2017-09-19 10:14:24 +02:00
Xavier Morel f1a85ba70a [FIX] *: fix a bunch of incorrectly documented docstring
Fix a bunch of ill-documented/incomplete/incorrect method docs
Without this, the automatic doc generation does not work.
2017-09-18 11:54:39 +02:00
stefanorigano 9e69958099 [REF] web: review graphs layout 2017-09-06 17:55:49 +02:00
Christophe Matthieu 95c2bd33a2 [IMP] web: lazy load nvd3, ace and fullCalendar lib to reduce asset size 2017-08-31 16:26:11 +02:00
Christophe Simonis 4879ce0407 [MERGE] forward port branch saas-17 up to fe77df3ba4 2017-08-31 12:55:41 +02:00
Christophe Simonis 71f370903c [MERGE] forward port branch saas-16 up to 600d015938 2017-08-30 18:18:59 +02:00
Khoi Nguyen 5149e18ec7 [FIX] web: always display handle widget
Before this commit, a list containing a handle widget would only display
the handles associated with non-zero integer values. This is due to the
fact that unset fields are hidden in Odoo, while a field is by default
considered 'defined' if its value is truthy.

We override the isSet method for the handle widget to always return
true. This tells the handle widget that the associated integer value is
always defined, thereby ensuring that the handle will always be shown.
2017-08-29 11:41:32 +02:00
Christophe Simonis d0f132b297 [MERGE] forward port branch saas-16 up to 4ac347735d 2017-08-28 14:49:11 +02:00
qsm-odoo 6e22e8b027 [FIX] web: use 'o_input' class on kanban progressbar <input/>
Since the new views, the 'o_input' class has to be set explicitely on
<input/>, <select/> and <textarea/> elements to have the proper styling.
2017-08-25 10:37:37 +02:00
Christophe Simonis 017ee5eab3 [MERGE] forward port branch saas-17 up to 877e709871 2017-08-24 13:17:53 +02:00
Christophe Simonis 30bd5ac0e9 [MERGE] forward port branch saas-16 up to aec6248bb3 2017-08-23 16:44:58 +02:00
Richard Mathot 0966f75b7e [FIX] web: enforce length-limited char fields
In Odoo 10.0, `Char` fields with a maximum `size=` attribute were
indeed limited in the web client.
2017-08-18 11:34:21 +02:00
Adrien Dieudonne f5b7ad80fc [FIX] web: always use browser timezone
With the new views, we stopped using the browser timezone to
display the dates in Odoo, and we used the timezone defined on
the User profile instead. When loading the webclient, the
timezone offset was put into the session and used to display all
dates. This wasn't a good idea.

The given offset was computed for the current time, meaning that
it may be incorrect for specific dates (e.g. with the daylight
saving, the UTC offset of today is not the same as 6 months ago).
Moreover (but less likely), as the offset was stored in the
session, it wasn't recalculated afterwards. So if the offset
actually changed during the session (e.g. from or to daylight
saving time), the displayed dates were incorrect until the user
reloaded the page.

With this rev., we don't retrieve the offset from the server
anymore and we use the browser timezone again (like before the new
views). However, we keep the computation of the offset (on the fly)
in the session, so that it can be mocked in the test environment.
2017-08-17 17:24:00 +02:00
Khoi Nguyen 178873d433 [FIX] web: fix copy (Ctrl-C) of text field content in Firefox
Before this commit, it was not possible to copy the contents of a
multiline text field in read-only mode in Firefox without losing all
line breaks in the process. This is due to a bug affecting div tags
(see https://bugzilla.mozilla.org/show_bug.cgi?id=1390115) in Firefox.

This commit ensures that the text in a text field is surrounded by a
span (as opposed to div) tag.

Note that spans were used in saas-15, so we are in fact simply undoing
the change to divs introduced by the new views.
2017-08-14 15:27:58 +02:00
Jigar Patel 2adc9d5032 [IMP] account: Add a new boolean_favorite widget
Purpose
=======

Projects and soon sales teams have a manual "favorite" button that calls a toggle_favorite method
It should actually be a widget on a boolean field

Specifications
==============

Develop a favorite widget for kanban view that allows to toggle a boolean field
Probably update boolean field to allow inverse method on it

Functionally nothing changed.
2017-08-09 15:11:53 +02:00
Christophe Simonis 4d5ff6401c [MERGE] forward port branch saas-16 up to b76109173a 2017-07-28 18:37:10 +02:00
Adrien Dieudonne a71f223702 [FIX] web: InputField: don't re-render if dirty
Let's assume that we have a form view with a one2many field
displayed as a list containing two fields A and B (an input field,
e.g. a char field). An onchange on the one2many is triggered as
soon as A changes. This triggers a reset of the one2many which
thus redraws the corresponding line by resetting its widgets.

A problem occured when the user updated A, and directly (before
the onchange returned) updated the input field B, as in this case
the new value in B was erased when the onchanged returned, as the
widget was reset with its former value (or with the value returned
by the onchange, if any). Note that the model was aware of the
change on B, so the model and the UI were actually desynchronized.

This was quite hard to reproduce in practice, by hand, but it
occured in the tour testing 'the flow', in the form view of
account.bank_statement, with fields partner_id and amount of the
line_ids one2many.

With this rev., we don't re-render the input fields if there are
pending changes that haven't been acknowledged by the model.
2017-07-27 13:58:43 +02:00
Christophe Simonis de5a6e3a8f [MERGE] forward port branch saas-16 up to 29e4394af9 2017-07-14 15:53:24 +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
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
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
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
Aaron Bohy 7ea6f653df [FIX] web: MonetaryField: rerender with currency
The MonetaryField can be rendered with or without a currency. The
currency can change during the lifecyle of the widget (e.g.
currency field in the view, whose value is set by an onchange).
More precisely, the widget can be instantiated without currency,
then a change on another field can trigger an onchange which sets
the currency, and our monetary widget is re-rendered with a
currency.

Before this rev., this wasn't supported in edit mode because the
$el's root node was different if there were a currency or not
(it was an input if there were no currency, and a div containing
an input and a span otherwise). This root node being rendered only
once (at the creation of the widget), the widget wasn't re-rendered
correctly if the currency was suddenly set or unset.

This fix makes the widget behave uniformly whether or not there is
a currency, so now it is always a div containing an input (and
optionally a span if there is a currency).
2017-06-27 14:12:31 +02:00
David Monjoie 378efa1444 [FIX] web: update filename correctly in binary fields
The update_field event is not used anymore so it needs to trigger
a field_changed instead.
2017-06-23 16:16:36 +02:00