account
parent
08911331ee
commit
7377983758
|
@ -1,7 +1,7 @@
|
|||
<form model="clinic.patient.type">
|
||||
<head>
|
||||
<button string="Options" dropdown="1">
|
||||
<!--<item string="New Contact" method="new_contact"/>-->
|
||||
<item string="New Contact" method="new_contact"/>
|
||||
</button>
|
||||
</head>
|
||||
<field name="name"/>
|
||||
|
|
|
@ -8,10 +8,14 @@ class PatientType(Model):
|
|||
_fields={
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
"code": fields.Char("Code",required=True,search=True),
|
||||
'contact_id': fields.Many2One("partner","Contact",domain=[['type','=','org']],required=True,search=True),
|
||||
'contact_id': fields.Many2One("partner","Contact",domain=[['type','=','org']],search=True),
|
||||
'default': fields.Boolean("Default"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'defaults': False,
|
||||
}
|
||||
|
||||
def new_contact(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
code=obj.code or ""
|
||||
|
@ -28,6 +32,14 @@ class PatientType(Model):
|
|||
obj.write({
|
||||
'contact_id': new_contact_id,
|
||||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'contact',
|
||||
'mode': 'form',
|
||||
'active_id': new_contact_id,
|
||||
},
|
||||
'flash': 'Create contact succesfully, please config Account Fee, Medecine and Service on tab Accounting.',
|
||||
}
|
||||
|
||||
def write(self,ids,vals,**kw):
|
||||
default=vals.get('default')
|
||||
|
|
Loading…
Reference in New Issue