diff --git a/addons/hw_scale/controllers/main.py b/addons/hw_scale/controllers/main.py index 4c8e1ffd0cd..3c4aa12a1b9 100644 --- a/addons/hw_scale/controllers/main.py +++ b/addons/hw_scale/controllers/main.py @@ -59,12 +59,11 @@ class Scale(Thread): def get_device(self): try: - devices = [ device for device in listdir(self.input_dir)] - scales = [ device for device in devices if ('mettler' in device.lower()) or ('toledo' in device.lower()) ] + devices = [ device for device in listdir(self.input_dir)] + scales = [ device for device in devices if ('mettler' in device.lower()) or ('toledo' in device.lower()) ] if len(scales) > 0: print join(self.input_dir,scales[0]) self.set_status('connected','Connected to '+scales[0]) -# s = serial.Serial("/dev/serial/by-id/usb-METTLER_TOLEDO_15_kg_DI_Firmware_CKOR_F_Ser_CDC-if00",baudrate=9600,bytesize=serial.SEVENBITS,parity=serial.PARITY_EVEN) return serial.Serial(join(self.input_dir,scales[0]), baudrate = 9600, bytesize = serial.SEVENBITS, @@ -97,7 +96,7 @@ class Scale(Thread): if self.device: try: self.device.write('W') - time.sleep(0.2) + time.sleep(0.1) answer = [] while True: @@ -119,6 +118,7 @@ class Scale(Thread): self.weight_info.append('over_capacity') if stat & 1 << 2: self.weight_info.append('negative') + self.weight = 0.0 if stat & 1 << 3: self.weight_info.append('outside_zero_capture_range') if stat & 1 << 4: diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 7740020e37f..15d2dc64289 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -739,12 +739,10 @@ - + - - @@ -752,6 +750,8 @@ + + diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index 316aea50e43..2b016445638 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -394,7 +394,7 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal console.log(weight) ret.resolve(self.use_debug_weight ? self.debug_weight : weight); }, function(){ //failed to read weight - ret.resolve(self.use_debug_weight ? self.debug_weight : {weight:0.0, info:'ok'}); + ret.resolve(self.use_debug_weight ? self.debug_weight : {weight:0.0, unit:'Kg', info:'ok'}); }); return ret; }, diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 95ff7cbea7e..54aa8d115f0 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -693,7 +693,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa 'open_cashbox', 'print_receipt', 'print_pdf_invoice', - 'weighting_read_kg', + 'scale_read', 'payment_status', ], minimized: false, @@ -811,12 +811,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa self.pos.proxy.add_notification('transaction_end',function(){ self.$('.status.transaction').removeClass('on'); }); - self.pos.proxy.add_notification('weighting_start',function(){ - self.$('.status.weighting').addClass('on'); - }); - self.pos.proxy.add_notification('weighting_end',function(){ - self.$('.status.weighting').removeClass('on'); - }); }, }); @@ -876,6 +870,14 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa msg += _t('Printer'); } } + if( this.pos.config.iface_electronic_scale ){ + var scale = status.drivers.scale ? status.drivers.scale.status : false; + if( scale != 'connected' && scale != 'connecting' ){ + warning = true; + msg = msg ? msg + ' & ' : msg; + msg += _t('Scale'); + } + } msg = msg ? msg + ' ' + _t('Offline') : msg; this.set_status(warning ? 'warning' : 'connected', msg); }else{ diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 02c6374578b..34d6e729d06 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -692,7 +692,7 @@
  • Open Cashbox
  • -
  • Read Weighting Scale
  • +
  • Read Weighting Scale