Commit 75fc29bd authored by Florent Viard's avatar Florent Viard Committed by Vincent A

[bp] Lowercase comparison of account holder name to determine ownership

My accounts had the ownership incorrectly reported as "Attorney" instead
of "Owner".
The root cause is that the name fields in the profile page are all in
uppercase but in the account name they are capitalized.
parent 57a9b600
......@@ -103,14 +103,14 @@ def obj_label(self):
return CleanText('.//div[@class="title"]/h3')(self).upper()
def obj_ownership(self):
account_holder = CleanText('.//div[@class="title"]/span')(self)
account_holder = CleanText('.//div[@class="title"]/span')(self).lower()
pattern = re.compile(
r'(m|mr|me|mme|mlle|mle|ml)\.? (.*)\bou ?(m|mr|me|mme|mlle|mle|ml)?\b(.*)',
re.IGNORECASE
)
if pattern.search(account_holder):
return AccountOwnership.CO_OWNER
elif all(n in account_holder for n in self.env['name'].split(' ')):
elif all(n in account_holder for n in self.env['name'].lower().split(' ')):
return AccountOwnership.OWNER
else:
return AccountOwnership.ATTORNEY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment