new product + new dializer without waiting Netforce

dev
SPP 2017-11-24 18:35:56 +07:00
parent 1062124931
commit 00ac008130
7 changed files with 57 additions and 16 deletions

View File

@ -16,7 +16,7 @@
<field name="membrane_type" required="1"/>
</group>
<group span="6" columns="1">
<field name="product_id" onchange="onchange_product"/>
<field name="product_id" onchange="onchange_product" domain="[['categ_id.name','=','Dialyzer']]"/>
<field name="dialyzer_type"/>
<field name="use_time"/>
<field name="max_use_time"/>

View File

@ -1,5 +1,6 @@
<form model="clinic.hd.case.popup.dlz">
<field name="hd_case_id" invisible="1"/>
<field name="new_product" span="6"/>
<field name="product_id" onchange="onchange_product" domain="[['categ_id.name','=','Dialyzer']]" span="6"/>
<field name="dialyzer_type" required="1" span="6"/>
<field name="max_use_time" span="6" required="1"/>
@ -7,6 +8,11 @@
<field name="exp_date" span="6"/>
<field name="note" span="6"/>
<field name="drop_old" span="6"/>
<template>
<p class="well text-warning">
<span class="glyphicon glyphicon-info-sign"></span> กรณีในช่อง product ไม่มีให้เลือก ให้ระบุที่ชอ่ง New Product แทน
</p>
</template>
<foot>
<button string="Validate" type="success" method="new_dlz"/>
</foot>

View File

@ -5,10 +5,11 @@
<field name="number"/>
<field name="visit_date"/>
<field name="cycle_id"/>
<field name="patient_id"/>
<field name="patient_name"/>
<field name="patient_type_id"/>
<field name="doctor_id"/>
<field name="department_id"/>
<field name="branch_id"/>
<!--<field name="branch_id"/>-->
<field name="nurse_id"/>
<field name="state"/>
</list>

View File

@ -75,8 +75,8 @@ class Dialyzer(Model):
product_id=prod.id
found=True
break
if not product_id:
raise Exception("No Product with category 'Dialyzer'")
#if not product_id:
#raise Exception("No Product with category 'Dialyzer'")
return product_id
def _get_product_name(self,context={}):
@ -126,7 +126,6 @@ class Dialyzer(Model):
if not ship_address_id:
patient.simple_address()
#XXX
st=get_model("clinic.setting").browse(1)
stock_journal=st.stock_journal_id
@ -170,7 +169,7 @@ class Dialyzer(Model):
raise Exception("Warehouse not found")
wh_loc_id=res[0]
if prod.type=='stock':
if prod and prod.type=='stock':
line_vals={
"product_id": prod.id,
"qty": 1,
@ -191,7 +190,7 @@ class Dialyzer(Model):
number=obj.number.replace("/","")
if not number:
department=obj.department_id
context['branch_id']=department.branch_id.id
context['branch_id']=department.branch_id.id
number=self._get_number(context=context)
obj.write({
"number": number,

View File

@ -6,7 +6,8 @@ class HDCasePopupDlz(Model):
_fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"),
'product_id': fields.Many2One("product", "Product",required=True),
'product_id': fields.Many2One("product", "Product",required=False),
'new_product': fields.Char("New Product"),
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
"max_use_time": fields.Integer("Max Use Time"),
"exp_date": fields.Date("Expiry Date"),
@ -59,8 +60,34 @@ class HDCasePopupDlz(Model):
context['is_wiz']=True
context['pop_id']=obj.id
context['drop_old']=obj.drop_old
if obj.new_product:
name=obj.new_product
uom_id=None
for r_id in get_model("uom").search([['name','=','Unit']]):
uom_id=r_id
if not uom_id:
raise Exception("Missing UoM <Unit>!")
categ_id=None
for r_id in get_model("product.categ").search([['code','=','DLZ']]):
categ_id=r_id
if not categ_id:
raise Exception("Missing Product category code DLZ!")
new_prod_id=get_model("product").create({
'type': 'stock',
'code': name.upper(),
'name': name,
'description': name,
"uom_id": uom_id,
'categ_id': categ_id,
'can_sell': True,
'can_purchase': True,
})
obj.write({
'product_id': new_prod_id,
})
if not obj.product_id:
raise Exception("Missing product!")
res=hd_case.new_dialyzer(context=context)
print('res ', res)
return res
def onchange_product(self,context={}):

View File

@ -26,9 +26,12 @@ class Visit(Model):
for obj in self.browse(ids):
cycle=obj.cycle_id
color=cycle.color
patient=obj.patient_id
res[obj.id]={
'cycle_color': color,
'sequence': '%s-%s'%(obj.time_start[0:10],cycle.sequence), #date-sequence
'patient_name': patient_id.name,
'patient_type_id': patient_id.type_id.id,
}
return res
@ -54,6 +57,8 @@ class Visit(Model):
'note': fields.Text('Note'),
'branch_id': fields.Many2One("clinic.branch","Branch"),
'manual': fields.Boolean("Manual Tempolary Visit"),
"patient_name": fields.Char("Patient Name", function="_get_all", store=True, search=True),
"patient_type_id": fields.Char("Patient Type", function="_get_all", store=True, search=True),
}
def _get_number(self,context={}):

View File

@ -1,7 +1,10 @@
redesign print payment & invoice from hdcase
- print payment
- direct payment
- invoice payment
==========================================
keep log:
patient_name, patient_type, walkin, location
migration:
match invoice less than 2015-06-30 to hdcase
===========================================
patient:
1.new
2. dispose
3. move