Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
8817 Tampilan

Hi,

I have 3 models ; I want to use context to get default values when passing from view to other . How can I do that ? Any help please ?

When creating patient , I will choose or create an appointment. I would to get value "patient_id"  of the model 'hospital.rdv' by default .

Also I have a button action to create an operation from 'hospital.patient' model, so , fields 'date' , 'patient_name ' must be by default.


class Hospital(models.Model):
     _name = 'hospital.patient'
    patient_id = fields.Many2one(hospital.rdv)


class Rendez-vous(models.Model):
     _name = 'hospital.rdv'
    hospital_rdv_id = fields.Many2one(training.patient_id)
    Date = fields.Date(string="Date")
    patient_name = fields.Char(string="Name")


class Operation(models.Model):
    _name = 'hospital.operation'
    patient_id = fields.Many2one(hospital.rdv)
    Date = fields.Date(string="Date")
    patient_name = fields.Char(string="Name")



Thanks.

Avatar
Buang
Jawaban Terbai

Check below link  3rd points context pass in manytoone fields.

https://www.cybrosys.com/blog/how-to-use-context-and-domain-in-odoo-13

Check below context pass in parent to child table one2many fields, hope it also work in version 13.

https://www.surekhatech.com/blog/working-with-context-and-domain-in-odoo-v9

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
3
Feb 25
3232
0
Mei 24
46
1
Apr 24
3194
4
Sep 23
4662
2
Sep 23
6891