Commit Graph
9962 Commits
Author SHA1 Message Date
Olivier Dony f4d541e51a [IMP] http: set HTTPonly flag on session cookie
This will reinforce the framework against potential XSS exploits
escalating to session hijack
2017-09-05 10:06:35 +02:00
Christophe Simonis 71f370903c [MERGE] forward port branch saas-16 up to 600d015938 2017-08-30 18:18:59 +02:00
Christophe Simonis 600d015938 [MERGE] forward port branch saas-15 up to cb4dbfb7b7 2017-08-30 18:04:40 +02:00
Christophe Simonis cb4dbfb7b7 [MERGE] forward port branch saas-14 up to 583fcf0a67 2017-08-30 16:13:19 +02:00
Christophe Simonis 583fcf0a67 [MERGE] forward port branch 10.0 up to 1b7e31f341 2017-08-30 15:34:58 +02:00
Christophe Simonis 792204ae9e [MERGE] forward port branch saas-11 up to dce35ca44b 2017-08-30 14:15:32 +02:00
qsm-odoo 9b58abdd5c [FIX] web: reset 'invisible' table cells to correct display
Make sure '.o_invisible_modifier' table-cells are forced back to
`display: table-cell` to keep correct alignement. Indeed using the
`initial` value forced them to `inline` instead (creating some
obvious visual bugs in some cases).
2017-08-30 12:40:53 +02:00
Aaron Bohy f1082f1552 [FIX] web: don't send virtual id on save
The problem occurred on form views with an x2many field with a
default value containing CREATE commands, i.e. when opening such
a form view in create mode, the x2many field is pre-filled with
some (non-existing yet) subrecords.

If the user then edited those subrecords, and then clicked on
'Save' to create the main record, an 'UPDATE' command was sent
alongside the 'CREATE' one for the x2many, and the id of the
'UPDATE' command was a virtual id (as the subrecord didn't exist
yet), and it crashed.

This could happen in MRP:
  - Enable lots in Iventory
  - Choose a product which is a component of another (through mrp bom)
  - Set this product as tracked by lot
  - Set this product inventory quantity to 0
  - Create a new manufacturing order for the product for which it is a
    component
  - Click on "Check Availability"
  - click on Produce: the many2many already contains a subrecord
  - edit the lot field of that subrecord
  - click on 'Record Production'
2017-08-30 12:29:47 +02:00
Aaron Bohy 96b1db4cd4 [FIX] web: prevent 'reload' event from being handled twice
When the external button of a many2one field is clicked, the
related record is opened in a dialog. When the user clicks on
'Save' in this dialog, a 'reload' event is triggered to reload the
parent view (the one in the background), as the display name might
have changed.

However, when there is another many2one field in the opened dialog,
and if its external button is clicked, there are 2 opened dialogs,
and thus 3 nested form views. If the user clicks on 'Save' in the
third one, only the direct parent view must be reloaded (the one
in the first dialog).

Before this rev., the 'reload' event wasn't stopPropagated, so it
was handled by the view in the dialog, and by the one in the
background, which produced a crash.

This could happen for instance in Sales Order, edit a sale order
line, click on the external button of the product, in the dialog,
click on the external button of the category, edit some field and
click on 'Save'.

Closes #19052
2017-08-30 11:23:29 +02:00
Aaron Bohy 551dc26940 [FIX] web: tab navigation in editable list with create="0"
Before this rev., when the user pressed 'TAB' in the last cell of
the last row of an editable list with attribute create="0", a new
line was added to the list, thus totally ignoring the attribute.
Now, it goes back to the first cell of the first row instead, as it
was before the new views.

Closes #19053
2017-08-30 11:23:28 +02:00
Christophe Simonis 6c6ba6c78a [MERGE] forward port branch 9.0 up to 81908899fc 2017-08-29 16:07:03 +02:00
Aaron Bohy 4f61e7f048 [FIX] web: WidgetDomain: don't crash on false domain
Before this rev., when the value of a field with widget='domain'
was false, the search_count RPC made to display the number of
records matching the domain crashed, and the widget displayed that
the domain was invalid. This rev. adds a fallback on [] when the
domain is false.
2017-08-29 13:59:49 +02:00
Aaron Bohy c5bf53682e [FIX] web: prevent 'load' event from being handled twice
In grouped list view, when a pager is clicked inside a group, a
'load' event is triggered to reload the data with the new offset.
The event is handled by the list's controller.

