Commit Graph
12325 Commits
Author SHA1 Message Date
Dharmraj Jhala 2db1b48bfc [FIX] web: declare <!DOCTYPE> at the beginning of 'minimal_layout'
The <!DOCTYPE> declaration must be the very first thing in an HTML
document, otherwise you may experience that the preference is given
to the "user agent stylesheet".

This is the case while printing PDF reports using the 'minimal_layout' template.
For example, layout for 'Picking Operation' report will be different in HTML and
and PDF reports. Text inside <th> will be aligned left in the HTML report, while
center in the PDF one. The issue is there since a long time, but was not obvious
enough to catch till now. (For example, in previous BS versions, explicit rule
was present to align text to the left inside <th> tag, and so the layout did not
break by luck. BSv4 afterwards, this rule was removed, shedding light on this
issue).

This commit improves the behavior while printing PDF reports by placing
<!DOCTYPE> declraration at the very beginning so that preference will be
given to custom stylesheet over "user agent stylesheet".

Task: 1880709
Closes #26846
2018-09-10 17:54:43 +02:00
Christophe Matthieu dabe5bfbae [FIX] web: ajax must return a promise with abort method
Remove part in service_mixins who hide this error. Queries must be able
to be canceled for better performance. Also in the case of longpolling,
if the request is not canceled, wait for a server message or the maximum
time (30 sec) to add or delete channels.
2018-09-10 16:36:43 +02:00
David Monjoie 737ba55e1e [FIX] web: fix misaligned select inputs
Browsers add a 1px padding to inputs but they don't do it for the
select elements, which makes them unaligned.

Tested under Chrome 68, Firefox 61 and Safari 11 on MacOS 10.13.6.
2018-09-10 15:35:06 +02:00
Thibault Delavallée d228dfe498 [FIX] web: correctly find action-related form view ID in calendar
When cliking on a calendar cell user is redirected to a form view to create
a new record. However if the calendar action gives a specific form view ID
it is not taken into account by calendar.

Calendar code still handles views as not being a structure holding viewID and
type but just an ordered list of items with (view ID, type). This commit fixes
that code. One calendar JS test is updated to correctly match the current
structure.

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:08:17 +02:00
Christophe Simonis 767da196ad [FIX] web: tests: refine selector on values only. 2018-09-10 11:33:48 +02:00
Christophe Simonis 6ff1a134e8 [FIX] web: list view: correct sorting by drag&drop
Use newly defined variable introduced by previous forward-port.
2018-09-10 11:31:36 +02:00
Christophe Simonis 0b147d950c [FIX] web: use correct variable name
Oversight of previous forward-port.
2018-09-10 11:26:45 +02:00
Odoo Translation Bot 5e4d4c305f [I18N] Update translation terms from Transifex 2018-09-09 07:07:47 +02:00
Odoo Translation Bot 01d853e295 [I18N] Update translation terms from Transifex 2018-09-09 04:11:03 +02:00
Odoo Translation Bot 956720ed7f [I18N] Update translation terms from Transifex 2018-09-09 02:25:15 +02:00
Odoo Translation Bot 988cadaf5d [I18N] Update translation terms from Transifex 2018-09-09 00:29:00 +02:00
Romain Derie 3a496f18fa [FIX] web: forward-port 10.0->11.0 (CORS error handle)
CORS error was firsly fixed with 4bd8e3e2ed in 11.0
Then it was cherry-pick'd and improved in 10.0 with 9f1438d5f1.
But the improvement was lost during forward port from 10.0 to 11.0.

This commit adds the lost fix.

Closes #26812
2018-09-08 12:58:53 +02:00
Christophe Simonis 68d36512ef [MERGE] forward port branch saas-11.4 up to d78f23df84 2018-09-07 20:20:45 +02:00
svs-odoo 74fcd3ac3b [IMP] web: FieldInteger and FieldFloat can use input of type number
This allow the browser/device to handle the experience of handling number in a more native way.

FieldInteger and FieldFloat now inherits from NumericField because we want
to format it or not dependent of the view (readonly or edit) and the
NumericField will manage it.

We do that because input type number can't take a value with comma on Chrome
(FireFox is more permissive but not perfect because comma is the separator
for decimal in this case).

Task #1880376
2018-09-07 16:18:45 +02:00
ThanhDodeurOdooandPierre Paridans 16aeecc73d [REF] base, mail: Documents (enterprise) related changes
-removed force_ext from ir.http.
    -added signature arg to web/image to differentiate cache entries by URL.
    -added an embed youtube viewer for youtube URL's
    -added a PDF splitter to the PDF viewer UI
    -added tests for mail's Document Viewer
    -added a "signature" param to web/image to go around the browser cache

    -thumbnail field of ir.attachment is now stored in the filestore
    as a distinct attachment.

