Commit Graph

639 Commits

Author SHA1 Message Date
EL HADJI DEM 7b0d707417 [IMP] web: better content-type for attachments
Add the corresponding content type document instead the default content type.
This allows browser to detect the type of file being downloaded.
Fixes #1225
2016-06-03 12:01:27 +00:00
Holger Brunn f9f7669e60 [FIX] pass context as keyword argument to search()
closes #10080
2015-12-16 11:42:05 +01:00
Denis Ledoux 8209368b02 [FIX] web: current transaction is aborted
This reverts commit bd9cbdfc41.

The above revision solved the SQL constraints not being
translated when raised. They were not translated because
the context, containing the lang, was not located as expected
in the `kwargs` dict.

While it solved this issue, it had as side-effect to raise
`current transaction is aborted,
commands ignored until end of transaction block` errors more
often when using the web client.

This can be explained by the double check, when the first
check raised this error
- which can happen, e.g. when the cursor is closed,
there is a retry mechanism in such cases -
and by the fact the transaction was not rollbacked.

This issue could have been solved as well by rollbacking
the transaction, but it is regarded as not-so-clean.

Therefore, to solve this issue, while still having
the SQL constraints translated, we apply the
second patch proposed in bd9cbdfc41
commit message, which is not-so-clean as well, but
which is a proper solution.

opw-651393
2015-10-13 17:12:34 +02:00
Denis Ledoux aabbdc7339 [FIX] web: Safari, download of attachments with accents
The structure `filename*=UTF-8` works in Safari, from
release 6.2 (which is set as version 537 in the user_agent version).

This structure has the advantage to handle the UTF-8 encoding,
and therefore special characters, such as accents.

Therefore, from this Safari release, we use the same format
than other browser. For older releases, we use the format
`filename=`, without UTF-8, ASCII encoded, replacing
special characters by `?`.

opw-649863
2015-09-21 15:30:05 +02:00
Denis Ledoux bd9cbdfc41 [FIX] web: sql constraint translation
The `check` decorator expects the context to be in the `kwargs`
or to be the last arguments of the method.

The `call_kw` route, which is decorated by the `check` decorator,
like every route,
expands its kwargs arguments.

