Esempio n. 1
0
    def copy(self, cr, uid, enr_id, default=None, context=None):
        if not context:
            context = {}
        if not default:
            default = {}
        enrolment = self.browse(cr, uid, enr_id, context=context)
        class_id = resolve_id_from_context('class_id', context)
        product_id = self.onchange_class_id(
            cr, uid, None, class_id,
            context=context)['value']['tuition_fee_id']
        checklist_ids = self.onchange_checklist_id(
            cr,
            uid,
            None,
            enrolment.enrolment_checklist_id.id,
            context=context)['value']['checklist_ids']

        default.update({
            'date': time.strftime('%Y-%m-%d'),
            'state': DRAFT,
            'user_id': uid,
            'class_id': class_id,
            'tuition_fee_id': product_id,
            'invoice_id': None,
            'user_valid': None,
            'date_valid': None,
            'is_invoiced': False,
            'checklist_ids': checklist_ids,
        })
        new_id = super(school_enrolment, self).copy(cr,
                                                    uid,
                                                    enr_id,
                                                    default,
                                                    context=context)
        return new_id
Esempio n. 2
0
 def _default_teacher_id(self, cr, uid, context=None):
     return resolve_id_from_context('teacher_id', context)
Esempio n. 3
0
 def _default_level_id(self, cr, uid, context=None):
     return resolve_id_from_context('level_id', context)
Esempio n. 4
0
 def _default_year_id(self, cr, uid, context=None):
     return resolve_id_from_context('year_id', context)
Esempio n. 5
0
 def _default_student_id(self, cr, uid, context=None):
     return resolve_id_from_context('student_id', context)
Esempio n. 6
0
 def _default_partner_id(self, cr, uid, context=None):
     return tools.resolve_id_from_context('partner_id', context)
Esempio n. 7
0
 def _default_class_id(self, cr, uid, context=None):
     return tools.resolve_id_from_context('class_id', context)
Esempio n. 8
0
 def _default_employee_id(self, cr, uid, context=None):
     return resolve_id_from_context('employee_id', context)
Esempio n. 9
0
 def _default_class_id(self, cr, uid, context=None):
     if not context:
         context = {}
     return resolve_id_from_context('class_id', context)
Esempio n. 10
0
 def _default_enrolment_id(self, cr, uid, context=None):
     return resolve_id_from_context('enrolment_id', context)