However, when the list is in the modal, the event must be stop
propagated by the controller of the modal, so that it doesn't go
up to the controller of the view displayed behind the modal. It
happens for example by reproducing the following steps:
  - go to Lunch
  - add a line
  - search more products
  - group by vendor in the modal
  - unfold a group
  - click on the pager (the group must contain more than 80 records)

Before this rev., it crashed because the controller of the form
view tried to handle the event.
2017-08-29 13:12:34 +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
Aaron Bohy d93726f9ac [FIX] web,mail: only send fields in view for onchanges
The field 'display_name' is automatically added to the list of
fields to fetch when fetching a record. Before this rev., its
value was also sent alongside the fields in the view for onchange
RPCs. It shouldn't: only the fields in the view should be sent.

It produced a weird bug in the res.partner form view: open a
contact (company), add a sub-contact, save -> the display_name of
the contact was then '' (and 'Contacts' was displayed in the
breadcrumbs instead of the display_name of the opened contact).
This is because 'display_name' was sent to the onchange, which
returned '' as value (because of another bug python side). So as
it's value changed, when saving, the new display_name was sent to
the server (even if this field was actually readonly).

Before this rev., we also always fetched 'display_name' when
fetching list of records (read or search_read). This wasn't a bug
per se, but it might be a computed field, and it isn't necessary,
so we stop fetching it in that case if it isn't in the view (as
it was done in saas-15, before the new views).
2017-08-29 10:38:36 +02:00
Aaron Bohy f24c83efcc [FIX] web,mail: keep changes when scheduling an activity
The problem occurred in form view, in edit mode, when the user
did some changes in the form, and then clicked on 'Log or schedule
an activity'. When validating the activity, the fields mail_activity
and mail_thread were reloaded but all changes were discarded in the
process.

This rev. ensures to reload the requested field without discarding
the changes.
2017-08-29 10:38:36 +02:00
Christophe Simonis d0f132b297 [MERGE] forward port branch saas-16 up to 4ac347735d 2017-08-28 14:49:11 +02:00
Lucas Perais (lpe) f32a79dd82 [FIX] web: limit amount of rows for excel export
Before this commit, when the amount of rows was above xls format threshold (>65535), the xlwt library threw an obscure Traceback to the user.

We now test the amount of rows before even calling the library, raising a more helpful message to the user

OPW 767319

closes #19035
2017-08-28 14:22:47 +02:00
Christophe Simonis 063381e0f6 [MERGE] forward port branch saas-14 up to e18fe88751 2017-08-28 12:14:38 +02:00
Christophe Simonis e18fe88751 [MERGE] forward port branch 10.0 up to 22eb3ee971 2017-08-28 12:13:05 +02:00
Christophe Simonis 22eb3ee971 [MERGE] forward port branch saas-11 up to 428ad2dfe3 2017-08-28 11:30:46 +02:00
Odoo Translation Bot bb28a2d7f6 [I18N] Update translation terms from Transifex 2017-08-27 04:40:12 +02:00
Christophe Simonis feb97a9d7d [FIX] web: bump test timeout 2017-08-25 18:03:14 +02:00
Aaron Bohy 802dde31f3 [FIX] web,barcodes: pager: FIRST and LAST actions
The barcode mechanism is supposed to handle commands PAGER-FIRST
(go to first record referenced in the pager) and PAGER-LAST (go
to last record). Before this rev., it wasn't the case.

We needed to add an option 'notifyChange' to the updateState
function of the pager, to ensure that the form is correctly
reloaded when the pager cursor is manually set (by the barcode
handler) on the first or last element.
2017-08-25 15:54:56 +02:00
Martin Geubelle ebcf35b66c [FIX] web: restore form_view_initial_mode support
The key `form_view_initial_mode` can be set in the action context, to
open the action in edit mode, mainly.

