From 7377983758f22e6115f7de973b63d943a98bf76a Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Tue, 16 Dec 2014 17:04:32 +0700 Subject: [PATCH] account --- .../layouts/clinic_patient_type_form.xml | 2 +- netforce_clinic/models/patient_type.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/netforce_clinic/layouts/clinic_patient_type_form.xml b/netforce_clinic/layouts/clinic_patient_type_form.xml index 9dcfc8d..1d77f04 100644 --- a/netforce_clinic/layouts/clinic_patient_type_form.xml +++ b/netforce_clinic/layouts/clinic_patient_type_form.xml @@ -1,7 +1,7 @@
diff --git a/netforce_clinic/models/patient_type.py b/netforce_clinic/models/patient_type.py index eb57061..3fb30f4 100644 --- a/netforce_clinic/models/patient_type.py +++ b/netforce_clinic/models/patient_type.py @@ -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')