[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) <trj@odoo.com>
This commit is contained in:
david
2023-03-31 14:43:40 +02:00
committed by Jacky (trj)
parent b34e647f9d
commit f64e52ee09
2 changed files with 4 additions and 9 deletions
+1 -8
View File
@@ -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() {
+3 -1
View File
@@ -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