Commit Graph
368 Commits
Author SHA1 Message Date
Christophe Simonis b4e1be8ab0 [MERGE] forward port branch saas-11.3 up to b09f624f20 2018-11-22 20:06:48 +01:00
Christophe Simonis b09f624f20 [MERGE] forward port branch 11.0 up to 263b388c50 2018-11-22 17:52:57 +01:00
Raphael Collet 4894419b61 [FIX] cache: ormcache logger
The adaptation to Python 3 was done with two mistakes: the iteration on the lru
cache does not return keys, and functions are not sortable.

closes odoo/odoo#28870
2018-11-21 10:16:06 +00:00
Nicolas Lempereur 233bae7de9 [FIX] translate.py: fallback on base lang if noterm
When there is a language and its base language translation files in a
module, in 12.0 an empty translation in the language translation file
will not fallback on the base language.

eg.

 fr.po : {'one': 'un', 'seventy': 'soixante-dix'}
 fr_BE.po: {'one': '', 'seventy': 'septante'}

 => the translation in fr_BE will be {'one': '', 'seventy': 'septante'}

 but before 7288b477 it would have been {'one': 'un', 'seventy': 'septante'}

With this commit, an empty translation is no longer created so does not
override base language.

Also the intention of d84b795b0a that was also lost is restored by
upserting only noupdate==false translation, and inserting the other
ones.

opw-1904638
closes #28297
2018-11-07 09:07:02 +00:00
Christophe Simonis b81c2bce84 [MERGE] forward port branch saas-11.4 up to 3c108977c1 2018-10-22 16:59:51 +02:00
Martin Trigaux 933165ec3a [FIX] models: restore warning on wrong record
Was lost during d5b687a48f

Set the module name in the context to be able to detect errors in xml and csv import

closes odoo/odoo#27680
2018-10-21 08:41:22 +00:00
Christophe Simonis 1810f6be4c [FIX] core: early fail on missing foreign records
When installing/updating a module, verify existence of foreign records
before updating them.  Also handle forcecreate=False records.

Also fix misprefixed XML id in sale_quotation_builder.

closes odoo/odoo#27659
2018-10-19 11:23:47 +00:00
Christophe Simonis e9ae419fca [MERGE] forward port branch saas-11.3 up to 0de06a4132 2018-10-17 10:54:19 +02:00
Christophe Simonis 1ade6675c3 [MERGE] forward port branch 11.0 up to 717f458394 2018-10-11 16:29:46 +02:00
Christophe Simonis 717f458394 [MERGE] forward port branch saas-15 up to 93c22558f3 2018-10-11 14:48:49 +02:00
Christophe Simonis 93c22558f3 [MERGE] forward port branch saas-14 up to 77286e4296 2018-10-11 12:15:02 +02:00
Christophe Simonis 77286e4296 [MERGE] forward port branch 10.0 up to c2688e45f3 2018-10-11 10:34:48 +02:00
Sébastien Theys 80d363cd31 [FIX] tools: expand user and vars for data_dir 2018-10-10 14:03:59 +02:00
XavierDo 70e604a8fa [FIX] core: correctly read test_tags in config file
The test_tags is stored as None by default in the config file,
but 'None' is interpreted as a string when read.

This is a dirty fix in order to avoid to launch tests when using
a config file, we should do something cleaner in master and refactor
part of this code (substitute 'None' in the load method as it is
done for boolean)

closes #27498

closes odoo/odoo#27564
2018-10-09 09:19:30 +00:00
Pedro M. Baeza 1ad4d42f0b [ADD] *: replace hardcoded data URIs with helper
- Add a method for generating an image data URI, and expose it in QWeb context

- Fix reports, website templates or mail templates with data hardcoded
  data URIs, to use the helper (Python cases), or the existing
  kanban_image helper (for JS cases)

This will gracefully handle SVG support in addition to classical image
formats.

Closes #26635
2018-10-03 17:48:14 +02:00
Pedro M. Baeza 1be50fdeaf [ADD] *: support SVG images
Introduce official support for SVG files in the framework, including the
following parts:

1. When client-side SVG images are uploaded, the content is displayed until
you save using data URI scheme according RFC 2397 [1]. This scheme requires
to specify content format. Using hardcoded "image/png" works for all images
types except SVG.
Type-sniffing is done using "magic byte" detection via the first base64
encode byte, so that the proper data URI scheme can be used.
This should not cause SVG-related security problems as the file is
displayed through `<img>` tag, which does not allow SVG scripting [2].

2. Make /web/image controller compatible with SVG

3. Add support for SVG files for company logo, which uses a dedicated
controller.

4. Resizing of SVG files is a no-op, as it makes little sense for a
vector-based format. We also want to avoid micro-alterations to the SVG
document (in "natural" viewport parameters) as we would store multiple
copies of the files in the filestore.

5. Because SVG files are inherently dangerous, upload of SVG files is
restricted to administrators, either by blocking it directly before
saving it in the database (binary fields with attachment=False), or by
neutering them to text/plain mimetype (for binary fields with
attachment=True)

