dlz
parent
0af24d9bd1
commit
171f09fbb3
|
@ -29,7 +29,7 @@ class Dialyzer(Model):
|
|||
"visit_id": fields.Many2One("clinic.visit","Visit"),
|
||||
"hd_case_id": fields.Many2One("clinic.hd.case","HD Case"),
|
||||
"hd_cases": fields.One2Many("clinic.hd.case","dlz_id","HD Case"), #TODO funtion to get hd case
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
||||
}
|
||||
|
||||
def _get_number(self,context={}):
|
||||
|
@ -64,6 +64,19 @@ class Dialyzer(Model):
|
|||
raise Exception("No Product with category 'Dialyzer'")
|
||||
return product_id
|
||||
|
||||
def _get_product_name(self,context={}):
|
||||
categ_ids=get_model("product.categ").search([['name','=','Dialyzer']])
|
||||
product_name=''
|
||||
found=False
|
||||
for prod in get_model("product").search_browse([]):
|
||||
if found:
|
||||
break
|
||||
if prod.categ_id.id in categ_ids:
|
||||
product_name=prod.name
|
||||
found=True
|
||||
break
|
||||
return product_name
|
||||
|
||||
_defaults={
|
||||
"state": "new",
|
||||
"date": lambda *a: time.strftime("%Y-%m-%d"),
|
||||
|
@ -72,6 +85,7 @@ class Dialyzer(Model):
|
|||
"use_time": 0,
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
'product_id': _get_product,
|
||||
'name': _get_product_name,
|
||||
'dialyzer_type': 'low',
|
||||
}
|
||||
_order="date desc,number desc"
|
||||
|
@ -169,7 +183,7 @@ class Dialyzer(Model):
|
|||
'mode': 'form',
|
||||
'active_id': obj.id
|
||||
},
|
||||
'flash': 'Dializer %s is confirmed'%(obj.number),
|
||||
'flash': 'Dialyzer %s is confirmed'%(number),
|
||||
}
|
||||
print("Done!")
|
||||
|
||||
|
|
Loading…
Reference in New Issue