Commit Graph

394 Commits

Author SHA1 Message Date
Olivier Dony 8d745f9f50 [FIX] account, mail, etc.: uniformize evaluated expressions
opw-626694
2015-05-21 15:26:35 +02:00
Jeremy Kersten 9f93a9ae1c [IMP] ir_http: add facebookinternalhit in the list of bot.
Avoid redirect in en_US if lang is installed  when a link is added via Facebook
2015-05-05 10:55:00 +02:00
Olivier Dony c667eb06b8 [FIX] website: only consider valid languages in URL path
Improves aea358ca67 and avoid spurious
redirects for URLs that do not match a controller but do not
have a valid language.

When the URL does not match any controller, the language
matcher tried to strip the leading path component, treating
it as a language code. For example:
    /fr_BE/page/homepage
would not match any route, so it would be rerouted internally
as  /page/homepage, after setting `request.lang` to fr_BE.

This breaks the magical 404 handler that allows ir.attachment
entries to be mapped to static URLs. Due to the internal rerouting,
the mapping of e.g. /website_mycompany/static/src/image/logo.png
would be rerouted to /static/src/image/logo.png and not match
the mapped URL anymore.

Now the stripping of the path component will only occur if
that path component matches an installed language code.

The consequence is that URLs containing uninstalled language codes
will now lead to 404 errors - an acceptable trade-off (e.g.
when an older version of the website is still indexed by a search
engine)
2015-05-05 10:12:22 +02:00
Jeremy Kersten aea358ca67 [FIX] website: ir_http - auto redirect for lang, use cookies to save pref language
Save in cookie the last lang selected to allow to stay consistent at the next visit from visitor
2015-04-29 14:19:52 +02:00
Christophe Simonis db23690db3 [FIX] website: json are not multilang by default.
This avoid useless redirection.
2015-04-08 18:31:43 +02:00
Jeremy Kersten a696913364 [FIX] website: ir_http - no redirect for bot and save lang in cookie
Detect most of bots/crawlers to avoid auto redirect. Most bots fetch
with lang en_US, so even if default website lang was not in en_US,
googlebot was redirected to en_US page.

Now we keep also the language selected by user into a cookie.
If cookie exists but lang not in url, we redirect the user into
his preferred language.

Manage special case to allow to change the lang in url to set the
default lang at fly in url and set the cookie...

Many routes are not specified as multilang=False but should be.
With the auto redirection, we need to update these routes to avoid
useless redirects !
2015-04-08 15:39:57 +02:00
FalcoBolger 95b921d0f7 [FIX] website: move support for ir.attachment resources to web module
Commit 540b753bf8 introduced
support for resources stored as ir.attachment records in
asset bundles too.
This is specifically useful for customizations.

However the HTTP route for reaching those resources
when they are *not* in a bundle was originally created
in the `website` module (as a special handling for
404 requests)

This means that these dynamic resources would only
be partially supported when `website` is not installed,
causing various problems:
 - missing resources in debug mode where bundles are skipped
 - errors when trying to define new client-side Qweb templates
   via XML resources - which are loaded with a direct request
 - ...

This commit moves back the supporting code to the web module.

The `mimetype` column is not present in ir.attachment without
the `website` module, but sniffing it based on the attachment
name works fine at serving time too.

Closes #6002
2015-03-26 17:33:19 +01:00
Raphael Collet 0beb14f0d2 [FIX] ormcache: fix calls to `ormcache` with unexpected context parameter
The implementation of `ormcache` does not work on methods that take a `context`
parameter.  Because of the decorator `decorator`, the arguments of the call are
passed positionally to the method `ormcache.lookup`, and positional arguments
are used in the cache key.

The fix consists in removing the `context` parameter from the faulty methods,
either directly, or by caching a private method called by the public method.
2015-03-26 16:42:10 +01:00
Goffin Simon cbb51610ee [FIX] ir.ui.view: qweb translations: allow looking up translation in parent template
- Translations lookup normally uses the namespace of the current
QWeb template, after merging all inherited views.
But when a QWeb template is "cloned" by a child view using
inheritance with `primary` mode, the translations are more
likely to exist for the original (parent) template, and would not
be found when using only the "child" namespace.
This patch adds support for looking up each translation
also in the parent namespace in this case, if none was found
for the child template in the first place.

- ir.translation's _get_source() now supports a list of res_id
to search for, in addition to a single res_id

- Also moved the logic of routes /website/customize_template_get
and /website/get_view_translations to the ir.ui.view model where
it belongs.

opw: 615241

Closes #5325
2015-02-24 14:01:34 +01:00
Jeremy Kersten 9d89b179c4 [FIX] website: search a matching route with http method POST
When url_for was looking for a route which match, it was only looking for GET route.
So routes which were restricted to be used only with a POST method, were never found.

