print invoice and payment on hd_case

fix_acc
watcha.h 2015-08-26 10:09:34 +07:00
parent 4fe5529c83
commit 3e1ba5fddf
4 changed files with 15 additions and 5 deletions

View File

@ -1,10 +1,11 @@
<form model="clinic.hd.case" attrs='{"readonly":[["state","in",["cancelled","paid","waiting_payment"]]]}' show_company="1">
<head>
<field name="state"/>
<!--
<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"/>
</button>
-->
<button string="Options" dropdown="1">
<item string="New Dialyzer" action="clinic_hd_case_dlz" states="draft,in_progress,waiting_treatment"/>
<item string="Drop Dialyzer" method="drop_dlz" confirm="Are you sure?" states="completed"/>

View File

@ -350,9 +350,6 @@ class AccountInvoice(Model):
inv=self.browse(inv_id)
comp_id=get_active_company()
comp=get_model('company').browse(comp_id)
context['branch_id']=inv.department_id.branch_id.id
st=get_model('settings').browse(1,context=context)
cst=get_model('clinic.setting').browse(1)
cust=inv.partner_id
cust_tax_no=cust.tax_no or ''
cust_name=cust.name or ''
@ -361,6 +358,17 @@ class AccountInvoice(Model):
cust_addr=cust.addresses[0].address_text
if 'your' in cust_addr:
cust_addr=''
dpt=inv.department_id
branch_id=None
if dpt:
branch_id=dpt.branch_id.id
elif inv.patient_partner_id:
for pt in get_model('clinic.patient').search_read([['partner_id','=',inv.patient_partner_id.id]],['branch_id']):
if pt.get("branch_id"):
branch_id=pt['branch_id'][0]
context['branch_id']=branch_id
st=get_model('settings').browse(1,context=context)
cst=get_model('clinic.setting').browse(1)
no=1
sub_total=0
amount_total=0

View File

@ -45,6 +45,7 @@ class AccountPayment(Model):
'name': 'report_clinic_payment_form',
'refer_id': hd_case_id,
'payment_id': obj.id,
'convert': 'pdf',
},
}

View File

@ -1245,7 +1245,7 @@ class HDCase(Model):
for payment in obj.payments:
context['payment_id']=payment.id
data=self.get_report_payment_data(context=context)
limit_item=10
limit_item=9
if data['state']=='draft':
limit_item=10
for i in range(len(data['lines']),limit_item):