Hi,
I have created a function to be called by multiple class within the same file(.py)
But How?
The following is my file.py
------------------------
def holiday(lookup_date):
# check holidays
hday_credit_rate = 0
*****Error below calling the table outside the class******
holidays = env['hr.company.holidays'].sudo().search([('date', '=', lookup_date)])
if holidays:
holiday_rate = env['hr.holiday.rate'].sudo().search([('id', '=', holidays.holiday_rate_id.id)])
hday_credit_rate = holidays.credited_rate
return hday_credit_rateclass dtr(models.Model):
_name = 'hr.dtr'
_inherit = ['mail.thread', 'mail.activity.mixin']
_description = "Daily Time Record"
employee_id = fields.Many2one('hr.employee', string='Employee', required=True)
********start to call the table outside the class
holiday_credit = holiday('2020/07/03')