use main product to create GI

conv_bal
watcha.h 2015-03-17 14:00:11 +07:00
parent fd63be1777
commit f689ffbbd8
5 changed files with 13 additions and 10 deletions

View File

@ -60,7 +60,7 @@
<field name="who_transplantation"/>
<field name="reason_of_chronic_renal_failure"/>
</tab>
<tab string="Cycles">
<tab string="Cycle Setting">
<group span="8" columns="1">
<field name="cycles" nolabel="1">
<list>

View File

@ -13,8 +13,10 @@
<field name="company_id" invisible="1"/>
</tab>
<tab string="Other">
<field name="color"/>
<field name="hct_include"/>
<field name="main_product"/>
<field name="color"/>
<newline/>
<group span="6" columns="1">
<template>
<div>

View File

@ -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)

View File

@ -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()

View File

@ -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"),
}