should enter product if have fee charge
parent
02aa22a844
commit
4fa63302e1
|
@ -64,7 +64,7 @@
|
|||
</tab>
|
||||
<tab string="Expense">
|
||||
<group span="12" form_layout="stacked">
|
||||
<field name="lines" count="3" nolabel="1">
|
||||
<field name="lines" count="3" nolabel="1" attrs='{"readonly":[["state","in",["waiting_payment","completed","paid"]]]}'>
|
||||
<list>
|
||||
<field name="product_categ_id" onchange="onchange_line"/>
|
||||
<field name="product_id" domain='[["categ_id.id","=",product_categ_id],["patient_types.id","=",parent.patient_type_id]]' onchange="onchange_product"/>
|
||||
|
@ -100,9 +100,8 @@
|
|||
</group>
|
||||
</tab>
|
||||
<tab string="Doctors">
|
||||
<field name="staffs" nolabel="1">
|
||||
<field name="staffs" nolabel="1" attrs='{"readonly":[["state","=","completed"]]}'>
|
||||
<list>
|
||||
<!--<field name="type" invisible="1"/>-->
|
||||
<field name="staff_id" onchange="onchange_staff" domain="[['type','=','doctor']]"/>
|
||||
<field name="priop"/>
|
||||
<field name="note"/>
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
#from . import del_gi
|
||||
#from . import restore_picking
|
||||
#from . import rename_dbl_hdcase_number
|
||||
from . import reset_hdcase_number
|
||||
#from . import reset_hdcase_number
|
||||
|
|
|
@ -1150,10 +1150,22 @@ class HDCase(Model):
|
|||
def done(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
if obj.patient_type_id.code=='SSO':
|
||||
cond1=False
|
||||
cond2=False
|
||||
for line in obj.lines:
|
||||
prod=line.product_id
|
||||
categ=line.product_categ_id
|
||||
# force to enter unit price
|
||||
if not line.price and prod:
|
||||
raise Exception("Can not complete HDCase because price of product %s is missing!"%(prod.name))
|
||||
raise Exception("Missing unit price for product [%s] %s!"%(prod.code,prod.name))
|
||||
elif not prod and categ.code=='EPO':
|
||||
cond2=True
|
||||
if categ.code=='FEE' and line.price:
|
||||
cond1=True
|
||||
# if fee and not enter product then hdcase should not finish
|
||||
if cond1 and cond2:
|
||||
raise Exception("%s is missing product"%(categ.name))
|
||||
|
||||
count=0
|
||||
for sline in obj.staffs:
|
||||
if sline.staff_id:
|
||||
|
|
Loading…
Reference in New Issue