Browse Source

[FIX] Pylint on hw_customer_display and hw_telium_payment_terminal and flake8 on pos_remove_pos_category

pull/147/head
Carlos Vásquez 8 years ago
parent
commit
ea0e875961
  1. 11
      hw_customer_display/test-scripts/customer-display-test.py
  2. 9
      hw_telium_payment_terminal/controllers/main.py
  3. 10
      pos_remove_pos_category/module.py

11
hw_customer_display/test-scripts/customer-display-test.py

@ -6,9 +6,16 @@
# with the customer display independantly from the Odoo server # with the customer display independantly from the Odoo server
# It has been tested with a Bixolon BCD-1100 # It has been tested with a Bixolon BCD-1100
from serial import Serial
from unidecode import unidecode
import sys import sys
import logging
_logger = logging.getLogger(__name__)
try:
from serial import Serial
from unidecode import unidecode
except (ImportError, IOError) as err:
_logger.debug(err)
DEVICE = '/dev/ttyUSB0' DEVICE = '/dev/ttyUSB0'
DEVICE_RATE = 9600 DEVICE_RATE = 9600

9
hw_telium_payment_terminal/controllers/main.py

@ -27,15 +27,18 @@ import time
import curses.ascii import curses.ascii
from threading import Thread, Lock from threading import Thread, Lock
from Queue import Queue from Queue import Queue
from serial import Serial
import pycountry
import openerp.addons.hw_proxy.controllers.main as hw_proxy import openerp.addons.hw_proxy.controllers.main as hw_proxy
from openerp import http from openerp import http
from openerp.tools.config import config from openerp.tools.config import config
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
try:
import pycountry
from serial import Serial
except (ImportError, IOError) as err:
logger.debug(err)
class TeliumPaymentTerminalDriver(Thread): class TeliumPaymentTerminalDriver(Thread):
def __init__(self): def __init__(self):

10
pos_remove_pos_category/module.py

@ -19,7 +19,7 @@
# #
############################################################################## ##############################################################################
from openerp import models
from openerp import models, api
class Module(models.Model): class Module(models.Model):
@ -34,16 +34,16 @@ class Module(models.Model):
# As we have loose previous POS categs restore them # As we have loose previous POS categs restore them
# in a sane empty state # in a sane empty state
cr.execute('UPDATE product_template SET pos_categ_id=NULL')
self.env.cr.execute('UPDATE product_template SET pos_categ_id=NULL')
# And restore original constraint # And restore original constraint
cr.execute('''
self.env.cr.execute('''
ALTER TABLE product_template ALTER TABLE product_template
DROP CONSTRAINT IF EXISTS DROP CONSTRAINT IF EXISTS
product_template_pos_categ_id_fkey product_template_pos_categ_id_fkey
''') ''')
cr.execute('''
self.env.cr.execute('''
ALTER TABLE product_template ADD CONSTRAINT ALTER TABLE product_template ADD CONSTRAINT
"product_template_pos_categ_id_fkey" "product_template_pos_categ_id_fkey"
FOREIGN KEY (pos_categ_id) FOREIGN KEY (pos_categ_id)
@ -52,7 +52,7 @@ class Module(models.Model):
# Restore POS category menu action # Restore POS category menu action
# in SQL because pool/env is not available here # in SQL because pool/env is not available here
cr.execute('''
self.env.cr.execute('''
UPDATE ir_act_window iaw SET res_model='pos.category' UPDATE ir_act_window iaw SET res_model='pos.category'
FROM ir_model_data imd FROM ir_model_data imd
WHERE WHERE

Loading…
Cancel
Save