Skip to content

Commit

Permalink
[FIX] Made changes to convert in new API properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay Chauhan committed Jun 24, 2015
1 parent 8046b3f commit f9f814d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 40 deletions.
55 changes: 27 additions & 28 deletions openeducat_erp/op_admission/op_admission.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,34 +102,33 @@ def confirm_in_progress(self):

@api.one
def confirm_selection(self):
for admission in self:
gr = admission.gr_no_new
if admission.gr_no == True:
gr = admission.gr_no_old
vals = {
'title': admission.title and admission.title.id or False,
'name': admission.name,
'middle_name': admission.middle_name,
'last_name': admission.last_name,
'birth_date': admission.birth_date,
'gender': admission.gender,
'category': admission.category_id and admission.category_id.id or False,
'course_id': admission.course_id and admission.course_id.id or False,
'batch_id': admission.batch_id and admission.batch_id.id or False,
'standard_id': admission.standard_id and admission.standard_id.id or False,
'religion': admission.religion_id and admission.religion_id.id or False,
'photo': admission.photo or False,
'gr_no': gr,
'title': admission.title and admission.title.id or False,
'street': admission.street or False,
'street2': admission.street2 or False,
'phone': admission.phone or False,
'mobile': admission.mobile or False,
'zip': admission.zip or False,
'city': admission.city or False,
'country_id': admission.country_id and admission.country_id.id or False,
'state_id': admission.state_id and admission.state_id.id or False,
}
gr = self.gr_no_new
if self.gr_no == True:
gr = self.gr_no_old
vals = {
'title': self.title and self.title.id or False,
'name': self.name,
'middle_name': self.middle_name,
'last_name': self.last_name,
'birth_date': self.birth_date,
'gender': self.gender,
'category': self.category_id and self.category_id.id or False,
'course_id': self.course_id and self.course_id.id or False,
'batch_id': self.batch_id and self.batch_id.id or False,
'standard_id': self.standard_id and self.standard_id.id or False,
'religion': self.religion_id and self.religion_id.id or False,
'photo': self.photo or False,
'gr_no': gr,
'title': self.title and self.title.id or False,
'street': self.street or False,
'street2': self.street2 or False,
'phone': self.phone or False,
'mobile': self.mobile or False,
'zip': self.zip or False,
'city': self.city or False,
'country_id': self.country_id and self.country_id.id or False,
'state_id': self.state_id and self.state_id.id or False,
}
self.write(
{'state': 's', 'student_id': self.env['op.student'].create(vals).id, 'nbr': 1})
return True
Expand Down
5 changes: 2 additions & 3 deletions openeducat_erp/op_allocat_division/op_allocat_division.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ class op_allocat_division(models.Model):

@api.one
def generate_division(self):
for allocation in self:
allocation.student_ids.write(
{'division_id': allocation.division_id.id})
self.student_ids.write(
{'division_id': self.division_id.id})
return True

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
16 changes: 8 additions & 8 deletions openeducat_erp/op_attendance_sheet/op_attendance_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
class op_attendance_sheet(models.Model):
_name = 'op.attendance.sheet'

@api.one
@api.depends('attendance_line.present')
def _total_present(self):
for sheet in self:
self.total_present = len(sheet.attendance_line.filtered(
lambda self: self.present))
self.total_present = len(self.attendance_line.filtered(
lambda self: self.present))

@api.one
@api.depends('attendance_line.present')
def _total_absent(self):
for sheet in self:
self.total_absent = len(sheet.attendance_line.filtered(
lambda self: self.present == False))
self.total_absent = len(self.attendance_line.filtered(
lambda self: self.present == False))

name = fields.Char('Name', size=8)
register_id = fields.Many2one(
Expand All @@ -45,9 +45,9 @@ def _total_absent(self):
attendance_line = fields.One2many(
'op.attendance.line', 'attendance_id', 'Attendance Line', required=True)
total_present = fields.Integer(
'Total Present', compute='_total_present', method=True)
'Total Present', compute='_total_present')
total_absent = fields.Integer(
'Total Absent', compute='_total_absent', method=True)
'Total Absent', compute='_total_absent')
teacher_id = fields.Many2one('op.faculty', 'Teacher')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2 changes: 1 addition & 1 deletion openeducat_erp/op_book_movement/op_book_movement.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class op_book_movement(models.Model):
_rec_name = 'book_id'

book_id = fields.Many2one('op.book', 'Book', required=True)
quantity = fields.Integer('No. Of Books', size=256, required=True)
quantity = fields.Integer('No. Of Books', required=True)
type = fields.Selection(
[('student', 'Student'), ('faculty', 'Faculty')], 'Student/Faculty', required=True)
student_id = fields.Many2one('op.student', 'Student')
Expand Down

0 comments on commit f9f814d

Please sign in to comment.