6. Add tests for the SVG upload cases and for the non-admin uploads.

[1] https://tools.ietf.org/html/rfc2397
[2] https://www.w3.org/wiki/SVG_Security

Closes #26635
2018-10-03 17:48:01 +02:00
Christophe Simonis 43b63a0465 [MERGE] forward port branch saas-11.4 up to 57e387b645 2018-10-01 16:01:54 +02:00
Christophe Simonis 998723b909 [MERGE] forward port branch saas-11.3 up to e980af9df0 2018-10-01 11:27:51 +02:00
Christophe Monniez 8c682544ea [FIX] config: add a config dest to test-enable option
Commit 76c5389 removed the option dest for test-enable leading to a
traceback when trying to save the configuration.
This was due to the fact that the options dict was sorted while
containing a None key because of the missing dest.
2018-09-28 16:11:22 +02:00
XavierDo 76c5389cd9 [IMP] core: enable tests when test-tags are set
The goal here is to keep the default behaviour of test-enable and test-tags
except that test-tags will set test-enable to true if set.
- +standart must stay the default test-tags if none are set
	(only usefull if test-enable is set)
- should work no matter the order of "test-tags" and "test-enable"
	options  in args
- knowing the fact that for strange reason, _parse_config is called twice

PR: #27255
2018-09-27 13:01:22 +02:00
Christophe Simonis 5f08d82bcd [MERGE] forward port branch 11.0 up to fd122aec52 2018-09-26 19:37:29 +02:00
Christophe Simonis d23601cc67 [MERGE] forward port branch saas-14 up to a119373b5b 2018-09-21 14:18:48 +02:00
Christophe Simonis a119373b5b [MERGE] forward port branch 10.0 up to cda1bec3e0 2018-09-21 10:42:19 +02:00
Martin Trigaux 2de8998863 [FIX] tools: skip bad translations
Backport of fccfd36e05, 4ba7fbbf81 and 1421949c67 to saas-11.3

[FIX] tools: use pot as reference file

In the first attempt at #26134, the pot_targets was cleared after creating
the pot_rows object.

Since the rows not present in the pot_targets are now skipped, clearing the pot
should not be done.

Still use a temporary list pot_rows to avoid modifying the list we are iterating
on.

Update the .po test file to match the new file format

[FIX] tools: import translation file without pot

Due to fccfd36 and 4ba7fbb the translations were only imported, considering the
.pot as the reference.

During import or a manual csv or po file, there is no pot file.

Add tests with Klingon and Dothraki
2018-09-20 16:21:11 +02:00
zeroheure cda1bec3e0 [DOC] cmdline: proper default for limit-memory
The default values for --limit-memory-(soft|hard) had been changed in
Odoo v8.0, but this change wasn't reflected in the cmdline --help.

Closes #22315
2018-09-19 14:47:13 +02:00
Martin Trigaux 1421949c67 [FIX] tools: import translation file without pot
Due to fccfd36 and 4ba7fbb the translations were only imported, considering the
.pot as the reference.

During import or a manual csv or po file, there is no pot file.

Add tests with Klingon and Dothraki

Fixes #27044
2018-09-18 18:02:19 +02:00
Pierre Masereel 7288b4779a [IMP] base, tools, web_edeitor: improve ir_translation insertion
The ir_translations were pretty slow to load, this was mainly caused by
the condition in variable 'find_expr' and the import of po values in the
temporary table.

To improve the load performance, we made two improvement:

1. Insert the row in the temporary table by batch instead of making an
   insertion for each record.
2. Replacing the condition in the variable 'find_expr' by partial unique
   index. To perform such a thing, we had to separate the type model in
   two types, 'model' and 'model_terms' because it wasn't possible to
   create a partial unique index on type 'model' because the type was
   used for two different use cases. The type model is now used for
   fields that have have a value not callable for the attribute
   translate, these field can only have one record for the same field,
   model, res_id and language. And the type 'model_terms' is used for
   the fields callable, because they can have multiple sources for the
   same res_id.

We also removed the deprecated types 'report', 'help', 'view', 'field'.

Thanks to @rco-odoo for the improvement of the first point.
2018-09-18 14:30:03 +02:00
Christophe Simonis 9c77066f34 [MERGE] forward port branch saas-11.4 up to 6c103589c1 2018-09-14 16:00:17 +02:00
Martin Trigaux 4ba7fbbf81 [FIX] tools: use pot as reference file
In the first attempt at #26134, the pot_targets was cleared after creating
the pot_rows object.

Since the rows not present in the pot_targets are now skipped, clearing the pot
should not be done.

Still use a temporary list pot_rows to avoid modifying the list we are iterating
on.

Update the .po test file to match the new file format

Closes #26881
2018-09-11 09:16:59 +02:00
Martin Trigaux fccfd36e05 [FIX] tools: skip bad translations
cherry-pick of 428fbd0381 that was reverted at 737ba55e1e as it was making
tests fail

