summaryrefslogtreecommitdiff
path: root/addons/web/models/base_document_layout.py
AgeCommit message (Collapse)Author
2020-10-15[FIX] base: explicitly specify resampling filter when resizingXavier Morel
Pillow 7.0 changed the default resampling filter from NEAREST to BICUBIC. Because the logo parser resizes the image before sampling it and doesn't specify a filter, its behavior changes depending on the version of Pillow, even if the input image is the same. And there's a test depending on its output with a fixed image. Explicitly specify the old default as that's what's in the test. closes odoo/odoo#60117 X-original-commit: 3dbc0711b65ae47a230bcd8b3348962127bcaf14 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-10-08[FIX] base: do not crash if uploading a grayscale imageNicolas Galler
Behavior before the fix: Uploading a grayscale image with transparency in the company logo field of the document layout causes a crash: ``` File "/data/build/odoo/addons/web/models/base_document_layout.py", line 89, in _compute_logo_colors wizard.logo_primary_color, wizard.logo_secondary_color = wizard_for_image._parse_logo_colors() File "/data/build/odoo/addons/web/models/base_document_layout.py", line 191, in _parse_logo_colors color[1][2] > white_threshold) and color[1][3] > 0: Exception ... IndexError: tuple index out of range ``` To reproduce, use the `logo_ci.png` image included in the unit test data and load it in the document layout (under General Settings). The system does not detect that the image does not have color information and attempts to read the R,G,B values (but the image only has 2 values per pixel: the grayscale value and the alpha) Versions affected: 13, 14 Behavior after the fix: The image is loaded correctly (arguably, there is not a lot of interest in detecting the primary color of a grayscale image, but the script still returns a (gray) value which is preferrable to a traceback) opw-2352394 closes odoo/odoo#59381 X-original-commit: 9efe5608aa4fb4f66475d3cb3e15ea332a3ded38 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-09-04[IMP] base: implement commentMartin Trigaux
Forgotten TODO Instead of checking in _for_xml_id (where 99% of calls are static), verify on the few calls that accept an arbitrary argument closes odoo/odoo#56876 Related: odoo/enterprise#12844 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-09-01[IMP] base: Document layout preview improvementsSimon Genin (ges)
The document layout preview is a complete defferent simplified template with its own css that replicates at best the different styles. It does not have the external layout features and lack of fidelity. The new preview actually use the real documents templates and put the result in an iframe. It now has a high fidelity, though not perfect. The goal is for a better onboarding, where clients see easely how documents will look if they had an app to generate them. Of course, the data on the document is a false invoice. Refactor all this from base to web. Task ID 2304177 closes odoo/odoo#56415 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>