combine product code before create GI

conv_bal
watcha.h 2015-03-13 07:01:23 +07:00
parent 87f6ea7c73
commit e358bea6c9
6 changed files with 30 additions and 4 deletions

View File

@ -12,3 +12,4 @@ force to print table for 1 page ->ok
---- visit --- ---- visit ---
- check duplicate visit - check duplicate visit
- run script to take department to patient

View File

@ -17,8 +17,9 @@
<field name="reg_date"/> <field name="reg_date"/>
<field name="doctor_id"/> <field name="doctor_id"/>
<field name="categ_id"/> <field name="categ_id"/>
<field name="branch_id" required="1"/> <!--<field name="branch_id" required="1"/>-->
<field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/> <!--<field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/>-->
<field name="department_id"/>
<field name="walkin"/> <field name="walkin"/>
<field name="active" invisible="1"/> <field name="active" invisible="1"/>
<tabs> <tabs>

View File

@ -620,13 +620,16 @@ class HDCase(Model):
for line in obj.lines: for line in obj.lines:
if line.state!='draft': if line.state!='draft':
continue continue
if line.qty < 1: if line.qty < 1:
continue continue
prod=line.product_id prod=line.product_id
# check orginal product
prod_code=prod.code.split("-")[0]
if len(prod_code)>1:
prods=get_model('product').search_browse(['code','=',prod_code])
prod=prods[0]
if prod.type != 'stock': if prod.type != 'stock':
continue continue
#XXX #XXX
if prod_ids and prod.id not in prod_ids or prod.id in prod_exist_ids: if prod_ids and prod.id not in prod_ids or prod.id in prod_exist_ids:
continue continue

View File

@ -133,6 +133,7 @@ class Patient(Model):
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."), "vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'), 'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'),
'walkin': fields.Selection([['yes','Yes'],['no','No']],"Walk In"), 'walkin': fields.Selection([['yes','Yes'],['no','No']],"Walk In"),
'departments': fields.Many2Many("clinic.department","Departments"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -171,6 +172,9 @@ class Patient(Model):
if b_ids: if b_ids:
return b_ids[0] return b_ids[0]
def _get_dpts(self,context={}):
return get_model("clinic.department").search([])
_defaults={ _defaults={
#"number": _get_number, #"number": _get_number,
"number": "", "number": "",
@ -182,6 +186,7 @@ class Patient(Model):
"active" : True, "active" : True,
'state': 'admit', 'state': 'admit',
'walkin': 'no', 'walkin': 'no',
'departments': _get_dpts,
} }
_sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"), _sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"),

View File

@ -137,6 +137,17 @@ class ClinicSetting(Model):
print("Only admin!!") print("Only admin!!")
return return
dpt_ids=get_model("clinic.department").search([]) dpt_ids=get_model("clinic.department").search([])
for pt in get_model("clinic.patient").search_browse([]):
dpt2_ids=set()
for vst in pt.visits:
if vst.department_id:
dpt2_ids.update({(vst.department_id.id, vst.cycle_id.id)}) # get day
print('dpt2_ids ', dpt2_ids)
if not pt.departments:
pt.write({
#'cycles': [['set',dpt2_ids]],
})
print('set department for ', pt.name)
for st in get_model("clinic.staff").search_browse([]): for st in get_model("clinic.staff").search_browse([]):
if not st.departments: if not st.departments:
st.write({ st.write({

View File

@ -1,2 +1,7 @@
- sickbed -> can not see sickbed because mix patient
- fixme:
- see deparment from sickbed => hd_case => and update department of patient (manymany)
hd case => can not click next page
report cycle item : report cycle item :
- sunanna can not see - sunanna can not see