dlz & hd case

conv_bal
watcha.h 2014-10-26 09:23:27 +07:00
parent d328ee0a81
commit c6e7131b27
2 changed files with 12 additions and 8 deletions

View File

@ -52,14 +52,14 @@ class Dialyzer(Model):
def _get_product(self,context={}): def _get_product(self,context={}):
categ_ids=get_model("product.categ").search([['name','=','Dialyzer']]) categ_ids=get_model("product.categ").search([['name','=','Dialyzer']])
product_id=None product_id=None
stop=False found=False
for prod in get_model("product").search_browse([]): for prod in get_model("product").search_browse([]):
if stop: if found:
break break
for categ in prod.categs: for categ in prod.categs:
if categ.id in categ_ids: if categ.id in categ_ids:
product_id=prod.id product_id=prod.id
stop=True found=True
break break
return product_id return product_id

View File

@ -127,7 +127,7 @@ class HDCase(Model):
}) })
raise Exception("%s is expired"%dialyzer.number) raise Exception("%s is expired"%dialyzer.number)
use_time+=1 use_time+=1
line["description"]=dialyzer.description or "" line["description"]=dialyzer.description or dialyzer.product_id.name or ""
line["use_time"]=use_time line["use_time"]=use_time
line["max_use_time"]=dialyzer.max_use_time line["max_use_time"]=dialyzer.max_use_time
line["member_type"]=dialyzer.member_type line["member_type"]=dialyzer.member_type
@ -623,9 +623,13 @@ class HDCase(Model):
def new_dialyzer(self,ids,context={}): def new_dialyzer(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
dlz_id=get_model('clinic.dialyzer').create({ dlz_vals=get_model("clinic.dialyzer").default_get()
'patient_id': obj.patient_id.id, dlz_vals['patient_id']=obj.patient_id.id
}) dlz_vals['company_id']=dlz_vals['company_id'][0]
product_name=dlz_vals['product_id'][1]
dlz_vals['product_id']=dlz_vals['product_id'][0]
dlz_id=get_model('clinic.dialyzer').create(dlz_vals)
dialyzer=get_model("clinic.dialyzer").browse(dlz_id) dialyzer=get_model("clinic.dialyzer").browse(dlz_id)
dialyzer.confirm() dialyzer.confirm()
vals={ vals={
@ -634,7 +638,7 @@ class HDCase(Model):
} }
vals['dialyzers'].append(('create',{ vals['dialyzers'].append(('create',{
'dialyzer_id': dlz_id, 'dialyzer_id': dlz_id,
'description': dialyzer.description or "", 'description': dialyzer.description or product_name,
'use_time': 1, 'use_time': 1,
'max_use_time': dialyzer.max_use_time, 'max_use_time': dialyzer.max_use_time,
'member_type': dialyzer.member_type, 'member_type': dialyzer.member_type,