Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3895 Widoki

In official module's source code I found some call to class constructor:

class hr_holidays_summary_employee(osv.osv_memory):
    _name = 'hr.holidays.summary.employee'
    _description = 'HR Leaves Summary Report By Employee'
    _columns = {
        'date_from': fields.date('From', required=True),
        'emp': fields.many2many('hr.employee', 'summary_emp_rel', 'sum_id', 'emp_id', 'Employee(s)'),
        'holiday_type': fields.selection([('Approved','Approved'),('Confirmed','Confirmed'),('both','Both Approved and Confirmed')], 'Select Leave Type', required=True)
    }

    _defaults = {
         'date_from': lambda *a: time.strftime('%Y-%m-01'),
         'holiday_type': 'Approved',
    }

    def print_report(self, cr, uid, ids, context=None):
        data = self.read(cr, uid, ids, [], context=context)[0]
        data['emp'] = context['active_ids']
        datas = {
             'ids': [],
             'model': 'hr.employee',
             'form': data
            }
        return {
            'type': 'ir.actions.report.xml',
            'report_name': 'holidays.summary',
            'datas': datas,
            }

hr_holidays_summary_employee()

Why use hr_holidays_summary_employee() here?

Awatar
Odrzuć
Najlepsza odpowiedź

In OpenERP versions < 6.1, the instantiation of the models was mandatory. Since the version 6.1, this is no longer necessary as the models are automatically discovered (a metaclass is used for this purpose).

That's why sometimes you will see them, that's just because they have been left from previous versions.

The presence of those calls won't cause problems, but they should be removed.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lip 25
62
0
lip 25
117
1
lip 25
238
1
lip 25
397
0
lip 25
366