Hi,
I have these models :
*****************************************
class MgCourse(models.Model):
_name = 'ts.course'
_description = 'Course'
name = fields.Char('Course Name', size=128, required=True)
desc = fields.Text('Course Description')
batches = fields.One2many('ts.course.batch', 'batch_course_id',
'batches for this course (test)', String='Batches')
*****************************************
class MgBatch(models.Model):
_name = 'ts.course.batch'
_description = 'Batch'
name = fields.Char('Batch Name', size=128, required=True)
batch_course_id = fields.Many2one('ts.course', 'Course', ondelete="cascade")
*****************************************
I created a form for Course model where the "batches" field is shown in tree view. By clicking at "create new item" there, I get a form of batch model.
The problem is that the form (the batch form) contains the field "batch_course_id".
In this batch form:
1- I dont want that the field batch_course_id be displayed because we already know the corresponding course of this batch. 2- The value of batch_course_id in this form should automatically be the id of the original Course from where we opened the form.
Please, is there any way to make the new batch (created from the course form) implicitly point to the original course ?
I don't want to remove the field batch_course_id from ts.batch because I need it in the batch form view.
Thank for any piece of answer.