load product setting
parent
b1c9344dc6
commit
03341f26ac
|
@ -207,6 +207,14 @@ class HDCase(Model):
|
||||||
#XXX get nurse team
|
#XXX get nurse team
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def empty_line(self,lines=[]):
|
||||||
|
empty=True
|
||||||
|
for line in lines:
|
||||||
|
if line:
|
||||||
|
empty=False
|
||||||
|
break
|
||||||
|
return empty
|
||||||
|
|
||||||
def onchange_patient(self,context={}):
|
def onchange_patient(self,context={}):
|
||||||
data=context['data']
|
data=context['data']
|
||||||
patient_id=data['patient_id']
|
patient_id=data['patient_id']
|
||||||
|
@ -237,6 +245,22 @@ class HDCase(Model):
|
||||||
'type': 'doctor',
|
'type': 'doctor',
|
||||||
'priop': 'owner',
|
'priop': 'owner',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if data['patient_type_id']:
|
||||||
|
st=get_model("clinic.setting").browse(1)
|
||||||
|
data['lines']=[]
|
||||||
|
for pline in st.products:
|
||||||
|
if data['patient_type_id']==pline.patient_type_id.id:
|
||||||
|
data['lines'].append({
|
||||||
|
'product_categ_id': pline.product_categ_id.id,
|
||||||
|
'product_id': pline.product_id.id,
|
||||||
|
'description': pline.description or "",
|
||||||
|
'uom_id': pline.uom_id.id,
|
||||||
|
'qty': pline.qty or 0,
|
||||||
|
'price': pline.price or 0,
|
||||||
|
'amount': pline.amount or 0,
|
||||||
|
})
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def onchange_line(self,context={}):
|
def onchange_line(self,context={}):
|
||||||
|
@ -337,6 +361,12 @@ class HDCase(Model):
|
||||||
|
|
||||||
patient=obj.patient_id
|
patient=obj.patient_id
|
||||||
ptype=patient.type_id
|
ptype=patient.type_id
|
||||||
|
#XXX
|
||||||
|
shop_type=st.shop_type_id
|
||||||
|
if not shop_type:
|
||||||
|
raise Exception("No Patient Type -> Clinic Settings-> RD Shop -> Patient Type")
|
||||||
|
ptype=shop_type
|
||||||
|
|
||||||
prod_acc=st.get_product_account
|
prod_acc=st.get_product_account
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
if line.reimbursable=='no':
|
if line.reimbursable=='no':
|
||||||
|
@ -433,10 +463,13 @@ class HDCase(Model):
|
||||||
if line.reimbursable=='yes':
|
if line.reimbursable=='yes':
|
||||||
acc=prod_acc(prod.id,obj.patient_type_id.id)
|
acc=prod_acc(prod.id,obj.patient_type_id.id)
|
||||||
else:
|
else:
|
||||||
|
stype=cst.shop_type_id # Pay them self
|
||||||
|
if not stype:
|
||||||
|
raise Exception("No Patient Type : Clinic Setting -> RD Shop")
|
||||||
if is_credit:
|
if is_credit:
|
||||||
acc=prod_acc(prod.id,obj.patient_type_id.id,'credit')
|
acc=prod_acc(prod.id,stype.id,'credit')
|
||||||
else:
|
else:
|
||||||
acc=prod_acc(prod.id,obj.patient_type_id.id,'cash')
|
acc=prod_acc(prod.id,stype.id,'cash')
|
||||||
account_id=acc.get("ar_credit_id",None)
|
account_id=acc.get("ar_credit_id",None)
|
||||||
ar_debit_id=acc.get("ar_debit_id",None)
|
ar_debit_id=acc.get("ar_debit_id",None)
|
||||||
if not account_id:
|
if not account_id:
|
||||||
|
|
Loading…
Reference in New Issue