From f64e52ee09f892312ad437ac67d8a9c6b9cd3e45 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 5 Apr 2021 15:08:07 +0000 Subject: [PATCH] [FIX] point_of_sale: blurred company logo on ticket The `/web/binary/company_logo` controller returns an image with a maximum of 180px wide, while the point of sale data loader tries to resize such image to 300px wide. The result is an image with blurry edges. A better option is to use the standard `/web/image` controller that recovers the original image from the proper attachment. This is a tiny overhead since it's done just once when session is loaded. closes odoo/odoo#117326 X-original-commit: 49ec373d6269febb66eaace8e71b812798ca11c7 Signed-off-by: Trinh Jacky (trj) --- addons/point_of_sale/static/src/js/models.js | 9 +-------- addons/point_of_sale/tests/test_js.py | 4 +++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index fb2ffe1ad01..d45ea19f59f 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -335,14 +335,7 @@ export class PosGlobalState extends PosModel { reject(); }; this.company_logo.crossOrigin = "anonymous"; - this.company_logo.src = - "/web/binary/company_logo" + - "?dbname=" + - this.env.session.db + - "&company=" + - this.company.id + - "&_" + - Math.random(); + this.company_logo.src = `/web/image?model=res.company&id=${this.company.id}&field=logo`; }); } prepare_new_partners_domain() { diff --git a/addons/point_of_sale/tests/test_js.py b/addons/point_of_sale/tests/test_js.py index bc80356c1f5..010f72db0c4 100644 --- a/addons/point_of_sale/tests/test_js.py +++ b/addons/point_of_sale/tests/test_js.py @@ -9,7 +9,9 @@ class WebSuite(HttpCase): def setUp(self): super().setUp() env = self.env(user=self.env.ref('base.user_admin')) - self.main_pos_config = env.ref('point_of_sale.pos_config_main') + self.main_pos_config = self.main_pos_config = env['pos.config'].create({ + 'name': 'Shop', + }) def test_pos_js(self): # open a session, the /pos/ui controller will redirect to it