The result was that urls in website for route post (form in most cases) was never prefixed with the lang.
So the request.lang was always the default lang from website...

If you was creating a sale order (in ecommerce), the lang used in sale order was wrong and the description not in the current lang.
2015-01-15 23:16:33 +01:00
Jos De Graeve 544eefdd32 [FIX] website: add missing decorator for better guess type
The definition of the render method was guessed as cr_uid_context instead of
cr_uid_ids_context, making calls in the new api breaks
Fixes #4401
2014-12-23 14:29:59 +01:00
Denis Ledoux 2bebba76d0 [FIX] website: image_url fallback when no write_date 2014-12-12 13:09:07 +01:00
Martin Trigaux b3060f2771 [FIX] website: can not change website name
The website name is by default "localhost" (used in the page title in the format
"Current Page | Website Name") but there were no way to change it.
Fixes #3493
2014-12-01 16:50:51 +01:00
Denis Ledoux b499eac2ed [FIX] website: the attachment creation improvment of a3e578068e must be done on res_model
instead of type
2014-11-25 19:26:13 +01:00
Denis Ledoux a3e578068e [FIX] website: improve performance for attachment creation
website introduces two new stored function fields, which depend on the attachment data
The thing is, these two fields are pertinent for website attachments only
Therefore, we avoid to read the datas field when the attachment is not a website attachment(when not needed), as this is the most costly field to read
2014-11-25 14:39:54 +01:00
Jeremy Kersten 738a895dba [FIX] ir_qweb, website_blog: Allow to pass inline style as an option for the widget image. And change some img from blog to use this widget 2014-11-05 11:11:26 +01:00
Raphael Collet f2e4a10e1a [IMP] use model._fields instead of model._all_columns to cover all fields
The old-api model._all_columns contains information about model._columns and
inherited columns.  This dictionary is missing new-api computed non-stored
fields, and the new field objects provide a more readable api...

This commit contains the following changes:

 - adapt several methods of BaseModel to use fields instead of columns and
   _all_columns

 - copy all semantic-free attributes of related fields from their source

 - add attribute 'group_operator' on integer and float fields

 - base, base_action_rule, crm, edi, hr, mail, mass_mailing, pad,
   payment_acquirer, share, website, website_crm, website_mail: simply use
   _fields instead of _all_columns

 - base, decimal_precision, website: adapt qweb rendering methods to use fields
   instead of columns