task 1853490

Co-authored-by: Pierre Paridans <app@odoo.com>
2018-09-07 16:06:47 +02:00
Christophe Simonis 49c3264ce0 [MERGE] forward port branch saas-11.3 up to 4850fb0838 2018-09-07 14:43:48 +02:00
Christophe Simonis 4850fb0838 [MERGE] forward port branch 11.0 up to 9b602ae648 2018-09-07 12:38:59 +02:00
Rémi Rahir 241efab999 [IMP] web: Close window when printing a report
Up until now, the execution of a report action could not be followed by
any action which prevented, for example, to automaticcaly close a modal
after printing a report from it. This has become an issue when working
on customer's invoices using the new modal introduced in 4cb9194275

This commit allows to close a modal after the download of a report.
2018-09-07 09:17:28 +02:00
Rémi Rahir ab0f5f7135 [REM] web: legacy code on action_report
Removing the code that allows to generate multiple reports with a single
action introduced in 410d6a703b as it was
only used for l10n_ch and that this was abandoned in
5169b50efe.
2018-09-07 09:17:28 +02:00
Aaron Bohy a51a5b70d3 [FIX] web: FieldDomain: reset field with a new domain
Before this rev., there was a crash when a FieldDomain was reset
with a new domain (e.g. coming from an onchange). For instance, it
crashed in Email Marketing > create new Mass Mailing > select
mailing lists. Introduced by 68332a01.

opw-1882850
2018-09-07 08:37:45 +02:00
Christophe Simonis 21a186dadd [MERGE] forward port branch 11.0 up to 737ca0eb42 2018-09-06 18:13:56 +02:00
Christophe Simonis 737ca0eb42 [FIX] web: adapt newly added test (2) 2018-09-06 17:27:50 +02:00
Christophe Simonis 63f95760ef [FIX] web: adapt newly added test
Oversight of previous forward-port
2018-09-06 17:23:27 +02:00
Christophe Simonis 505e42b78b [MERGE] forward port branch saas-15 up to 5a5d6d1e8e 2018-09-06 17:00:26 +02:00
Christophe Simonis 5a5d6d1e8e [MERGE] forward port branch saas-14 up to c7de55dc3c 2018-09-06 15:30:59 +02:00
Christophe Simonis c7de55dc3c [MERGE] forward port branch 10.0 up to 72f76caa39 2018-09-06 15:29:08 +02:00
Nicolas Lempereur 72f76caa39 [FIX] web: relativedelta>11months work as expected
Since march 2015, using in a domain "relativedelta(months=X)" with
X being bigger than 11 or lower than -11 would result in an error.

This is because in the refactoring adding modules (e8a00bc50d) the two
functions divmod and utils.divmod with different implementation in
pyeval.js were replaced by one function divmod in web.utils module.

But there was still an usage of the removed implementation.

opw-1880766
closes #26816
2018-09-06 13:14:42 +02:00
Alexandre Kühn d5715f482f [FIX] web: no padding/border twice in dom.autoresize
Before this commit, the `dom.autoresize` function may apply the
padding and border width twice when computing the height of the
textarea. This issue occurs when the fixed textarea had the same
CSS style as the textarea.

This commit fixes the issue by enforcing zero padding and border
width in the fixed textarea.

Task-ID 1882736
2018-09-06 12:23:28 +02:00
Christophe Simonis f19e6ce561 [MERGE] forward port branch 11.0 up to 213759b03e 2018-09-05 18:52:27 +02:00
ThanhDodeurOdoo 5e855453ae [FIX] web: web/image route image type fix
- the http route, when given width and height arguments is no
longer forcing the type PNG (which resulted in heavier images than the
original).
2018-09-05 16:33:25 +02:00
Aaron Bohy 5ccc3f66e8 [FIX] web: read_progress_bar: convert dates to strings
Since rev. 960360af, Date (resp. Datetime) fields return
datetime.date (resp. datetime.datetime) objects. This caused an
issue in the read_progress_bar method which returns a dict, whose
keys are values of the group_by. Indeed, when grouped on a Date or
Datetime field, the key was no longer a string but a datetime.date
or datetime.datetime object, and it crashed when that dict was
turned into a JSON string.

This method isn't tested at all for now, but tests will come
shortly.