This key wasn't supported since the new view refactoring so this commit
restores its support.
2017-08-25 15:54:56 +02:00
Martin Geubelle 5b968ad371 [FIX] web, barcodes: restore disableAutofocus option
This option has been removed with the new views but was used in barcode.

The form renderer was also dealing with some part of the autofocus
but this should only be handled by the controller.

The logic is now only in the controller and a test case has been added.
2017-08-25 15:54:56 +02:00
Akash Bhavsar b131e9b0ef [FIX] barcodes: fix several issues when scanning barcodes
Since the new views, most of the barcodes feature was
broken. This commit re-enables the support of commands like
'edit', 'save', 'cancel', 'previous' and 'next'.

Also changed javascript event handler to jquery event handler to
make barcodes testable in phantomjs.
2017-08-25 15:54:56 +02:00
Aaron Bohy 7095c32f1c [FIX] web: tests: correctly destroy view 2017-08-25 15:54:56 +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
Géry Debongnie c0247e6a8d [FIX] web: correct evaluation for x2many fields in onchanges
Before this commit, it could happen that a x2many field was considered
invalid, which prevent triggering onchanges, even though each of its
required fields are properly set.  Here is such a scenario:

We have a one2many field something_ids in a form view, with an inline
tree view, which contains a field X.  The field X is required on the
model, but marked required="0" in the inline view.

In that case, we incorrectly evaluated the required modifiers: since the
attrs did not contain the required attribute, we fell back on the
field_get value, which is true in this case.  But this is not correct,
the fieldviewget already computed the actual modifiers and took into
account the fact that it was overridden.  We need to only look at the
modifiers.
2017-08-24 10:58:28 +02:00
Géry Debongnie 04470b8112 [FIX] web: increase timeout for JS unit tests
Some runbot servers are quite slow in the midday, and they fail the unit
tests because the 3min timeout is reached.
2017-08-24 10:58:27 +02:00
Aaron Bohy 6e4b59cc9c [FIX] web: Form: display button box in create mode
Before this rev., the button box wasn't displayed on new (not saved
yet) records. This wasn't the case before the new views.

This is a problem in lunch, as the lunch.order form view is opened
in create mode, and the balance is displayed in the button box.
2017-08-24 07:20:22 +02:00
Aaron Bohy 42f22a2161 [FIX] web: read context when reloading Graph or Pivot views
Before this rev., keys like pivot_measures, graph_mode..., were
correctly took into account at first load of Pivot or Graph view,
but not at reload.

Those keys are particularily useful when a user saves a research
to its favorites. When such a favorite is selected, the view is
reloaded and the interesting information is in the context.
2017-08-24 07:20:22 +02:00
Aaron Bohy acb9d60d94 [FIX] web: Pivot: handle __count__ measure
The former implementation of the Pivot view used __count__ as
magic field to display the number of records in groups. However,
in filters defined in xml, __count is used instead of __count__,
so it crashed when such filters were activated.

With the new views, we made those filters work by using __count.
However, if a user saved filters using __count__ at that time as
favorite, activating them in the new views produces a crash as
well.

This rev. adds a compatibility layer to ensure that the pivot
view handles both __count__ and __count measures uniformly.
2017-08-24 07:20:22 +02:00
Christophe Simonis 30bd5ac0e9 [MERGE] forward port branch saas-16 up to aec6248bb3 2017-08-23 16:44:58 +02:00
qsm-odoo e0d5a875f0 [FIX] web: make "slow" create of m2o fields work
There were some coding mistakes since some changes introduced by
https://github.com/odoo/odoo/commit/d19671f0d0ff7189055cbe0794afed32f8a387e6
2017-08-23 15:14:37 +02:00
Martin Geubelle 65ecd109a5 [FIX] web: reimplement conditions in the "Set Default" dialog
The rev. https://github.com/odoo/odoo/commit/49f0413290821cb123e75b4546873cf98edf1d25 reintroduced
the "Set Default" dialog but forgot the conditions part.

