diff --git a/netforce_clinic/layouts/clinic_shop_form.xml b/netforce_clinic/layouts/clinic_shop_form.xml
index 41401e7..d034a84 100644
--- a/netforce_clinic/layouts/clinic_shop_form.xml
+++ b/netforce_clinic/layouts/clinic_shop_form.xml
@@ -7,18 +7,17 @@
-
-
+
+
+
-
-
@@ -28,19 +27,20 @@
+
+
+
+
+
+
-
-
-
-
-
diff --git a/netforce_clinic/models/shop.py b/netforce_clinic/models/shop.py
index 9c8688d..da845ed 100644
--- a/netforce_clinic/models/shop.py
+++ b/netforce_clinic/models/shop.py
@@ -28,6 +28,7 @@ class Shop(Model):
"ref": fields.Char("Ref",search=True),
'date': fields.Date("Date",search=True),
'patient_id': fields.Many2One('clinic.patient','Patient',search=True),
+ 'contact_id': fields.Many2One('partner','Contact',search=True),
'department_id': fields.Many2One("clinic.department","Department"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
'lines': fields.One2Many('clinic.shop.line','shop_id','Lines'),
@@ -119,6 +120,18 @@ class Shop(Model):
line=get_data_path(data,path,parent=True)
line['product_id']=None
return data
+
+ def onchange_patient(self,context={}):
+ data=context['data']
+ patient_id=data['patient_id']
+ patient=get_model("clinic.patient").browse(patient_id)
+ dpt=patient.department_id
+ branch=patient.branch_id
+ contact=patient.partner_id
+ data['department_id']=dpt.id
+ data['branch_id']=branch.id
+ data['contact_id']=contact.id
+ return data
def create(self,vals,**kw):
id=super().create(vals,**kw)
diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt
index 2bf1f7e..f70f5a7 100644
--- a/netforce_clinic/todo.txt
+++ b/netforce_clinic/todo.txt
@@ -12,7 +12,8 @@ todo:
- credit <= product -> tab -> accounting -> sale -> sale account
- debit <= 1. contact -> tab accounting -> account receiaveble , 2. finacial setting -> account receiable
- sale medicine
- - matching payment
+ -
+ - matching payment **
- patient