print invoice and payment on hd_case
							parent
							
								
									4fe5529c83
								
							
						
					
					
						commit
						3e1ba5fddf
					
				| 
						 | 
					@ -1,10 +1,11 @@
 | 
				
			||||||
<form model="clinic.hd.case" attrs='{"readonly":[["state","in",["cancelled","paid","waiting_payment"]]]}' show_company="1">
 | 
					<form model="clinic.hd.case" attrs='{"readonly":[["state","in",["cancelled","paid","waiting_payment"]]]}' show_company="1">
 | 
				
			||||||
    <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">
 | 
				
			||||||
            <item string="New Dialyzer" action="clinic_hd_case_dlz" states="draft,in_progress,waiting_treatment"/>
 | 
					            <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"/>
 | 
					            <item string="Drop Dialyzer" method="drop_dlz" confirm="Are you sure?" states="completed"/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -350,9 +350,6 @@ class AccountInvoice(Model):
 | 
				
			||||||
        inv=self.browse(inv_id)
 | 
					        inv=self.browse(inv_id)
 | 
				
			||||||
        comp_id=get_active_company()
 | 
					        comp_id=get_active_company()
 | 
				
			||||||
        comp=get_model('company').browse(comp_id)
 | 
					        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=inv.partner_id
 | 
				
			||||||
        cust_tax_no=cust.tax_no or ''
 | 
					        cust_tax_no=cust.tax_no or ''
 | 
				
			||||||
        cust_name=cust.name or ''
 | 
					        cust_name=cust.name or ''
 | 
				
			||||||
| 
						 | 
					@ -361,6 +358,17 @@ class AccountInvoice(Model):
 | 
				
			||||||
            cust_addr=cust.addresses[0].address_text
 | 
					            cust_addr=cust.addresses[0].address_text
 | 
				
			||||||
        if 'your' in cust_addr:
 | 
					        if 'your' in cust_addr:
 | 
				
			||||||
            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
 | 
					        no=1
 | 
				
			||||||
        sub_total=0
 | 
					        sub_total=0
 | 
				
			||||||
        amount_total=0
 | 
					        amount_total=0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,7 @@ class AccountPayment(Model):
 | 
				
			||||||
                'name': 'report_clinic_payment_form',
 | 
					                'name': 'report_clinic_payment_form',
 | 
				
			||||||
                'refer_id': hd_case_id,
 | 
					                'refer_id': hd_case_id,
 | 
				
			||||||
                'payment_id': obj.id,
 | 
					                'payment_id': obj.id,
 | 
				
			||||||
 | 
					                'convert': 'pdf',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1245,7 +1245,7 @@ class HDCase(Model):
 | 
				
			||||||
            for payment in obj.payments:
 | 
					            for payment in obj.payments:
 | 
				
			||||||
                context['payment_id']=payment.id
 | 
					                context['payment_id']=payment.id
 | 
				
			||||||
                data=self.get_report_payment_data(context=context)
 | 
					                data=self.get_report_payment_data(context=context)
 | 
				
			||||||
                limit_item=10
 | 
					                limit_item=9
 | 
				
			||||||
                if data['state']=='draft':
 | 
					                if data['state']=='draft':
 | 
				
			||||||
                    limit_item=10
 | 
					                    limit_item=10
 | 
				
			||||||
                for i in  range(len(data['lines']),limit_item):
 | 
					                for i in  range(len(data['lines']),limit_item):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue