invoice payment
parent
c230331660
commit
7c63f06d96
|
@ -7,6 +7,7 @@
|
|||
["All",[]],
|
||||
["Draft",[["state","=","draft"]]],
|
||||
["Approved",[["state","=","approved"]]],
|
||||
["Waiting Approval",[["state","=","waiting_approve"]]],
|
||||
["Completed",[["state","=","done"]]]
|
||||
]</field>
|
||||
</action>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<field name="name" span="3"/>
|
||||
<tabs>
|
||||
<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>
|
||||
<field name="matching_id" domain='[["state","=","approved"]]' onchange="onchange_matching"/>
|
||||
<field name="epo"/>
|
||||
|
@ -22,9 +22,13 @@
|
|||
</group>
|
||||
<group span="4" columns="1">
|
||||
<field name="total"/>
|
||||
<field name="total_srv"/>
|
||||
<field name="total_epo"/>
|
||||
<field name="total_fee"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Approval">
|
||||
<field name="user_id" readonly="1"/>
|
||||
</tab>
|
||||
</tabs>
|
||||
<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="total_srv"/>
|
||||
<field name="total_epo"/>
|
||||
<field name="total_fee"/>
|
||||
<field name="total"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
|
|
|
@ -47,6 +47,6 @@
|
|||
</tab>
|
||||
</tabs>
|
||||
<foot>
|
||||
<button string="Match" method="do_match" type="success" icon='ok'/>
|
||||
<button string="Match" method="do_match" states="draft" type="success" icon='ok'/>
|
||||
</foot>
|
||||
</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="patient_type_id"/>
|
||||
<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="state"/>
|
||||
</list>
|
||||
|
|
|
@ -2,7 +2,7 @@ import time
|
|||
|
||||
from netforce.model import Model, fields, get_model
|
||||
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):
|
||||
_name="clinic.invoice.payment"
|
||||
|
@ -12,14 +12,26 @@ class InvoicePayment(Model):
|
|||
res={}
|
||||
for obj in self.browse(ids):
|
||||
total=0
|
||||
total_fee=0
|
||||
total_srv=0
|
||||
total_epo=0
|
||||
for line in obj.lines:
|
||||
matching=line.matching_id
|
||||
for mline in matching.lines:
|
||||
total+=mline.fee or 0
|
||||
total+=mline.srv or 0
|
||||
total+=mline.epo or 0
|
||||
fee=mline.fee or 0
|
||||
total+=fee
|
||||
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]={
|
||||
'total': total,
|
||||
'total_epo': total_epo,
|
||||
'total_fee': total_fee,
|
||||
'total_srv': total_srv,
|
||||
}
|
||||
return res
|
||||
|
||||
|
@ -27,8 +39,12 @@ class InvoicePayment(Model):
|
|||
'name': fields.Char("Name",required=True),
|
||||
'lines': fields.One2Many("clinic.invoice.payment.line","invoice_payment_id", "Lines"),
|
||||
'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"),
|
||||
'user_id': fields.Many2One("base.user","Approver"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
@ -36,7 +52,7 @@ class InvoicePayment(Model):
|
|||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
def approve(self,ids,context={}):
|
||||
def send_to_payment(self,ids,context={}):
|
||||
count=0
|
||||
for obj in self.browse(ids):
|
||||
res=obj.make_payment()
|
||||
|
@ -44,6 +60,13 @@ class InvoicePayment(Model):
|
|||
if res<=1:
|
||||
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={}):
|
||||
obj=self.browse(ids)[0]
|
||||
lines=[]
|
||||
|
@ -113,7 +136,7 @@ class InvoicePayment(Model):
|
|||
'state': 'draft',
|
||||
})
|
||||
|
||||
def sumbit(self,ids,context={}):
|
||||
def submit(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({
|
||||
'state': 'waiting_approve',
|
||||
|
|
|
@ -156,6 +156,8 @@ class MatchingPayment(Model):
|
|||
elif invoice.ref:
|
||||
pname=invoice.ref or ''
|
||||
pname=pname.replace(" ","") # remove space
|
||||
for pt in get_model("clinic.patient").search_browse([['name_check','=',pname]]):
|
||||
hn=pt.hn_no or ""
|
||||
else:
|
||||
pass
|
||||
fee,epo,srv=0, 0, 0
|
||||
|
@ -409,7 +411,7 @@ class MatchingPayment(Model):
|
|||
'hn': record['hn'],
|
||||
'pid': record['pid'],
|
||||
'name': record['name'],
|
||||
'fee': record['fee_amt'],
|
||||
'fee': record['fee'],
|
||||
'invoice_id': record['invoice_id'],
|
||||
'state': state,
|
||||
}
|
||||
|
@ -491,4 +493,5 @@ class MatchingPayment(Model):
|
|||
'state': 'draft',
|
||||
})
|
||||
|
||||
|
||||
MatchingPayment.register()
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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
|
||||
patient & staff
|
||||
- split name -> not yet
|
||||
|
|
Loading…
Reference in New Issue