invoice payment
parent
c230331660
commit
7c63f06d96
|
@ -7,6 +7,7 @@
|
||||||
["All",[]],
|
["All",[]],
|
||||||
["Draft",[["state","=","draft"]]],
|
["Draft",[["state","=","draft"]]],
|
||||||
["Approved",[["state","=","approved"]]],
|
["Approved",[["state","=","approved"]]],
|
||||||
|
["Waiting Approval",[["state","=","waiting_approve"]]],
|
||||||
["Completed",[["state","=","done"]]]
|
["Completed",[["state","=","done"]]]
|
||||||
]</field>
|
]</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<field name="name" span="3"/>
|
<field name="name" span="3"/>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="General">
|
<tab string="General">
|
||||||
<field name="lines" nolabel="1" count="0">
|
<field name="lines" nolabel="1" count="0" attrs='{"readonly":[["state","in",["waiting_approve","approved"]]]}'>
|
||||||
<list>
|
<list>
|
||||||
<field name="matching_id" domain='[["state","=","approved"]]' onchange="onchange_matching"/>
|
<field name="matching_id" domain='[["state","=","approved"]]' onchange="onchange_matching"/>
|
||||||
<field name="epo"/>
|
<field name="epo"/>
|
||||||
|
@ -22,9 +22,13 @@
|
||||||
</group>
|
</group>
|
||||||
<group span="4" columns="1">
|
<group span="4" columns="1">
|
||||||
<field name="total"/>
|
<field name="total"/>
|
||||||
|
<field name="total_srv"/>
|
||||||
|
<field name="total_epo"/>
|
||||||
|
<field name="total_fee"/>
|
||||||
</group>
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Approval">
|
<tab string="Approval">
|
||||||
|
<field name="user_id" readonly="1"/>
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
<foot>
|
<foot>
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<list model="clinic.invoice.payment" colors='{"#cfc":[["state","=","approved"]],"#dbdbdb":[["state","=","cancelled"]]}'>
|
<list model="clinic.invoice.payment" colors='{"#cfc":[["state","=","approved"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]],"#ACD1E9":[["state","=","waiting_approve"]],"#70DB93":[["state","=","done"]]}'>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="total_srv"/>
|
||||||
|
<field name="total_epo"/>
|
||||||
|
<field name="total_fee"/>
|
||||||
|
<field name="total"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -47,6 +47,6 @@
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
<foot>
|
<foot>
|
||||||
<button string="Match" method="do_match" type="success" icon='ok'/>
|
<button string="Match" method="do_match" states="draft" type="success" icon='ok'/>
|
||||||
</foot>
|
</foot>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<list model="clinic.matching.payment">
|
<list model="clinic.matching.payment" colors='{"#cfc":[["state","=","approved"]],"#dbdbdb":[["state","=","cancelled"]]}'>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="patient_type_id"/>
|
<field name="patient_type_id"/>
|
||||||
<field name="pcode"/>
|
<field name="pcode"/>
|
||||||
<field name="hcode_id"/>
|
<!--<field name="hcode_id"/>-->
|
||||||
|
<field name="total"/>
|
||||||
|
<field name="total_match"/>
|
||||||
|
<field name="total_unmatch"/>
|
||||||
<field name="user_id"/>
|
<field name="user_id"/>
|
||||||
|
<field name="state"/>
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import time
|
||||||
|
|
||||||
from netforce.model import Model, fields, get_model
|
from netforce.model import Model, fields, get_model
|
||||||
from netforce.utils import get_data_path
|
from netforce.utils import get_data_path
|
||||||
from netforce.access import get_active_company
|
from netforce.access import get_active_company, get_active_user
|
||||||
|
|
||||||
class InvoicePayment(Model):
|
class InvoicePayment(Model):
|
||||||
_name="clinic.invoice.payment"
|
_name="clinic.invoice.payment"
|
||||||
|
@ -12,14 +12,26 @@ class InvoicePayment(Model):
|
||||||
res={}
|
res={}
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
total=0
|
total=0
|
||||||
|
total_fee=0
|
||||||
|
total_srv=0
|
||||||
|
total_epo=0
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
matching=line.matching_id
|
matching=line.matching_id
|
||||||
for mline in matching.lines:
|
for mline in matching.lines:
|
||||||
total+=mline.fee or 0
|
fee=mline.fee or 0
|
||||||
total+=mline.srv or 0
|
total+=fee
|
||||||
total+=mline.epo or 0
|
total_fee+=fee
|
||||||
|
srv=mline.srv or 0
|
||||||
|
total+=srv
|
||||||
|
total_srv+=srv
|
||||||
|
epo=mline.epo or 0
|
||||||
|
total+=epo
|
||||||
|
total_epo+=epo
|
||||||
res[obj.id]={
|
res[obj.id]={
|
||||||
'total': total,
|
'total': total,
|
||||||
|
'total_epo': total_epo,
|
||||||
|
'total_fee': total_fee,
|
||||||
|
'total_srv': total_srv,
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -27,8 +39,12 @@ class InvoicePayment(Model):
|
||||||
'name': fields.Char("Name",required=True),
|
'name': fields.Char("Name",required=True),
|
||||||
'lines': fields.One2Many("clinic.invoice.payment.line","invoice_payment_id", "Lines"),
|
'lines': fields.One2Many("clinic.invoice.payment.line","invoice_payment_id", "Lines"),
|
||||||
'total': fields.Float("Total",function="_get_all",function_multi=True),
|
'total': fields.Float("Total",function="_get_all",function_multi=True),
|
||||||
'state': fields.Selection([['draft','Draft'],['waiting_approve','Waiting Approve'],['approved','Approved'],['done','Done']],'State'),
|
'total_fee': fields.Float("FEE",function="_get_all",function_multi=True),
|
||||||
|
'total_epo': fields.Float("EPO",function="_get_all",function_multi=True),
|
||||||
|
'total_srv': fields.Float("Service",function="_get_all",function_multi=True),
|
||||||
|
'state': fields.Selection([['draft','Draft'],['waiting_approve','Waiting Approval'],['approved','Approved'],['done','Done']],'State'),
|
||||||
'date': fields.Date("Date"),
|
'date': fields.Date("Date"),
|
||||||
|
'user_id': fields.Many2One("base.user","Approver"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
|
@ -36,7 +52,7 @@ class InvoicePayment(Model):
|
||||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def approve(self,ids,context={}):
|
def send_to_payment(self,ids,context={}):
|
||||||
count=0
|
count=0
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
res=obj.make_payment()
|
res=obj.make_payment()
|
||||||
|
@ -44,6 +60,13 @@ class InvoicePayment(Model):
|
||||||
if res<=1:
|
if res<=1:
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def approve(self,ids,context={}):
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
obj.write({
|
||||||
|
'state': 'approve',
|
||||||
|
'user_id': get_active_user(),
|
||||||
|
})
|
||||||
|
|
||||||
def make_payment(self,ids,context={}):
|
def make_payment(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
lines=[]
|
lines=[]
|
||||||
|
@ -113,7 +136,7 @@ class InvoicePayment(Model):
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
})
|
})
|
||||||
|
|
||||||
def sumbit(self,ids,context={}):
|
def submit(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
obj.write({
|
obj.write({
|
||||||
'state': 'waiting_approve',
|
'state': 'waiting_approve',
|
||||||
|
|
|
@ -156,6 +156,8 @@ class MatchingPayment(Model):
|
||||||
elif invoice.ref:
|
elif invoice.ref:
|
||||||
pname=invoice.ref or ''
|
pname=invoice.ref or ''
|
||||||
pname=pname.replace(" ","") # remove space
|
pname=pname.replace(" ","") # remove space
|
||||||
|
for pt in get_model("clinic.patient").search_browse([['name_check','=',pname]]):
|
||||||
|
hn=pt.hn_no or ""
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
fee,epo,srv=0, 0, 0
|
fee,epo,srv=0, 0, 0
|
||||||
|
@ -409,7 +411,7 @@ class MatchingPayment(Model):
|
||||||
'hn': record['hn'],
|
'hn': record['hn'],
|
||||||
'pid': record['pid'],
|
'pid': record['pid'],
|
||||||
'name': record['name'],
|
'name': record['name'],
|
||||||
'fee': record['fee_amt'],
|
'fee': record['fee'],
|
||||||
'invoice_id': record['invoice_id'],
|
'invoice_id': record['invoice_id'],
|
||||||
'state': state,
|
'state': state,
|
||||||
}
|
}
|
||||||
|
@ -491,4 +493,5 @@ class MatchingPayment(Model):
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
MatchingPayment.register()
|
MatchingPayment.register()
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
todo:
|
todo:
|
||||||
convbal -> not yet (wait yui)
|
|
||||||
|
|
||||||
|
convbal -> not yet (wait yui) -> ok but have to update memo
|
||||||
|
|
||||||
post 10,000 invoices per one time -> ask david
|
post 10,000 invoices per one time -> ask david
|
||||||
patient & staff
|
patient & staff
|
||||||
- split name -> not yet
|
- split name -> not yet
|
||||||
|
|
Loading…
Reference in New Issue