Basically I have a model for hospital appointments, inside that model I have a many-to-one field to another model for patients. What I want is to make that every time I use the "Create and Edit" option in my appointments model to create a record in the patient model this record gets automatically set with state equal to validated (contrary to draft, that is originally set as default), but when I create a patient record from the patient model it saves the record normally, with draft as default
You can use context in xml with field definition for example:
<field name="partner_id" widget="res_partner_many2one" context="{'search_default_supplier':1, 'default_supplier':1, 'default_customer':0, 'show_vat': True}" domain="[('supplier','=',True)]" placeholder="Name, TIN, Email, or Reference" />
Hope this'll help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.