Therefore, once in the `check` decorator,
the context is located in the `kwargs` key
of the kwargs.
(More simply, instead of
`kwargs.get('context', {})`
it's
`kwargs.get('kwargs', {}).get('context', {})`

As the context is not retrieved correctly,
the lang is not set correctly either,
and the sql constraints were not translated.

In 7.0, it worked, because there was a double
check, as the call_kw was called trough an rpc
(`dispatch_rpc`) call,
which was decorated by the `check` as well.

As a fix for 8.0, we apply the same logic,
we perform a double check, with an indirection.

The check decorator should probably be
refactored, but this cannot be done
in a stable release such as 8.0.

Closes #3634
2015-09-04 12:58:00 +02:00
Nicolas Lempereur 0ea89c10b6 [FIX] web: keep hash when login redirect
The anchor part of the url should be kept when a login redirect is done.

introduced by 8f3f9ef46b

note: for 8.0 and saas-6
2015-08-20 11:09:23 +02:00
Nicolas Lempereur 3f1e99c4b9 [FIX] web, website_form_website_sale: form and login
Partial backport of commit 093e39bd.

When a flow is stopped by a login redirection, some data (e.g: a product
comment being posted) could be lost. This commit in this case convert
POST request data to GET data (so it is possible to add a GET controller
which after login will terminate the action).

closes #7100
opw-642350
2015-06-17 11:33:20 +02:00
Martin Trigaux 87d48b0859 [FIX] web: do not crash when select wrong db
When a user tries to log into a postgresql database with no view web.login (this
happens if the database is not an odoo database or using a previous version of
odoo), the rendering failed, producing a 500 error (with no detail for the user)
Instead, redirect to the database selector with an informative message.
Fixes #3443

The database selector page is a jinja template with no access to database
required so should be able to be displayed on any database.

Future improvement could verify the version of base module for even more precise
verification before login (but need to make sure it's always accurate).
2015-06-09 15:05:57 +02:00
Denis Ledoux db3e5716b3 [FIX] ir_attachment: write traceback to logs when upload fail
When the upload of an attachment failed,
e.g. for access rights reasons,
the traceback wasn't written or returned anywhere,
preventing the easy debugging.

opw-640242
2015-05-20 11:09:05 +02:00
Christophe Simonis f722254018 [MERGE] forward port of branch saas-3 up to 0f5b6cf 2015-05-18 17:13:50 +02:00
Christophe Simonis 0f5b6cf60b [MERGE] forward port of branch 7.0 up to c435b84 2015-05-18 17:13:18 +02:00
Goffin Simon c435b8438e [FIX] web: With safari, UnicodeDecodeError
The headers returned by content_disposition must be either in Unicode or in ASCII.
The encode function expects a Unicode or ASCII string.
The quote function from urllib2 expects a UTF-8 string and retruns a ASCII string.

opw:634205
Fixes #6160, #6557
2015-05-13 16:56:12 +02:00
Denis Ledoux 272e085df4 [MERGE] forward port of branch saas-3 up to da93981 2015-05-07 11:34:48 +02:00
Denis Ledoux da93981cb0 [MERGE] forward port of branch 7.0 up to f300d64 2015-05-07 11:33:59 +02:00
Goffin Simon f300d648a8 [FIX] web: attachment with safari
With Safari, the function content_disposition must return "attachment; filename=\"%s\"" % filename
to avoid that Werkzeug raises an UnicodeDecodeError.

Fixes #6160
opw:634205
2015-05-07 10:13:10 +02:00
Nicolas Lempereur f2fccdfaf0 [FIX] web: allow to export unordinary table
Previously, there was an exception when exporting unordinary table (e.g:
reports) coming from the export of the xml_id.

With this change, if the table is not ordinary, the xml_id is not
present in the exported file.

closes #6428
issue #6336
opw-633066
2015-04-26 16:38:36 +02:00
Nicolas Lempereur 37959d45f3 [FIX] qweb: css minified in multiple page for IE
On internet explorer 6, 7, 8 and 9, the limit of CSS rules in a stylesheet is
4095 (http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/10164546.aspx).

This commit breaks down a CSS bundle in several pages for these IE versions.

To do this, the CSS tag added is of the kind : /web/css.0/{xmlid}/{version} in
which there is:

- the whole CSS if there is no more than one page,
- a list of @import pointing to the multiple pages.

note: if a modification lowers the number of page, an old page may stay in
ir_attachment (e.g: go from 4 to 3 pages, the old 4th page of another version
will not be deleted untill the number goes again up to 4).

Note: the method css(self) previously returned an unicode variable (the first
time) or an str variable (the following times, if already cached), the fix
also correct this so an str variable is always returned.

fixes #5050

opw-627116
2015-04-07 09:56:44 +02:00
Olivier Dony 694fe1fb3f [FIX] web: remove deprecated hack for future_display_name
This temporary patch was used to simulate the presence of a
`display_name` field in all models. It is not needed anymore
as of version 8.0, which comes with the actual magic to make
`display_name` work everywhere.
2015-03-18 14:10:18 +01:00
Christophe Simonis 4a3c4713e9 [MERGE] forward port of branch 7.0 up to 209ce6f 2015-03-09 11:24:32 +01:00
xmo-odoo d9c9ac72da [FIX] export: decode Field strings before comparisons
Allows exporting fields whose string is a non-ascii *byte*string (rather than unicode).

backport of 7286f4e424 fixing #773 to branch 7.0 by request of @flotho
2015-03-06 13:12:50 +01:00
Denis Ledoux b0be8dfdfd [MERGE] forward port of branch saas-3 up to aae75f1 2015-02-20 16:43:15 +01:00
Denis Ledoux 7613d5d499 [MERGE] forward port of branch 7.0 up to 27a48f8 2015-02-20 15:57:51 +01:00
Denis Ledoux 27a48f8026 [FIX] web: action translation (menuitems & more menu)
This rev. reverts partially 1d76586a1b
This rev. is related to #3462

Regarding addons/web/controllers/main.py
---
name of model ir.actions.actions is not translated
it's the name of server actions, client actions and window actions
that are translated.
Meaning the name of the ir.actions.actions will always be in English,
even when passing the user language within the context.

Regarding addons/web/static/src/js/views.js
---
There is no reason to pass the field values within the context
of the /web/action/load call: The read methods of actions are
not overidden to use the field values. Besides, it pollutes
the context of the action, leading to unwanted behavior, such
as the translation of the action name within the lang available in the
fields of the form view (e.g. the partner form).

Initially, the field values added in the context has been added
within the rev. 542928adde
Indeed, sidebar_context (or sidebar_eval_context nowadays), contains
the field values, and the additional_context passed to /web/action/load
is an extension of this sidebar_context.
We are not sure the reasons why the sidebar_context was passed to the
/web/action/load, but we believe it was to pass the session/user context
containing the lang, timezone, and so on, not to pass the fields values.
2015-02-20 15:36:47 +01:00
Denis Ledoux 534d4e3e07 [MERGE] forward port of branch saas-3 up to a8fdc60 2015-02-09 17:58:28 +01:00
Denis Ledoux a8fdc60b88 [MERGE] forward port of branch 7.0 up to 1d76586 2015-02-09 17:57:39 +01:00
Denis Ledoux 1d76586a1b [FIX] web: context lang & active* in action buttons
This reverts rev. 9f9e7ef0e1

As explained in 9f9e7ef0e1,
if a field "lang" is present in the view, clicking in any action item
in the more menu leaded for the action title to be translated
in the lang value of the form, such as in the partner form.

9f9e7ef0e1 fixed the issue,
but has as side-effect to not update correctly the active* keys.
So, if "active_id" was used in the context of the action button,
and the active_id was set in the dataset context, for example
because you come from another form, trough another action button
(For instance, Customers > Opportunities > Logged Calls),
the active_id was not updated with the current id of the record.

opw-620293
opw-617321
fixes #3462
2015-02-09 17:53:11 +01:00
Xavier Morel 3d85eaa591 [FIX] correctly handle empty binary fields in saveas
Original code assumed the empty field would be missing or an empty
string, b64decoding an empty string yields an other empty string which
triggered a "not found" response.

However Odoo returns ``False`` in case of an empty field, so that needs
to be replaced by an empty string before decoding, as b64decode doesn't
accept booleans as input (for some reason...)
2015-01-29 16:11:16 +01:00
Olivier Dony 801a8b8fa9 [MERGE] Forward-port latest saas-3 bugfixes, up to c9b690f6b6 2015-01-29 13:54:13 +01:00
Olivier Dony c9b690f6b6 [MERGE] Forward-port latest 7.0 bugfixes, up to 4c2706d685 2015-01-29 13:50:51 +01:00
Denis Ledoux 4c2706d685 [FIX] web: saveas_ajax, correct filename when data passed directly
In cases where data is directly given to the saveas_ajax controller,
the filename was not correctly set, as no read method was performed.
(The read call is useless as the data is already avaiable in such a case)
In such cases, the filename must be given in advance

opw-626707
2015-01-29 12:51:47 +01:00
Antony Lesuisse c1c8ac7d7f [FIX] dbmanager: backup allow pg_dump custom dump to be larger than diskspace
- delete a forgotten print
- allow pg_dump custom dumps to be larger than the available disk size, the
  previous commit allowed dumps to be larger than memory, this one remove this
  limitation. zip dumps are still limited to by the disk size.
2015-01-19 02:42:34 +01:00
Antony Lesuisse ec9a543014 [FIX] dbmanager: backup support both zip and pg_dump custom format
- let the user choose between the pg_dump custom format or the zip format including the filestore
- use file objects to allow dumps larger than memory
- postgres subprocess invocation is now clean and thread-safe, we dont touch the local process environ anymore
- add a manifest to the zip dump format with version information about odoo, postgres (pg_dump doesnt output it) and modules
2015-01-19 02:05:12 +01:00
Denis Ledoux 62bc63e44f [FIX] web: force company_logo change on company change
In multi company environment, the company logo was not updated on company change in the user preferences
This disrupted the end user, as he might think the company change did not happen.
2014-11-27 15:21:25 +01:00
Olivier Dony 0d83089398 [FIX] /web/binary/{image,saveas}: use request.registry instead of deprecated `request.session.model`
This makes the controllers work also for
public users, e.g. in the frontend.
2014-11-10 15:32:18 +01:00
Jeremy Kersten 6e48c892dd [ADD] web: add a route '/web/dbredirect' to ensure the connection to the right database via the get param db. 2014-10-24 17:19:55 +02:00
Christophe Simonis 262eb662de [MERGE] forward port of branch 8.0 up to d80376a 2014-10-21 14:33:36 +02:00
Christophe Simonis edc4b0b9bb [FIX] {web,point_of_sale}: allow cross-origin access to company logo 2014-10-20 20:14:36 +02:00
Fabien Meghazi eea8d81a86 [IMP] use http.send_file() for /logo.png 2014-09-16 19:54:59 +02:00
Denis Ledoux 911f815019 [MERGE] forward port of branch saas-5 up to 9699f62 2014-09-15 15:24:49 +02:00
Denis Ledoux 9699f62b31 [MERGE] forward port of branch saas-3 up to 685fa26 2014-09-15 15:24:19 +02:00
Denis Ledoux 685fa26e83 [FIX] web: do not check if db in session match filter if no db 2014-09-15 15:22:04 +02:00
Christophe Simonis 780dd9891f [MERGE] forward port of branch saas-5 up to 7eab880 2014-09-15 14:00:02 +02:00
Denis Ledoux 42680c9906 [FIX] web: backport of ebb826a and 2372d30
Fixing breadcrumb not being displayed after some action button (e.g. validate invoice, opw 612763)
2014-09-15 12:38:35 +02:00
Christophe Simonis 56f2b7ae0f [MERGE] forward port of branch saas-3 up to fdc6271 2014-09-12 18:53:48 +02:00
Frederic van der Essen 3f5f76f246 [FIX] point_of_sale: fix some image chaching issues with the receipt logo. Using a random url at each fetch ensures that we don't get cached results 2014-09-10 14:56:24 +02:00
Frederic van der Essen 13bd2eaa3e [FIX] point_of_sale: prevent the company logo from being cached by the browser by accessing it via a random URL 2014-09-10 13:52:04 +02:00
Denis Ledoux e447a46ec8 [MERGE] forward port of branch 7.0 up to 33e0910 2014-09-09 18:02:30 +02:00
Denis Ledoux 085ad7fcc4 [FIX] web: do not allow to access a database if not matching db-filter 2014-09-05 14:57:59 +02:00
Christophe Simonis 5dff035878 [MERGE] forward port of branch saas-5 up to 39bee35 2014-08-20 20:33:17 +02:00
Christophe Simonis c3131317d7 [MERGE] forward port of branch saas-4 up to ddef2dd 2014-08-20 17:57:22 +02:00