receipt
parent
9b82b6f0b2
commit
ea3538fed5
|
@ -1,6 +1,9 @@
|
||||||
<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">
|
||||||
|
<item string="Reciept" method="print_receipt"/>
|
||||||
|
</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="To Draft" method="to_draft" states="paid,waiting_payment,completed,cancelled"/>
|
<item string="To Draft" method="to_draft" states="paid,waiting_payment,completed,cancelled"/>
|
||||||
|
|
|
@ -27,7 +27,6 @@ class AccountPayment(Model):
|
||||||
def import_payment(self,ids,context={}):
|
def import_payment(self,ids,context={}):
|
||||||
if not ids:
|
if not ids:
|
||||||
raise Exception("Please save payment before import")
|
raise Exception("Please save payment before import")
|
||||||
print("xx ", ids)
|
|
||||||
return {
|
return {
|
||||||
'next': {
|
'next': {
|
||||||
'name': 'clinic_import_uc',
|
'name': 'clinic_import_uc',
|
||||||
|
|
|
@ -948,6 +948,7 @@ class HDCase(Model):
|
||||||
comp_id=get_active_company()
|
comp_id=get_active_company()
|
||||||
comp=get_model('company').browse(comp_id)
|
comp=get_model('company').browse(comp_id)
|
||||||
st=get_model('settings').browse(1)
|
st=get_model('settings').browse(1)
|
||||||
|
cst=get_model('clinic.setting').browse(1)
|
||||||
addresses=st.addresses
|
addresses=st.addresses
|
||||||
comp_addr=''
|
comp_addr=''
|
||||||
if addresses:
|
if addresses:
|
||||||
|
@ -980,6 +981,8 @@ class HDCase(Model):
|
||||||
is_draft=payment.state=='draft' and True or False
|
is_draft=payment.state=='draft' and True or False
|
||||||
is_cheque=False
|
is_cheque=False
|
||||||
pay_type=payment.pay_type or ''
|
pay_type=payment.pay_type or ''
|
||||||
|
user_id=get_active_user()
|
||||||
|
user=get_model("base.user").browse(user_id)
|
||||||
data={
|
data={
|
||||||
'comp_name': comp.name or '',
|
'comp_name': comp.name or '',
|
||||||
'comp_addr': comp_addr or '',
|
'comp_addr': comp_addr or '',
|
||||||
|
@ -987,8 +990,11 @@ class HDCase(Model):
|
||||||
'number': payment.number or '',
|
'number': payment.number or '',
|
||||||
'ref': payment.ref,
|
'ref': payment.ref,
|
||||||
'date': payment.date,
|
'date': payment.date,
|
||||||
|
'datenow': time.strftime("%d/%m/%Y"),
|
||||||
|
'dateprint': time.strftime("%d/%m/%Y %H:%M:%S"),
|
||||||
'cust_name': cust_name,
|
'cust_name': cust_name,
|
||||||
'cust_addr': cust_addr,
|
'cust_addr': cust_addr,
|
||||||
|
'user_name': user.name or "",
|
||||||
'note': payment.memo or '',
|
'note': payment.memo or '',
|
||||||
'lines':lines,
|
'lines':lines,
|
||||||
'amount_subtotal': sub_total,
|
'amount_subtotal': sub_total,
|
||||||
|
@ -1004,6 +1010,8 @@ class HDCase(Model):
|
||||||
data['pay_type']='Credit'
|
data['pay_type']='Credit'
|
||||||
if st.logo:
|
if st.logo:
|
||||||
data['logo']=get_file_path(st.logo)
|
data['logo']=get_file_path(st.logo)
|
||||||
|
if cst.signature:
|
||||||
|
data['signature']=get_file_path(cst.signature)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_payment_data(self,ids,context={}):
|
def get_payment_data(self,ids,context={}):
|
||||||
|
@ -1364,4 +1372,22 @@ class HDCase(Model):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def print_receipt(self,ids,context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
payment_id=None
|
||||||
|
for payment in obj.payments:
|
||||||
|
payment_id=payment.id
|
||||||
|
if not payment_id:
|
||||||
|
raise Exception("Receipt not found!")
|
||||||
|
#obj.write({
|
||||||
|
#'payment_id': obj.id,
|
||||||
|
#})
|
||||||
|
return {
|
||||||
|
'next': {
|
||||||
|
'name': 'report_clinic_payment_form',
|
||||||
|
'refer_id': obj.id,
|
||||||
|
'payment_id': payment_id,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
HDCase.register()
|
HDCase.register()
|
||||||
|
|
Loading…
Reference in New Issue