This rev. reintroduces the missing part.
2017-08-23 13:53:18 +02:00
Lucas Perais (lpe) 6797d6a7c6 [FIX] web: don't save empty required x2manys
Before this commit, the same function was called at the rendering and at the writing of a field.
It caused a field that should be displayed all the time (field is never false) to ignore its required attribute, in particular with one2many's.

After this commit, we differentiate between the rendering function and the validate to write function, making a type of field both requirable and always displayed even if empty

OPW 766002

Closes odoo/enterprise#1306

Cherry-pick odoo/enterprise@be8e570991
2017-08-23 12:20:24 +02:00
Nicolas Martinelli 388e258ce8 [FIX] web: rotate graph label
When there are too many labels to display on the x-axis, they overlap
and it simply becomes unreadable. By slightly rotating them, this can be
avoided in most cases.

opw-697625
opw-697626
2017-08-23 08:44:12 +02:00
Martin Geubelle dbab6f7417 [FIX] web: advanced use of widget reference
The reference widget is also meant to be used on a char field, not only on a
reference field.

The rev. https://github.com/odoo/odoo/commit/a4e30a1b43d0b9acd76508d9e6c466cd1dbdffab removed
the use of `field_utils.format.many2one` and replaced it by `_formatValue` to
support this use case.

The replacement wasn't complete as some occurences was remaining (in reset),
which led to traceback when the widget was reset (impossible to create an
External Identifier anymore).

Also, the reference `_formatValue` wasn't correct as it was displaying the
record `display_name` and not the reference field value ; this only makes sense
for the External Identifier as its display name is the reference field value but
it doesn't make any sense for other reference field.

Last but not least, this commit implements the `onchange` and `default_get` for
the reference field.
2017-08-22 14:18:14 +02:00
Adrien Dieudonne 717b472ef9 [FIX] web: calendar: first day of the week
Before this commit, the calendar view showed Sunday as the
first day of the week.
Now it depends on the user lang.
This is the same behavior that we had before the refactoring
of views.
2017-08-22 14:03:12 +02:00
Adrien Dieudonne 0ea1d8c496 [FIX] web: calendar: various fixes
- When you move an all day event to a scheduled event,
  the default duration should be 2 hours instead of 1 hour.
- Before this fix, it was not possible to drop an event
  to an all day event
- In week mode, an all day event was displayed over two days.
2017-08-22 10:38:43 +02:00
Olivier Dony 695716efb0 [FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.

All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.

Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.

Also removed some dead code or improved the API to remove unnecessary
conversions.
2017-08-20 23:25:54 +02:00
Xavier Morel bc7dce254d [FIX] P3: text model, base_url is a string but query_string is bytes 2017-08-20 23:25:54 +02:00
Xavier Morel be7c5aefdf [FIX] P3: CSV reading & writing 2017-08-20 23:25:54 +02:00
Xavier Morel 7dd062f835 [FIX] P3: text model types
* remove references to basestring & unicode (use relevant pycompat
  helpers)
* remove some str calls (either entirely or replaced by relevant
  helper, either text or native)
* use better API to avoid unnecessary conversions
* remove some XML declarations in views
2017-08-20 23:25:54 +02:00
Xavier Morel 3824b5dcc1 [FIX] P3: fix base64 and StringIO uses
* StringIO removed from stdlib, replace with io
* try to correctly handle BytesIO/StringIO (one is for bytes the other
  is for text)
* fix base64: Python 3 removed bytes-encoding and bytes-bytes
  codecs (via #encode) so replace all calls to str.encode('base64'),
  also b64encode is a bytes->bytes conversion so attempt to properly
  handle that

issue #8530
2017-08-20 23:25:54 +02:00
Odoo Translation Bot 8cb991c772 [I18N] Update translation terms from Transifex 2017-08-20 04:40:12 +02:00
Odoo Translation Bot 4c78611784 [I18N] Update translation terms from Transifex 2017-08-20 00:31:52 +02:00
fwi-odoo 657f12a2ae [FIX] web: list_renderer: correct indentation when empty group by
Before this commit, when a group by was done, the empty rows were not
indented correctly. This commit fixes this behaviour.
2017-08-18 16:31:37 +02:00