Task 1878254.
2018-09-05 15:25:57 +02:00
Olivier Dony fec74a6da5 [FIX] web: make server-wide modules ordered again
Rev. 279d928693 forced
`server_wide_modules` to include 'base' and 'web', because both contain
controllers that need to be always loaded.

However the patch used a set() that randomized the order of the list,
when combined with Python 3.5's randomized hash function.

This is turn could cause the checksum of asset bundles (web.assets_backend)
to randomly vary, which could cause rapid assets recycling and errors.
2018-09-05 14:47:55 +02:00
len-odoo f4f1480a3e [FIX] web: lock handle when sorting on a different field
The resequence mechanism works if the sequence is sorted by its handle field.
Therefore sorting on another field should lock the handle, while sorting on the
handle field should unlock the handle.

opw 1867049
2018-09-05 13:09:36 +02:00
Odoo Translation Bot 55a5aca6d9 [I18N] Update translation terms from Transifex 2018-09-05 11:24:24 +02:00
Martin Trigaux cdb4b1c7c2 [I18N] export saas-11.5 source terms 2018-09-05 10:59:44 +02:00
Nicolas Martinelli 31981731ea [FIX] web: time display
The calendar should use the time format of the language parameters.

Partial backport of d4b5668c1a

opw-1881335
2018-09-05 08:53:35 +02:00
Aaron Bohy 06e6887950 [FIX] web: Kanban: quick create with correct values
Let's assume a quick create form view with an onchange. Before
this rev., if the user set a value for the char field with
onchange, then clicked on 'Add', the record was created before
the onchange was applied, and thus with incorrect/incomplete data.

The reason is that, when clicking on 'Add', the user triggers a
'change' event on the char field, which notifies the model of its
new value. Then, as 'Add' is clicked, the quick create widgets asks
all widgets to commit their potential (uncommitted yet) changes.
But there is nothing left to commit as the changes have just been
notified. The quick create only waits for this to make the create
RPC, and thus totally ignores the changes that were committed at
the first place.

Task 1878254.
2018-09-05 08:47:21 +02:00
Aaron Bohy f29f131f85 [IMP] web: concurrency: add getUnlockedDef to mutex
This rev. adds a new function to the mutex concurrency helper:
'getUnlockedef'. This function returns a deferred resolved as soon
as the mutex has no more task to execute (or directly if it is
currently idle).

Such a function was needed for an upcoming fix.

Related to task 1878254.
2018-09-05 08:47:21 +02:00
Aaron Bohy 71254e956d [FIX] web: Kanban quick create: prevent multiple creation
Before this rev., if the user clicked several times on 'Add' (or
pressed several times 'Enter'), on a KanbanQuickCreate record,
multiple records were created.

This rev. makes sure that this doesn't happen anymore by locking
the widget when it is creating a record ('create' RPC that might
be preceeded by an 'onchange' RPC).

Several test cases are added, to mock the different scenarios that
could occur, as they are all slightly different (depending on if
there is an onchange or not and if the user clicks on Add or press
Enter).

There is still a scenario that needs to be handled, which is the
one with an onchange and where the user clicks on 'Add'. This one
is more tricky and will be handled by a future commit.

Task 1878254.
2018-09-05 08:47:21 +02:00
Aaron Bohy db9b91ffe6 [FIX] web: BasicController: remove deadlock situation
This rev. removes a deadlock situation that could *theoretically*
occur, but that was actually hard to reach in practice.

Before saving a record (e.g. in a form view), all field widgets
are asked to commit their value (in case they wouldn't have
notified the model yet, e.g. because the user just changed them).
For instance, let's assume that the user fills an input field, and
then triggers the save. In practice, by triggering the save, it
will force the widget to notify the model of its new value (because
it looses the focus). This is also the case using keyboard
navigation, as it actually simulates clicks. So when the widget is
asked to commit its value right after, it has nothing more to
commit.

This is fortunate, because if it actually had something to commit,
we would end up in a deadlock ('commitChanges' is executed in a
mutex, and if the widget triggers a new value, '_applyChange' is
called, and is executed in that mutex as well). In fact, executing
'commitChanges' in a mutex is useless, as '_applyChange', which is
called when a widget has something to commit, is already executed
in the mutex.

So this rev. removes the use of the mutex in 'commitChanges'.

Doing so broke several Many2One tests, because they wrongly relied
on the presence of the mutex for scenarios where the user quick
creates a relational record, and then directly saves (before the
relational record is actually created). We thus handled that
usecase properly to make the tests pass.

