Commit Graph

190 Commits

Author SHA1 Message Date
Denis Ledoux 6f29cbe3ac [FIX] website,ir_qweb: prevent inherit_branding for assets
The attribute `data-oe-*` (`data-oe-id`, `data-oe-model`, ...)
must not be added when rendering the assets, to avoid
having different assets content,
e.g. a different content for the assets_common,
according if the user is signed in or not,
if the user can edit the website or not.

A different content for an assets according to the
users rights or the user being signed in or not means
that the assets are permanently re-written in the filestore,
which is against the point of the assets.

The content of the assets (assets_common) must not be
different from time to time, it must always be the same
(except when installing a new module, obviously).
Adding the `data-oe` attributes was pointless for the assets
anyway, and prevented having an identical content all
the time, therefore rewritting the assets all the time
in the filestore.

opw-657046
2015-11-23 17:01:03 +01:00
Xavier Morel c6d6ae8aec [FIX] qweb: handle unicode tags and attributes
closes #8895
2015-11-19 14:59:44 +01:00
Jonathan Nemry (ACSONE) 1bc2608490 [FIX] base: add missing context
Propagates context when calling method 'attributes' of ir_qweb
Closes #7582
2015-07-14 11:08:20 +02:00
Christophe Simonis 6e73a31146 [FIX] base: ir.qweb: fault tolerant save of assets.
Do not fail if an asset cannot be cached into the database.
2015-07-10 16:10:59 +02:00
Nicolas Martinelli 7feb9c112b [FIX] report,qweb: use non-beaking space between amount and currency
Fixes #6369
opw-633975
2015-05-05 08:27:04 +02:00
Nicolas Lempereur bbeca2ddb3 [FIX] web: encoding css on multi page
In the small cases where utf-8 is not escaped in the CSS of a module*, an error
could happen when breaking minified CSS on multiple page (for IE9).

For the issue #5050

*currenlty for 8.0 : https://gist.github.com/nle-odoo/e353b22f89031ced21a5
2015-04-07 11:15:40 +02:00
Nicolas Lempereur b8b8329044 Revert "[FIX] web: set_cache want unicode when caching css"
This reverts commit e75e2ce2e5.
2015-04-07 10:55:24 +02:00
Nicolas Lempereur e75e2ce2e5 [FIX] web: set_cache want unicode when caching css 2015-04-07 10:29:33 +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
Xavier Morel 603c03799d [FIX] ir.qweb: ensure attributes are generated encoded
closes #2856, closes #4182
2015-03-03 17:04:20 +01:00
Jeremy Kersten 4a698da8b3 [IMP] qweb: Allow to propagate value to variables outside the loop.
If the variable was existing outside the context of the ``foreach``,
the value is copied at the end of the foreach into the global context.

Fix #4461 - Q74531 - Q71486 - Q71675
2015-01-30 14:26:48 +01:00
Goffin Simon ae294f6222 [FIX] base: QWeb monetary field rounding
QWeb monetary widget uses the precision of the currency to know the number of
digits to display on a price. The number of digits is based on log10(rounding).
For currency with rounding different than 10^x (e.g. in Switzerland 0.05
to allow 5 cents coins only), the number of displayed digits should be rounded
up. e.g. log10(0.05) is -1.3, rounded up to 2 digits.

Fixes #3233
2014-11-28 15:00:59 +01:00
Simon Lejeune afce229e5a [FIX] ir_qweb: contact widget: use name_get instead of display_name
display_name field is overidden in res.partner in order to pop the context
key leading to show the address, and we want the address.
2014-11-05 13:37:56 +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
Jeremy Kersten fc47823ab2 [IMP] ir_qweb: remove the option 'only_date' introducted in cefc9ad8e3. Now we can use widget='date' to do the same thing. That keeps the same behaviour that in the backend.
<span t-field=model.datetime_field t-field-options="{'widget': 'date'}"/>
2014-10-10 16:20:10 +02:00
Xavier Morel 5954335222 [ADD] pyqweb-specific stuff, pyqweb APIDoc 2014-10-06 19:13:46 +02:00
Xavier Morel c5dca416da [IMP] qweb: foreach handling
* fix mapping handling to match JS impl: current value set as _value instead
  of being lost
* add handling of integer parameter
* only set _size and _last if current iterable is sized
2014-10-06 19:13:45 +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
Xavier Morel 14a677090b [ADD] running of XML cases to python qweb 2014-10-06 19:13:43 +02:00
Denis Ledoux 40c8dd9a28 [FIX] ir_qweb: search assets as superuser
A security has been introduce in eb9113c04d to restrict access to orphan attachments to employees only