The following commit will correct the tests
This commit only reverts the revert
2018-09-11 09:14:53 +02:00
Christophe Simonis 68d36512ef [MERGE] forward port branch saas-11.4 up to d78f23df84 2018-09-07 20:20:45 +02:00
Christophe Simonis 5020f41b95 Revert "[FIX] tools: skip bad translations"
This actually broke some valid use cases (catch by new translations tests)

This reverts commit 428fbd0381.
2018-09-07 17:24:10 +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 f19e6ce561 [MERGE] forward port branch 11.0 up to 213759b03e 2018-09-05 18:52:27 +02:00
Toufik Benjaa 7700bd172f [FIX] mail: Avoid using default value for track fields logging
- When a tracked field is modified, a mail.message is created.
  When create is called its tries to fill missing values with "default
values".
  It first tries to find the default values in the context, which may
occurs.
  For example, modifying a tracked field on a subtask will add a key
"default_parent_id" in the context, which is the parent_id of the project.task.
  Create will try to use "default_parent_id" for the mail.message
parent_id field, which make the SQL Request invalid.
2018-09-05 18:36:54 +02:00
ThanhDodeurOdoo fa39019ee1 [FIX] tools: image.crop_image default type fix
- the image.crop_image method doesn't defaults the format to PNG anymore.
  Instead it uses the format of the original image
  and defaults to jpeg as a last resort as the save method requires
  a type if it is called with an image object.
2018-09-05 16:33:25 +02:00
Martin Trigaux 1566c0ab3b [FIX] tools: avoid loading duplicated code translation
This commit fixes two bugs:

- a8469c45 was fixing the case where the first line was not 'code' but broke
  the usecase where a po started with code line

- Correct the usecase where a pot and po file do not have the same line of code
  by matching on res_id=0

This avoids to have a pot expecting a code message at line 42 and a translation
at line 43

Closes #26722
2018-09-03 11:02:43 +02:00
Martin Trigaux a8469c4590 [FIX] tools: handle code in po
The previous code, as explained at b505ba9e0a, was to avoid creating duplicated
code entries for the same source (as only one is considered).

In case of a po comment like
 #. openerp-web
 #: model:ir.ui.view,arch_db:base.ir_access_view_search
 #: code:addons/web/static/src/js/chrome/search_inputs.js:716
 #: code:addons/web/static/src/xml/base.xml:1125
 #, python-format

the condition was not triggered (trans_type is model), creating two code entries

Necessary in #26614 to fix #26553
2018-08-28 18:10:03 +02:00
Lucas Perais (lpe) 7768abd40b [FIX] tools:image: reset stream on crop
When cropping the image with a size, we crop it first and then we make a thumbnail out of it

Before this commit, the same byte stream was used, meaning that the thumbnail was
appended to the original

After this commit, we reset the stream

OPW 1876496
closes #26575
2018-08-27 10:31:43 +02:00
Christophe Simonis 4f62d6dd8f [MERGE] forward port branch saas-11.4 up to ef6b574eda 2018-08-22 12:02:30 +02:00
Christophe Simonis ef6b574eda [MERGE] forward port branch saas-11.3 up to 6cc7d3f945 2018-08-21 18:48:13 +02:00
Christophe Simonis 70d0148d0d [MERGE] forward port branch 11.0 up to fbfb91799e 2018-08-21 16:58:17 +02:00
Florent de Labarre c181033a6d [IMP] tools: replace SQL code
No need to construct the table name, can use the model name

Closes #25659
2018-08-20 16:58:38 +02:00
Lucas Perais (lpe) 412c471e78 [FIX] tools: sanitize allow white-space style
OPW 1870847
2018-08-17 12:58:21 +02:00
Raphael Collet 2a2ff6eb5c [FIX] tools: serialize lazy to json 2018-08-16 16:39:20 +02:00
Martin Trigaux 428fbd0381 [FIX] tools: skip bad translations 2018-08-17 01:29:54 +12:00
Stefan Rijnhart b3824aa6cb [RFR] Hide implementation of constraint definition storage, courtesy of Raphael Collet 2018-08-16 10:33:06 +02:00
Stefan Rijnhart 6327b8f97f [IMP] Store the original constraint definition as a comment on the constraint
and use it to determine if the constraint definition was changed. This prevents
endless readding of constraints that are reformatted by postgresql in an
unrecognizable way (in which e.g. "CHECK (credit*debit=0)" becomes
"CHECK ((credit * debit) = 0::numeric)")
2018-08-16 10:33:06 +02:00
Christophe Simonis 0ac7f8fbe6 [MERGE] forward port branch saas-11.4 up to dabe59df9c 2018-08-14 20:16:03 +02:00
Christophe Simonis dabe59df9c [MERGE] forward port branch saas-11.3 up to 27d8daf8a7 2018-08-14 19:43:32 +02:00