Browse Source

JS fixes

pull/70/head
Antonio Espinosa 9 years ago
committed by Sylvain LE GAL
parent
commit
7d7b28bed5
  1. 7
      pos_ticket_logo/static/src/js/main.js

7
pos_ticket_logo/static/src/js/main.js

@ -25,7 +25,7 @@
*/ */
// Check jQuery available // Check jQuery available
if (typeof jQuery === 'undefined') { throw new Error('POS Ticket Logo Addon requires jQuery') }
if (typeof jQuery === 'undefined') { throw new Error('POS Ticket Logo Addon requires jQuery'); }
+function ($) { +function ($) {
'use strict'; 'use strict';
@ -35,10 +35,11 @@ if (typeof jQuery === 'undefined') { throw new Error('POS Ticket Logo Addon requ
_lt = instance.web._lt; _lt = instance.web._lt;
var QWeb = instance.web.qweb; var QWeb = instance.web.qweb;
var PosModelParent = instance.point_of_sale.PosModel;
instance.point_of_sale.PosModel = instance.point_of_sale.PosModel.extend({ instance.point_of_sale.PosModel = instance.point_of_sale.PosModel.extend({
load_server_data: function(){ load_server_data: function(){
var self = this; var self = this;
var loaded = instance.point_of_sale.PosModel.__super__.load_server_data.apply(this, arguments);
var loaded = PosModelParent.prototype.load_server_data.apply(this, arguments);
$.when(loaded).then(function(){ $.when(loaded).then(function(){
self.company_logo.onload = function(){ self.company_logo.onload = function(){
var img = self.company_logo; var img = self.company_logo;
@ -55,7 +56,7 @@ if (typeof jQuery === 'undefined') { throw new Error('POS Ticket Logo Addon requ
var height = Math.floor(img.height * ratio); var height = Math.floor(img.height * ratio);
var c = document.createElement('canvas'); var c = document.createElement('canvas');
c.width = width; c.width = width;
c.height = height
c.height = height;
var ctx = c.getContext('2d'); var ctx = c.getContext('2d');
ctx.drawImage(self.company_logo,0,0, width, height); ctx.drawImage(self.company_logo,0,0, width, height);

Loading…
Cancel
Save