diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index f55ad23..8eddc2c 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -614,7 +614,6 @@ class HDCase(Model):
if not ship_address_id:
patient.simple_address()
#raise Exception("contact %s dont'have address with type shipping"%partner.name)
-
# default journal
cust_loc_id=None
wh_loc_id=None
@@ -627,7 +626,6 @@ class HDCase(Model):
wh_loc_id=stock_journal.location_from_id.id
cust_loc_id=stock_journal.location_to_id.id
print("get location from stock journal %s "%(stock_journal.name))
-
pick_vals={
"type": "out",
'journal_id': stock_journal.id,
@@ -661,11 +659,12 @@ class HDCase(Model):
continue
# check orginal product
prod_code=prod.code.split("-")[0]
- if len(prod_code)>1:
- prods=get_model('product').search_browse(['code','=',prod_code])
- if not prods:
- raise Exception("Can not create good issue: product code %s is not found!"%prod_code)
- prod=prods[0]
+ if patient.type_id.main_product:
+ if len(prod_code)>1:
+ prods=get_model('product').search_browse(['code','=',prod_code])
+ if not prods:
+ raise Exception("Can not create good issue: product code %s is not found!"%prod_code)
+ prod=prods[0]
if prod_ids and prod.id not in prod_ids or prod.id in prod_exist_ids:
continue
prod_exist_ids.append(prod.id)
diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py
index aee295a..97c1394 100644
--- a/netforce_clinic/models/patient.py
+++ b/netforce_clinic/models/patient.py
@@ -199,7 +199,8 @@ class Patient(Model):
return res['department_ids']
else:
return [res['department_id']]
- return get_model("clinic.department").search([])
+ dpts=get_model("clinic.department").search([])
+ return dpts
def _get_department(self,context={}):
res=get_model('select.company').get_select()
diff --git a/netforce_clinic/models/patient_type.py b/netforce_clinic/models/patient_type.py
index c8f9d2e..574e794 100644
--- a/netforce_clinic/models/patient_type.py
+++ b/netforce_clinic/models/patient_type.py
@@ -12,6 +12,7 @@ class PatientType(Model):
'contact_id': fields.Many2One("partner","Contact",domain=[['type','=','org']],search=True),
'default': fields.Boolean("Default"),
'hct_include': fields.Boolean("HCT Include"),
+ 'main_product': fields.Boolean("Use Main Product for Create GI"),
'company_id': fields.Many2One("company","Company"),
'color': fields.Char("Color"),
}