Skip to content

Commit

Permalink
Update weladee_employee.py
Browse files Browse the repository at this point in the history
From: "changlianxi" <notifications@github.com>
To: "Frontware/Weladee-odoo" <Weladee-odoo@noreply.github.com>
Sent: Wednesday, 31 October, 2018 11:57:14
Subject: Re: [Frontware/Weladee-odoo] Fix 'Do not use `len(SEQUENCE)` to determine if a sequence is empty' issue in Modules\odoo11\Weladee_Attendances\models\weladee_employee.py (#4)

if len(WeladeeData.employee.Phones) == 0:
Maybe it can be modified to

if not WeladeeData.employee.Phones:

See more details: https://stackoverflow.com/questions/43121340/why-is-the-use-of-lensequence-in-condition-values-considered-incorrect-by-pyli
  • Loading branch information
efairon committed Oct 31, 2018
1 parent 28d34a6 commit 3f6aa6a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def _create_in_weladee(self, employee_odoo, vals):
WeladeeData.employee.photo = vals["image"]

if "work_phone" in vals:
if len(WeladeeData.employee.Phones) == 0:
if not WeladeeData.employee.Phones:
WeladeeData.employee.Phones[:] = [vals['work_phone'] or '']
else:
WeladeeData.employee.Phones[0] = vals['work_phone'] or ''
Expand Down

0 comments on commit 3f6aa6a

Please sign in to comment.