pending matching payment

fix_acc
watcha.h 2015-08-19 18:39:20 +07:00
parent 8f6eea82aa
commit 6bb4b64dde
5 changed files with 14 additions and 11 deletions

View File

@ -2,7 +2,6 @@
<head> <head>
<field name="state"/> <field name="state"/>
<button string="Print" dropdown="1" icon="print"> <button string="Print" dropdown="1" icon="print">
<!--<item string="Reciept" method="print_receipt"/>-->
<item string="Reciept" action="report_clinic_payment_form" action_options="convert=pdf"/> <item string="Reciept" action="report_clinic_payment_form" action_options="convert=pdf"/>
</button> </button>
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">
@ -121,7 +120,7 @@
<button string="Done" type="success" perm="clinic_hdcase_done" icon="ok" method="done" states="in_progress"/> <button string="Done" type="success" perm="clinic_hdcase_done" icon="ok" method="done" states="in_progress"/>
<button string="Discard" type="danger" perm="clinic_hdcase_discard" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/> <button string="Discard" type="danger" perm="clinic_hdcase_discard" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/>
<button string="Claim Expense" type="default" perm="clinic_hdcase_claim" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible":[["req_fee","=",1]]}'/> <button string="Claim Expense" type="default" perm="clinic_hdcase_claim" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible":[["req_fee","=",1]]}'/>
<button string="Pay" type="success" perm="clinic_hdcase_pay" icon="ok" method="pay" states="completed,waiting_payment" attrs='{"invisible":[["req_fee","=",0]]}'/> <button string="Pay" type="success" perm="clinic_hdcase_pay" icon="ok" method="pay" states="completed" attrs='{"invisible":[["req_fee","=",0]]}'/>
</foot> </foot>
<related> <related>
<field name="invoices" click_action="view_invoice"> <field name="invoices" click_action="view_invoice">

View File

@ -21,6 +21,8 @@
<field name="pcode" span="3"/> <field name="pcode" span="3"/>
<field name="hcode_id" span="3" attrs='{"required":[["pcode","=","SSO"]],"invisible":[["pcode","!=","SSO"]]}'/> <field name="hcode_id" span="3" attrs='{"required":[["pcode","=","SSO"]],"invisible":[["pcode","!=","SSO"]]}'/>
<field name="file" span="3"/> <field name="file" span="3"/>
<field name="branch_id" span="2"/>
<field name="department_id" span="2"/>
<field name="type" invisible="1" span="3"/> <field name="type" invisible="1" span="3"/>
<tabs> <tabs>
<tab string="General"> <tab string="General">

View File

@ -10,9 +10,9 @@ class Migration(migration.Migration):
set_active_user(1) set_active_user(1)
set_active_company(1) set_active_company(1)
dom=[ dom=[
['department_id','=',2], #['department_id','=',2],
['date','>=','2015-08-18'], #['date','>=','2015-08-18'],
['date','<=','2015-08-18'], #['date','<=','2015-08-18'],
] ]
hdcase_ids=set() hdcase_ids=set()
for hdcase in get_model('clinic.hd.case').search_browse(dom): for hdcase in get_model('clinic.hd.case').search_browse(dom):

View File

@ -602,7 +602,8 @@ class HDCase(Model):
obj=self.browse(ids[0]) obj=self.browse(ids[0])
if obj.invoices: if obj.invoices:
for inv in obj.invoices: for inv in obj.invoices:
inv.void() if inv.state=='waiting_payment':
inv.void()
due_date=obj.date[0:10] due_date=obj.date[0:10]
# cash, credit # cash, credit
is_credit=context.get('is_credit') or False is_credit=context.get('is_credit') or False

View File

@ -73,6 +73,8 @@ class MatchingPayment(Model):
'state': fields.Selection([['draft','Draft'],['approved','Approved']],'State'), 'state': fields.Selection([['draft','Draft'],['approved','Approved']],'State'),
'type': fields.Selection([['all','All'],['match','Match'],['unmatch','Not Match']],'Type'), 'type': fields.Selection([['all','All'],['match','Match'],['unmatch','Not Match']],'Type'),
'user_id': fields.Many2One("base.user","Approver"), 'user_id': fields.Many2One("base.user","Approver"),
'department_id': fields.Many2One("clinic.department","Department"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
} }
def _get_ptype(self,context={}): def _get_ptype(self,context={}):
@ -146,13 +148,13 @@ class MatchingPayment(Model):
def match(self,ids,context={}): def match(self,ids,context={}):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
lines=obj.get_line() lines=obj.get_line()
print("len.lines ", len(lines)) print("total lines: ", len(lines))
patient_type=obj.patient_type_id patient_type=obj.patient_type_id
if not patient_type: if not patient_type:
raise Exception("not found patient type") raise Exception("Not found patient type")
contact=patient_type.contact_id contact=patient_type.contact_id
if not contact: if not contact:
raise Exception("contact not found") raise Exception("Contact not found")
st=get_model("clinic.setting").browse(1) st=get_model("clinic.setting").browse(1)
st_pt=st.get_patient_hn() st_pt=st.get_patient_hn()
patient_hn=st_pt['hns'] patient_hn=st_pt['hns']
@ -167,7 +169,7 @@ class MatchingPayment(Model):
dom.append(['partner_id',"=",contact.id]) dom.append(['partner_id',"=",contact.id])
dom.append(['state','=', 'waiting_payment']) dom.append(['state','=', 'waiting_payment'])
invoices=get_model('account.invoice').search_browse(dom) invoices=get_model('account.invoice').search_browse(dom)
print("len(invoices)", len(invoices)) print("total invoices: ", len(invoices))
for invoice in invoices: for invoice in invoices:
pname,hn,card_no='', '', '' pname,hn,card_no='', '', ''
pname2=pname pname2=pname
@ -359,7 +361,6 @@ class MatchingPayment(Model):
'state': 'match', 'state': 'match',
}) })
else: else:
#print("not found")
hn=hn.replace("-", "") hn=hn.replace("-", "")
hn=hn.replace("/", "") hn=hn.replace("/", "")
phn=patient_hn.get(hn) phn=patient_hn.get(hn)