improve
parent
4c783eccd8
commit
8c5fc5ddbc
|
@ -1,5 +1,5 @@
|
|||
<action>
|
||||
<field name="string">Branch</field>
|
||||
<field name="string">Branches</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.branch</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<action>
|
||||
<field name="string">Deparments</field>
|
||||
<field name="string">Departments</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.department</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<action>
|
||||
<field name="string">Hospital</field>
|
||||
<field name="string">Hospitals</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.hospital</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<form model="clinic.branch">
|
||||
<field name="name"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="pick_out_journal_id"/>
|
||||
</form>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<form model="clinic.department" show_company="1">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="pick_out_journal_id"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="branch_id"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
</head>
|
||||
<group span="6" columns="1">
|
||||
<field name="number"/>
|
||||
<field name="ref"/>
|
||||
<field name="patient_id" required="1"/>
|
||||
<field name="name"/>
|
||||
<field name="patient_id" required="1" onchange="onchange_patient"/>
|
||||
<field name="department_id" required="1"/>
|
||||
<field name="date"/>
|
||||
<field name="exp_date"/>
|
||||
</group>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<list model="clinic.dialyzer">
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="name"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="use_time"/>
|
||||
<field name="max_use_time"/>
|
||||
<field name="date"/>
|
||||
<field name="exp_date"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
<divider/>
|
||||
<header string="SETTINGS"/>
|
||||
<item string="Sickbed" action="clinic_sickbed"/>
|
||||
<item string="Departments" action="clinic_department"/>
|
||||
<item string="Valcular Access" action="clinic_vascular_access"/>
|
||||
</item>
|
||||
<item string="Reports" perm="clinic_report">
|
||||
|
@ -52,8 +51,9 @@
|
|||
<item string="Discontinue Patient" action="clinic_report_discontinue_patient"/>
|
||||
</item>
|
||||
<item string="Settings" perm="clinic_settings">
|
||||
<item string="Branch" action="clinic_branch"/>
|
||||
<item string="Hospital" action="clinic_hospital"/>
|
||||
<item string="Branches" action="clinic_branch"/>
|
||||
<item string="Departments" action="clinic_department"/>
|
||||
<item string="Hospitals" action="clinic_hospital"/>
|
||||
<item string="Nationalities" action="clinic_nation"/>
|
||||
<item string="Clinic Settings" action="clinic_setting"/>
|
||||
</item>
|
||||
|
|
|
@ -7,7 +7,6 @@ class Branch(Model):
|
|||
_fields={
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
"parent_id": fields.Many2One("clinic.branch","Parent"),
|
||||
"pick_out_journal_id": fields.Many2One("stock.journal","Stock Journal"),
|
||||
}
|
||||
|
||||
Branch.register()
|
||||
|
|
|
@ -12,6 +12,7 @@ class Department(Model):
|
|||
"parent_id": fields.Many2One("clinic.department", "Parent"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||
"pick_out_journal_id": fields.Many2One("stock.journal","Stock Journal",required=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
|
|
@ -11,6 +11,7 @@ class Dialyzer(Model):
|
|||
_multi_company=True
|
||||
|
||||
_fields={
|
||||
"name": fields.Char("Name",search=True),
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
'ref': fields.Char("Ref."),
|
||||
"description": fields.Text("Description",search=True),
|
||||
|
@ -28,6 +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"),
|
||||
}
|
||||
|
||||
def _get_number(self,context={}):
|
||||
|
@ -94,15 +96,27 @@ class Dialyzer(Model):
|
|||
break
|
||||
if not ship_address_id:
|
||||
patient.simple_address()
|
||||
#raise Exception("contact %s dont'have address with type shipping"%partner.name)
|
||||
|
||||
#XXX
|
||||
st=get_model("clinic.setting").browse(1)
|
||||
journal=st.stock_journal_id
|
||||
if not journal:
|
||||
stock_journal=st.stock_journal_id
|
||||
|
||||
wh_loc_id=None
|
||||
cust_loc_id=None
|
||||
department=obj.department_id
|
||||
if department:
|
||||
stock_journal=department.pick_out_journal_id
|
||||
if stock_journal:
|
||||
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))
|
||||
|
||||
if not stock_journal:
|
||||
raise Exception("Not found stock journal")
|
||||
|
||||
pick_vals={
|
||||
"type": "out",
|
||||
'journal_id': journal.id,
|
||||
'journal_id': stock_journal.id,
|
||||
"ref": obj.number,
|
||||
"related_id": "clinic.dialyzer,%s"%obj.id,
|
||||
"partner_id": obj.patient_id.partner_id.id,
|
||||
|
@ -111,18 +125,21 @@ class Dialyzer(Model):
|
|||
"state": "draft",
|
||||
}
|
||||
|
||||
res=get_model("stock.location").search([["type","=","customer"]])
|
||||
if not res:
|
||||
raise Exception("Customer location not found")
|
||||
cust_loc_id=res[0]
|
||||
if not cust_loc_id:
|
||||
res=get_model("stock.location").search([["type","=","customer"]])
|
||||
if not res:
|
||||
raise Exception("Customer location not found")
|
||||
cust_loc_id=res[0]
|
||||
|
||||
prod=obj.product_id
|
||||
wh_loc_id=prod.location_id.id # product -> tab inventory -> warehouse filed
|
||||
if not wh_loc_id:
|
||||
res=get_model("stock.location").search([["type","=","internal"]])
|
||||
if not res:
|
||||
raise Exception("Warehouse not found")
|
||||
wh_loc_id=res[0]
|
||||
wh_loc_id=prod.location_id.id # product -> tab inventory -> warehouse filed
|
||||
if not wh_loc_id:
|
||||
res=get_model("stock.location").search([["type","=","internal"]])
|
||||
if not res:
|
||||
raise Exception("Warehouse not found")
|
||||
wh_loc_id=res[0]
|
||||
|
||||
line_vals={
|
||||
"product_id": prod.id,
|
||||
"qty": 1,
|
||||
|
@ -210,4 +227,34 @@ class Dialyzer(Model):
|
|||
}
|
||||
|
||||
|
||||
def onchange_patient(self,context={}):
|
||||
data=context['data']
|
||||
patient_id=data['patient_id']
|
||||
patient=get_model("clinic.patient").browse(patient_id)
|
||||
department=patient.department_id
|
||||
if department:
|
||||
data['department_id']=department.id
|
||||
return data
|
||||
|
||||
def name_get(self,ids,context={}):
|
||||
vals=[]
|
||||
for obj in self.browse(ids):
|
||||
name=obj.number or ''
|
||||
if obj.name:
|
||||
name+=" (%s)"%obj.name
|
||||
vals.append((obj.id,name))
|
||||
return vals
|
||||
|
||||
def name_search(self,name,domain=None,context={},**kw):
|
||||
dom=[["name","ilike","%"+name+"%"]]
|
||||
if domain:
|
||||
dom=[dom,domain]
|
||||
ids1=self.search(dom)
|
||||
dom=[["number","ilike","%"+name+"%"]]
|
||||
if domain:
|
||||
dom=[dom,domain]
|
||||
ids2=self.search(dom)
|
||||
ids=list(set(ids1+ids2))
|
||||
return self.name_get(ids,context=context)
|
||||
|
||||
Dialyzer.register()
|
||||
|
|
|
@ -495,20 +495,11 @@ class HDCase(Model):
|
|||
# 1. from department -> branch -> stock journal -> from, to
|
||||
department=obj.department_id
|
||||
if department:
|
||||
branch=department.branch_id
|
||||
if branch:
|
||||
stock_journal=branch.pick_out_journal_id
|
||||
if stock_journal:
|
||||
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))
|
||||
elif obj.branch_id:
|
||||
stock_journal=obj.branch_id.pick_out_journal_id
|
||||
if stock_journal:
|
||||
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))
|
||||
|
||||
stock_journal=department.pick_out_journal_id
|
||||
if stock_journal:
|
||||
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",
|
||||
|
|
Loading…
Reference in New Issue