Commit Graph
29 Commits
Author SHA1 Message Date
Christophe Matthieu ae5f853819 [IMP] qweb: remove values from record_to_html to avoid crappy code 2016-07-05 18:43:09 +02:00
Simon Lejeune 5c54571f4e [FIX] web_editor: remove the editable key if no write on the model
The `check_access_rule` call allow to remove the `editable` key from the
rendering context (which will lead to the display of the editor bar) if
an access rule prevents the edition of the ir.ui.view record. Also remove
it in case the user has no write access on the model (i.e. demo user).
2016-07-05 17:44:56 +02:00
Christophe Matthieu 08eb9384d2 [IMP] qweb: use iterator to compile directives in order 2016-06-14 13:12:17 +02:00
Christophe Matthieu 1583194845 [IMP] qweb: typo: remove qwebcontext and use values 2016-06-14 13:12:15 +02:00
Christophe Matthieu b3302398bc [IMP] ir.qweb: extract and create independent qweb class from ir.qweb
The goal is to make the code more readable, more easily be optimized, allowing to share the library "QWEB" (python and js) separately Odoo.
2016-06-14 13:12:14 +02:00
Christophe Matthieu 7ede9bcb2d [IMP] base ir.qweb: compile template (and use ast) to improve rendering speed
* The compiled templates are cached per user, lang, inherit context values
* ir.ui.fields: attributes method return an dict, and record_to_html return only the content value of the field
* all rendered text use build_text and all attributes use build_attribute
* t-esc-options is removed and replace by format_value method
* AssetsBundle receive the list files and remains
2016-06-14 09:46:25 +02:00
Christophe Simonis e641d740d7 [MERGE] forward port of branch saas-10 up to fac4cc7 2016-05-24 14:08:42 +02:00
Christophe Simonis fac4cc7006 [MERGE] forward port of branch saas-9 up to f8e6bb7 2016-05-24 13:19:19 +02:00
Martin Trigaux 216d328a11 [FIX] web_editor: serialise translations of html_translate fields
The html_translate fields (e.g. website_descripton on product.product) were not
serialised and the raw value from the web_editor was saved as a translation.

This was an issue in case of special characters that may be present in the
translation. A translation containing non-breaking space was sent in html
(`foo bar`) while lxml converts such characters to unicode (`foo\xa0bar`).

When writing a translation, the value is checked against incorrect format using
```
value0 = field.translate(lambda term: None, record[fname])
value1 = field.translate({trans.src: trans.value}.get, value0)
value2 = field.translate({trans.value: trans.src}.get, value1)
if value2 != value0:
    raise ValidationError(_("Translation is not valid:\n%s") % trans.value)
```

As value1 is the unicode version of the translation and `trans.value` is the
html version of the translation, the last substitution in the callback method
was never made and the ValidationError was raised.

This commit forces the serialisation through lxml to be sure the compared
strings are using the same parser instead of comparing value from summernote and
lxml that may be both valid but still different.

opw-675767
2016-05-18 15:01:29 +02:00
Christophe Simonis 2dcbdd0778 [MERGE] forward port of branch saas-10 up to bb8f0f1 2016-04-25 15:48:31 +02:00
Christophe Simonis bb8f0f1fc3 [MERGE] forward port of branch saas-9 up to 4d337f7 2016-04-25 14:43:44 +02:00
Raphael Collet 9fba75bd54 [FIX] web_editor: save translation values as HTML or XML fragment
The translation value is given as an HTML fragment.  It is converted to a valid
XML fragment if the translation's field requires it.
2016-04-21 16:14:34 +02:00
Christophe Simonis 7c04420802 [MERGE] forward port of branch saas-6 up to 7033a97 2016-04-19 12:48:58 +02:00
Raphael Collet 4ddc323139 [FIX] base: fix and complete migration of base/ir
- add or fix decorators on methods
- fix most compute methods (wrong dependencies)
- revert changes in `eval_context` of `ir.actions`
- various code simplifications and improvements
- migrate methods that were not
- ir_qweb: modify `QWebContext` to take an environment instead of `cr`, `uid`, `context`
- ir_qweb: convert `AssetsBundle` to use new API `env`
- ir_ui_view: use decorator `multi` on method `read_combined`
- ir_ui_view: ensure that method `render` is never called with an xml_id
- ir_ui_view: factor out part of the `ormcache` key of method `_read_template`
2016-03-21 13:46:44 +01:00
Raphael Collet bcfff7cea5 [FIX] web_editor: simplify inheritance specs 2016-02-04 15:52:05 +01:00
Nicolas Lempereur b24d759036 [FIX] web_editor,base: transmit translation model
There is a logic on the front-end to escape translated text content when
saving them as ir.translation record.

