I am building a simple module in Odoo 8.
I have two models (semester_no and scheme) and I want to have One2many relation from scheme to semester_no. The relation is giving me an error and I don't know the reason.*
I am using the same relation from semester_no to another model subject with the same pattern exactly and following the same steps and it's working, but in this models it isn't!
XmlHttpRequestError INTERNAL SERVER ERROR 500 Internal Server Error
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
the problem is caused when uncommenting the commented lines
This error has appeared previously with other models and suddenly disappeared without changing anything, even the relation from semester_no and subject wasn't working then suddenly it does.
I tried the same module in another machine and same error is there
class semester_no(models.Model):
_name = 'uet.semester_no'
name = fields.Char(string="Semester No.")
subjects = fields.One2many(comodel_name='uet.subject', inverse_name='semester', string="Subjects")
#scheme = fields.Many2one(comodel_name='uet.scheme')
class scheme(models.Model):
_name = 'uet.scheme'
name = fields.Char(string="Name")
#semester = fields.One2many(comodel_name='uet.semester_no', inverse_name='scheme', string="Semesters")
class subject(models.Model):
_name = 'uet.subject'
subject_name = fields.Char(string="Name", required=True)
subject_code_prefix = fields.Char(string="Code Prefix")
subject_code = fields.Integer(string="Code")
subject_type = fields.Char(string="Type", required=True)
subject_level = fields.Char(string="Level")
credit_hours = fields.Integer(string = "No. of Credit Hours", required = True)
contact_hours = fields.Integer(string="No. of Contact Hours", required = True)
pre_requisites = fields.Char(string="Pre-Requisites")
co_requisites = fields.Char(string="Co-Requisites")
semester = fields.Many2one(comodel_name="uet.semester_no", string="Semester")
program = fields.Many2one(comodel_name='uet.program', string="Program")
department = fields.Many2one(comodel_name='uet.department', string="Department")
You should try following,
class semester_no(models.Model):
_name = 'uet.semester_no'
name = fields.Char(string="Semester No.")
subjects = fields.One2many(comodel_name='uet.subject', inverse_name='semester', string="Subjects")
scheme = fields.Many2one('uet.scheme','Scheme')
class scheme(models.Model):
_name = 'uet.scheme'
name = fields.Char(string="Name")
semester = fields.One2many(comodel_name='uet.semester_no', inverse_name='scheme', string="Semesters")
You need to restart service and update your module.