[FIX] *: used-before-assignment pylint warnings
Warnings show up when using a recent pylint. It's only a fraction of what e.g. pycharm flags as "local variable might be referenced before assignment" but seems a good idea to fix anyway in prevision of possibly eventually updating the reference pylint. closes odoo/odoo#107968 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
@@ -22,6 +22,7 @@ class AccountReconcileModelPartnerMapping(models.Model):
|
||||
for record in self:
|
||||
if not (record.narration_regex or record.payment_ref_regex):
|
||||
raise ValidationError(_("Please set at least one of the match texts to create a partner mapping."))
|
||||
current_regex = None
|
||||
try:
|
||||
if record.payment_ref_regex:
|
||||
current_regex = record.payment_ref_regex
|
||||
|
||||
@@ -148,10 +148,9 @@ class EscposDriver(Thread):
|
||||
_logger.error('ESC/POS cannot initialize, please verify system dependencies.')
|
||||
return
|
||||
while True:
|
||||
error = True
|
||||
timestamp, task, data = self.queue.get(True)
|
||||
try:
|
||||
error = True
|
||||
timestamp, task, data = self.queue.get(True)
|
||||
|
||||
printer = self.get_escpos_printer()
|
||||
|
||||
if printer == None:
|
||||
|
||||
@@ -152,6 +152,7 @@ odoo_mailgate: "|/path/to/odoo-mailgate.py --host=localhost -u %(uid)d -p PASSWO
|
||||
|
||||
def button_confirm_login(self):
|
||||
for server in self:
|
||||
connection = None
|
||||
try:
|
||||
connection = server.connect(allow_archived=True)
|
||||
server.write({'state': 'done'})
|
||||
|
||||
@@ -301,8 +301,8 @@ class PosSession(models.Model):
|
||||
else:
|
||||
raise e
|
||||
|
||||
balance = sum(self.move_id.line_ids.mapped('balance'))
|
||||
try:
|
||||
balance = sum(self.move_id.line_ids.mapped('balance'))
|
||||
with self.move_id._check_balanced({'records': self.move_id.sudo()}):
|
||||
pass
|
||||
except UserError:
|
||||
|
||||
@@ -662,6 +662,7 @@ class TestQWebNS(TransactionCase):
|
||||
"""
|
||||
})
|
||||
|
||||
error_msg = None
|
||||
try:
|
||||
"" + 0
|
||||
except TypeError as e:
|
||||
|
||||
@@ -1264,12 +1264,14 @@ class ChromeBrowser:
|
||||
delay = 0.1
|
||||
tries = 0
|
||||
failure_info = None
|
||||
message = None
|
||||
while timeout > 0:
|
||||
try:
|
||||
os.kill(self.chrome_pid, 0)
|
||||
except ProcessLookupError:
|
||||
message = 'Chrome crashed at startup'
|
||||
break
|
||||
res = None
|
||||
try:
|
||||
r = requests.get(url, timeout=3)
|
||||
if r.ok:
|
||||
|
||||
Reference in New Issue
Block a user