Task 1878254.
2018-09-05 08:47:21 +02:00
Aaron Bohy 027436ee5a [REF] web: FormTests: move test to correct section 2018-09-05 08:47:21 +02:00
Christophe Matthieu f29df7fb2e [FIX] web: Fixed the printing of reports.
A new exception has been added to detect inconsistent reports. However, many are not structured as expected. Thus, the change consists mainly of checking only when the print has to be separated in part to attach it to the respective documents.

We now take the page tag instead of the article, because the article tag is in the layout, so to separate the file, the t-call had to be inside the t-foreach (for the separation) and so possibly read the assets several times. Since all templates have the first tag (in the t-foreach) tag page, the choice is more sensible.

The javascripts files used in readonly were taken out of the editing assets.

A turn was made but not activated, it works locally, but on the runbot, an error is triggered when generating assets after choosing the settings.
2018-09-04 19:01:20 +02:00
Mathieu Duckerts-Antoine c4557580ef [IMP] web: review time range menu rendering
This commit changes two things in the time range menu
appearance:

	- the order of range options
	- the spacing between them (now two different groups
	  are separated by an empty lines)

Some tests had to be changed accordingly.
2018-09-04 17:37:14 +02:00
Mathieu Duckerts-Antoine 5510d808b8 [FIX] web: return information on pivot measures and groupbys
This commit fixes a bad behavior of the pivot view. By the
past, if there were no data to present in the pivot view, no
information on the pivot view configuration was returned by
the get function. This does not cause problems to the pivot
renderer (by design) but causes problems elsewhere, for
instance in a dashboard view that contains a pivot view.
Indeed, at each update, the dashboard view reinstantiates its
subviews, so that information can be lost if a subview is of
pivot type.
2018-09-04 17:37:14 +02:00
Mathieu Duckerts-Antoine d4b26c3372 [FIX] web: pivot model accept no __count key or null values
The _mergeData function used in pivot view comparison mode
was not designed to accept the absence of the __count key or
null values for measures in the objects returned by a 'read_group'.

The absence of the __count key would result in a traceback and null
values for measures into wrong calculations (infinities).

One could ask why null values did not cause problem before.
The simple reason is that the formatters used to format cell values
render a 'null' value like they render a zero.
This fix makes explicit that null values have to be considered
as zeros and avoid in that way Infinity values when computing
variations.
2018-09-04 17:37:07 +02:00
Mathieu Duckerts-Antoine 004b6e8b1c [FIX] web: fix time range menu button style in mobile mode
The search view in mobile mode has been redesigned and looks a bit different
from the search view in desktop mode. This commit adapts the time range menu
appearance in mobile mode.
2018-09-04 17:34:47 +02:00
Mathieu Duckerts-Antoine 39cfd5baa1 [FIX] web: export to excel in pivot view
Exporting data of a pivot view in comparison mode ends in a
crash. The root cause is that _t was replaced by _lt
so that some strings were replaced by objects with a toString method.
This does not cause problems when rendering a pivot view since
both QWeb or JQuery call that method. The function _exportData does not.

This commit fixes that situation and adds a test of _exportData.
2018-09-04 17:34:19 +02:00
Mathieu Duckerts-Antoine 4f4f111349 [FIX] web: disable buttons when no data presented in pivot view
The buttons 'Flip Axis', 'Expand All', and 'Download xls' are
now deactivated when no data are displayed in the pivot view
(those buttons are useless in that situation).
2018-09-04 17:34:02 +02:00
Nicolas Martinelli eaff0a71bd [FIX] web: export field with '/'
- Activate lots and SN
- Go to Inventory > Inventory Adjustments
- Export a record
- Select the field 'Inventories > Lot/Serial Number'

The `name_get` of the field is exported, not its XMLID.

This is because the parsing made in order to limit the depth of export
is made on the label, not on the field name.

Actually, it is not clear WHY this limitation exists, but we keep it for
compatibility purpose.

opw-1877092
2018-09-04 11:40:19 +02:00
Nicolas Lempereur 4cb585ab4f [FIX] web: ignore default_* on group creation
When a column is created in the kanban view, the context of the window
action is fully given but it may contain default_{field_name} context
keys that are intended for the action model.

eg. on a product.product view we could have {default_type:'product'} in
the context, if we grouped by company_id and created a new company, we
would the context is propagated and we would try to set type='product'
on the company (which causes an error).

Without the change, the added test fails with:

  default_* should be removed from context, actual: "true", expected: "false"

opw-1879064
closes #26676
2018-09-04 11:03:15 +02:00