2014-11-04 13:47:57 +01:00
Fabien Meghazi 3e07eaa308 [FIX] Regression in image resize helper (Fixes #2529)
Commit 57ad514b makes the function preserve the aspect ration of the
original picture. Error of mine because the expected behavior was to
lose it for kanban view purpose.

For backward compatibility sake, this commit will keep the old behavior
by default.
2014-10-27 17:55:08 +01:00
Martin Trigaux d5235f7326 [IMP] website: google maps url
Use the protocol as the current page to avoid warning with mixed content (loading map in http inside an https page)
2014-10-23 12:38:31 +02:00
Denis Ledoux 639174bc53 [FIX] website: prevent editing contact address with qweb contact widget
Because, currently, it copy the whole address in the contact name. The address is therefore duplicated
2014-10-16 18:39:37 +02:00
Jeremy Kersten c8e14f301f [FIX] GeoIP - allow to specify the path to GeoIP in the server config.
--geoip_db='the_path'  which can be used via openerp.tool.config['geoip_database']
2014-10-13 16:47:12 +02:00
Xavier Morel 2ffcff8fa9 [ADD] qweb: handling of t-att=mapping
Changed render_att_att to return an iterable of pairs instead of a pair, and
dispatched t-att on whether its result is a Mapping.

Also changed qweb test runner so it uses ordereddict for JSON mapping in
params, otherwise iteration order (and thus order of attributes in output) is
unpredictable and results don't/can't match expectations (as both are
strings).

Note that this relies on JS implementation details wrt iteration order of
mappings. Tests would probably be somewhat less brittle if rendering output
was parsed to XML... if that's possible (?)
2014-10-06 19:13:44 +02:00
Christophe Matthieu 77c41cc5cb [FIX] website: 'Display Editor Bar on Website' group stopped working at commit a2ef044c47
The Edit button never appeared anymore for these users.
The idea was that they should see an edit button with
limited editing capabilities depending on their other
access rights.
For example, someone with only Sales Manager access and
'Display Editor Bar on Website'
would be able to edit online quotes from the website_quote
module, but not change the actual website pages or menus,
for instance.
2014-09-26 16:50:34 +02:00
Fabien Meghazi 51477fb4f6 [IMP] Brought back /website/image route w/filename hinted in headers
Also added support for this route in widget Image#from_html()
2014-09-17 16:54:08 +02:00
Fabien Meghazi cf3e517b58 [FIX] website.image_url() access rights 2014-09-16 21:32:37 +02:00
Fabien Meghazi 954f20c800 [ADD] image_save_for_web() format argument 2014-09-16 19:55:00 +02:00
Fabien Meghazi 89362bd6cd [ADD] tools.image_save_for_web() helper for image compression 2014-09-16 19:55:00 +02:00
Fabien Meghazi 3f27066019 [IMP] Compress resized /website/image's
Refactored and fixed tools.image_resize_image() that converted to RGBA
after making thumbnails, resulting in bad looking picture in case the
source is in 'P' mode (indexed palette)
2014-09-16 19:55:00 +02:00
Fabien Meghazi bc5e6fa2cb [ADD] Helper for /website/image (allows to use aggressive cache) 2014-09-16 19:54:59 +02:00
Fabien Meghazi 060fa29883 [FIX] request.website browse record bad context 2014-09-16 14:16:43 +02:00
Christophe Simonis a10cd334d0 [IMP] mail,website: improve update_notification 2014-09-15 18:53:22 +02:00
Olivier Dony d32d120a0a [MERGE] Forward-port of saas-5 up to 9ce08b7 2014-09-08 16:54:10 +02:00
Fabien Meghazi c981d068ab [FIX] Restore /login redirection on SessionExpired
The feature was broken due to an incompatibility
when forward porting 624f256 and a78e27f
2014-09-05 16:24:59 +02:00
Antony Lesuisse 2d296cb779 [MERGE] ir-ui-view split active and show_customize
Split the ternary field application in active and show_customize, all four
possible value are now needed for the customize theme popup.
2014-08-31 16:56:44 +02:00
Fabien Meghazi 5e6e1303e3 [IMP] pretty urls for /website/image 2014-08-28 16:37:38 +02:00
Fabien Meghazi f2583323a9 [FIX] language and model converter redirections should use code=301 2014-08-27 14:05:09 +02:00
Jeremy Kersten 20d366595c [IMP] website: Redirect user in the language of the browser 2014-08-26 11:54:07 +02:00
Fabien Meghazi 709dc659b2 [IMP] Allow to specify http code for request.redirect() 2014-08-26 11:50:13 +02:00
Fabien Meghazi 18068a5e79 [FIX] website.layout hreflangs
- First line is not correct due to url_for() refactoring's leftover
- href's should be full urls with domain name
- Use short language for hreflang if possible
2014-08-25 17:43:39 +02:00
Christophe Matthieu c3d2540477 [FIX] website.editor: must display link information in linkdialox box. Remove /page/ and /page/website. from the needle to search page and apply real url as filter after the search 2014-08-20 17:54:10 +02:00
Christophe Simonis b3ddbee543 [FIX] website: correct unslugify of routes 2014-08-19 16:43:23 +02:00
Denis Ledoux ae65be2b2a [MERGE] forward port of branch saas-5 up to 0739bc4 2014-08-11 15:58:02 +02:00
Denis Ledoux 7c647ec876 [MERGE] forward port of branch saas-4 up to 0a1e4a0 2014-08-08 17:27:29 +02:00
Thibault Delavallée ac212e2758 [FIX] ir_actions in website: allow to compute website_path even when creating a new server action (avoid crash then) 2014-08-08 11:43:28 +02:00
Christophe Simonis f2cb8702b2 [FIX] website: correct image resizing 2014-08-06 16:20:22 +02:00
Jeremy Kersten 05f9b45ef1 [FIX] slug: fallback to positive ID when slug appears to contain a missing negative ID
Cherry-pick from dcac4cc0df
2014-08-05 10:26:03 +02:00
Denis Ledoux 52eadd5199 [FIX] website: use SUPERUSER_ID to browse company for res_company
In a multi-company environment,
if the user signed in was not working in the company displayed by the website,
he couldn't browse the website
2014-08-04 21:08:18 +02:00
Olivier Dony dcac4cc0df [FIX] website: slug: fallback to positive ID when slug appears to contain a missing negative ID
In some rare cases database records have negative IDs,
so the slug URL could look like /foo--20. This could
be mistaken for a slug ending with a `-` and a positive ID.
The latter is not supposed to happned as final hyphens
are stripped by slugify, but has been used in the past
and may be used in old links.
2014-08-01 15:08:33 +02:00
Christophe Simonis fd4fd35e32 [MERGE] forward port of branch saas-5 up to e4cb520 2014-07-30 20:52:14 +02:00
Christophe Simonis e4cb5202a0 [MERGE] forward port of branch saas-4 up to fa07bc8 2014-07-30 20:30:14 +02:00