Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3568 Visualizzazioni

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
Abbandona

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!

Autore

Thank you Dipak Shah.It works

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

Post correlati Risposte Visualizzazioni Attività
1
mag 19
2898
2
lug 24
2595
1
giu 24
5058
1
ott 23
10729
1
ott 23
98