Assets need to be build and accessed as superuser, thus
2014-10-02 16:36:17 +02:00
Jeremy Kersten cefc9ad8e3 [IMP] ir_qweb: allow to display a datetime like a date 2014-10-02 13:22:39 +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 11d0970721 [FIX] double html escaping in qweb 2014-09-16 21:32:37 +02:00
Fabien Meghazi 7bc7757ec3 [IMP] add `url_for` hook to bundle urls 2014-09-16 19:55:00 +02:00
Fabien Meghazi 7893645d9c [ADD] ir.qweb render_attribute() hook for postprocessing 2014-09-16 19:55:00 +02:00
Christophe Simonis 780dd9891f [MERGE] forward port of branch saas-5 up to 7eab880 2014-09-15 14:00:02 +02:00
Simon Lejeune 2266a96420 [FIX] ir_qweb: contact widget: properly pass the context when browsing the contact
As the context was not transferred, it was never translated.
2014-09-09 18:16:21 +02:00
Olivier Dony 491162e653 [FIX] ir.qweb: consider empty cached bundle as a cache miss
Sometimes a cached bundled could be missing in the
ir.attachment filestore (for example after copying
a database for test purposes without duplicating
the filestore as well).
When this happens ir.attachment will return an empty
file contents ; treat this as a cache miss.

This means empty bundles would not be cached, which
is not a big issue - there is little benefit in
caching them, and they should not be common nor
useful.
2014-09-08 16:52:42 +02:00
Xavier Morel 7558e2e786 [IMP] distribute branding on @groups instead of disabling edition
Avoids 2 rendering passes, and allows editing e.g. events detail page, which
couldn't be done (due to groups=public in a mail component)

fixes #1994
2014-09-08 11:16:06 +02:00
andreparames 0908376221 [FIX] Load translations for selection fields
Selection fields in the new QWeb reports aren't being translated, because the context with the language isn't being passed.
2014-08-28 16:41:45 +01:00
Fabien Meghazi 8402625f10 [IMP] Cache bundles in ir.attachments instead of LRU 2014-08-18 18:35:36 +02:00
Fabien Meghazi c68ba88563 Added stylesheet warning for missing css asset 2014-08-12 14:22:05 +02:00
Fabien Meghazi 228d422828 Use console.error 2014-08-12 14:14:31 +02:00
Olivier Dony d837d4b497 [IMP] ir.qweb: avoid repeatedly searching the registry for nonexistant widget models 2014-08-07 18:03:08 +02:00
Christophe Combelles b64bd885b0 [FIX] base: ir.qweb: ensure element.tail is correctly encoded
element.{text,tail} are either ascii-compatible `str`, or `unicode`
when non-ascii-compatible. This could force the implicit decoding
of utf-8 encoded contents when joining template bits, breaking
the rendering.

Fixes #1085, and related to #1130
2014-07-30 11:41:15 +02:00
Nicolas Seinlet ee67d65801 handle missing JS files with a console log 2014-07-29 12:39:51 +02:00
Xavier Morel 7a2961da76 [FIX] ensure all g_inner content is correctly encoded
fixes #1130

* provided `inner` data may or may not have been encoded
* `element.text` is either ascii-compatible `str` or `unicode` when
  non-ascii-compatible, which could force the decoding of utf8-encoded content
  during g_inner's join
2014-07-14 13:44:37 +02:00
Xavier Morel 7c540bc4ee [FIX] exception rendering with pretty printed XML
had not been migrated to lxml
2014-07-14 13:44:37 +02:00
Christophe Combelles 0050a3f797 [FIX] #1065 display_name does not display the address 2014-07-10 14:26:38 +03:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Xavier Morel ce80ad2960 [FIX] don't call render_node on comments (or PIs) 2014-07-02 18:00:03 +02:00
Xavier Morel b18d83c0e0 [IMP] convert qweb to use lxml instead of minidom
should be >20x faster at parsing document strings and gain close to 40s on crawling
2014-07-02 16:01:36 +02:00
Fabien Meghazi 54a7e9665a [IMP] join stdout and stderr in error report when sass returncode>0 2014-07-01 18:38:01 +02:00
Fabien Meghazi 0be5fb7d91 Fix sass attribute recognition 2014-07-01 15:21:36 +02:00
Fabien Meghazi 861e272823 Create and write ir.attachments with superuserid 2014-07-01 14:22:04 +02:00
Fabien Meghazi 79195f1800 Add support for the @media attribut in css bundles 2014-07-01 10:02:55 +02:00
Fabien Meghazi 7990caaf02 Fix another encoding issue 2014-06-30 19:26:14 +02:00
Fabien Meghazi 4f2b5f12fc Fix typo 2014-06-30 19:17:47 +02:00
Fabien Meghazi 45215a231d Fix indentation normalization 2014-06-30 18:41:29 +02:00
Fabien Meghazi 74e0b948fa Better error management, proper feedback on encoding errors 2014-06-30 14:45:41 +02:00