This question has been flagged
2691 Views

Hi,

I need some changes in hr.holidays folder,that is there is model in hr_holidays,named hr.holidays there have a function

@api.multi
def name_get(self):
if not self._context.get('employee_id'):
# leave counts is based on employee_id, would be inaccurate if not based on correct employee
return super(HolidaysType, self).name_get()
res = []
for record in self:
name = record.name
if not record.limit:
name = "%(name)s (%(count)s)" % {
'name': name,
'count': _('%g remaining out of %g') % (record.virtual_remaining_leaves or 0.0, record.max_leaves or 0.0)
}
res.append((record.id, name))
return res

here I inherited this model for leave management,What I want is,I don't need
"('%g remaining out of %g')" this in my leave balance view.How can I hide this in my model??

Please help.

Thanks in advance
Avatar
Discard

Hello VENI V R,

> As you inherited that holiday model in your module is right.

> Next you have to overwrite that method only. (means simple write again that method in your file , just remove the code that you not need).

E.g :

@api.multi

def name_get(self):

if not self._context.get('employee_id'):

# leave counts is based on employee_id, would be inaccurate if not based on correct employee

return super(HolidaysType, self).name_get()

res = []

for record in self:

name = record.name

if not record.limit:

name = "%(name)s (%(count)s)" % {

'name': name,

0.0)

}

res.append((record.id, name))

return res

Thanks!

Author

Thank you Dipak Shah.It works

Check odoo customization tips: https://www.scoop.it/t/learn-openerp