コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
8853 ビュー

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.

アバター
破棄
最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
3
2月 25
3345
0
5月 24
46
1
4月 24
3251
4
9月 23
4724
2
9月 23
6940