From 612ebede92319de240b067e711fb5a5c58845137 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 26 Aug 2015 10:09:34 +0700 Subject: [PATCH] print invoice and payment on hd_case --- netforce_clinic/models/account_invoice.py | 14 +++++++++++--- netforce_clinic/models/account_payment.py | 1 + netforce_clinic/models/hd_case.py | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/netforce_clinic/models/account_invoice.py b/netforce_clinic/models/account_invoice.py index 82bf4e2..97441f4 100644 --- a/netforce_clinic/models/account_invoice.py +++ b/netforce_clinic/models/account_invoice.py @@ -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 diff --git a/netforce_clinic/models/account_payment.py b/netforce_clinic/models/account_payment.py index e8f1172..361c8a0 100644 --- a/netforce_clinic/models/account_payment.py +++ b/netforce_clinic/models/account_payment.py @@ -45,6 +45,7 @@ class AccountPayment(Model): 'name': 'report_clinic_payment_form', 'refer_id': hd_case_id, 'payment_id': obj.id, + 'convert': 'pdf', }, } diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 3d196dd..7597100 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -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):