This logic was in part base on html elements and if these element were
not coming from an html field other than "ir.ui.view" arch_db's field.

This logic was introduced in 8.0, and something similar was later
introduced in 9.0 with f5acea7, but in this instance, the information
[data-oe-model] on nodes was not available. Thus some html field from
other model than ui.ui.view would have their translation escaped
erroneously.

This commit adds a data-oe-model attribute on to-be-translated nodes
which will then be available to the frontend.

closes #10420

first-part-of: opw-659772
2016-01-12 15:14:07 +01:00
Christophe Matthieu 5257721bef [FIX] web_editor: translation feature for all string fields on website
* add the branding in translation mode
* change javascript to add the lang in the context (automatically removed in the rte => allow to create record and edit when use an other default language of en_US)
* avoid double saved
2015-12-10 09:10:29 +01:00
Christophe Matthieu 8c9cf9eb38 [FIX] web_editor: can upload a product image with the editor and save it (without 'out of range error' because new web controller /web/image/). 2015-09-28 15:23:35 +02:00
Leonardo Rochael Almeida 60af7cac02 [IMP] replace simplejson with stdlib json
The stdlib version of the json library is more recent than the 3.5.3
version we are pinning in `requirements.txt`

There is no reason to use it.

Closes #6940
2015-09-28 10:53:32 +02:00
Christophe Matthieu b9d9e44582 [FIX] web_editor: use parser from dateutil for datatime qweb field value 2015-09-25 16:06:21 +02:00
Christophe Simonis 2f28daa26c [FIX] web_editor: do not escape saved html.
Forward-port of 8c77c711ee.
This change has been forgot during last forward-port
(edeceba7df)
2015-08-28 17:39:23 +02:00
Christophe Simonis edeceba7df [MERGE] forward port of branch saas-6 up to 7a768a4
Due to `sale` rewrite (94716a3f14),
the commit 503820acb6 has been partially
ignored (in sale.order.line) and will be rewritten later using new-api.
2015-08-28 15:07:16 +02:00
Christophe Matthieu d4bae06d08 [IMP] web: use css to display attachment mimetype
Widgets and website display images or display the type with icon like pdf, doc...
2015-08-21 22:06:52 +02:00
Christophe Matthieu 6baf611df1 [IMP] web: create generic controller '/web/content' and '/web/image'
Replace deprecate controllers like /web/binary/image, /web/binary/saveas...
Use ETag for all content with 'unique' option to cache the content if the content is never changed.
2015-08-21 22:06:52 +02:00
Christophe Simonis 73e652818b [MERGE] forward port of branch saas-6 up to 8d95f6d 2015-08-15 16:57:35 +02:00
Ajay Patel 544be8b873 [IMP]qweb:solve t-field integer issue while render on frontend. 2015-08-05 14:07:53 +02:00
Christophe Matthieu ae7776620f [FIX] web_editor: add cr_uid_ids_context decorator for ir.ui.view render method to have the select the api 2015-07-13 16:22:29 +02:00
Raphael Collet 578dba5613 [IMP] ir_translation: move web_editor translation logic to module web_editor 2015-07-10 17:00:11 +02:00
Christophe Matthieu 8c559044a5 [IMP] web_editor: split website into web_editor (to use editor in backend for html field) and website 2015-07-10 17:00:11 +02:00