From 2908b8beff48e6415a73f1be9a44d07726cd7d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 12 Feb 2020 00:23:04 +0100 Subject: [PATCH] Do not show data in user status if unique issue8994 review256411002 --- CHANGELOG | 2 ++ res.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 304433cbcb..0f8bc6ce17 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Do not show company in user status if unique +* Show employee in user status if not unique * Add supervisor and subordinates of employee * Add employee to rule context * Add company and employee administrator group diff --git a/res.py b/res.py index ce844d8dec..1586b39ebf 100644 --- a/res.py +++ b/res.py @@ -77,10 +77,16 @@ class User(metaclass=PoolMeta): return companies def get_status_bar(self, name): + def same_company(record): + return record.company == self.company status = super(User, self).get_status_bar(name) + if (self.employee + and len(list(filter(same_company, self.employees))) > 1): + status += ' - %s' % self.employee.rec_name if self.company: - status += ' - %s [%s]' % (self.company.rec_name, - self.company.currency.name) + if len(self.companies) > 1: + status += ' - %s' % self.company.rec_name + status += ' [%s]' % self.company.currency.code return status @fields.depends('main_company')