print receipt
parent
329e9ee20d
commit
5ccbb9ab60
|
@ -6,6 +6,7 @@ class AccountInvoice(Model):
|
||||||
'clinic_expense_id': fields.Many2One("clinic.hd.case.expense","Expense"),
|
'clinic_expense_id': fields.Many2One("clinic.hd.case.expense","Expense"),
|
||||||
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
||||||
'patient_partner_id': fields.Many2One("partner","Patient",search=True),
|
'patient_partner_id': fields.Many2One("partner","Patient",search=True),
|
||||||
|
'hdcase_credit': fields.Boolean("HD Case Credit"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_number(self,context={}):
|
def _get_number(self,context={}):
|
||||||
|
@ -48,5 +49,4 @@ class AccountInvoice(Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AccountInvoice.register()
|
AccountInvoice.register()
|
||||||
|
|
|
@ -444,9 +444,13 @@ class HDCase(Model):
|
||||||
"amount": line.amount or 0,
|
"amount": line.amount or 0,
|
||||||
'account_id': account_id,
|
'account_id': account_id,
|
||||||
}))
|
}))
|
||||||
payment_id=get_model("account.payment").create(vals,context={"type":"in"})
|
context={
|
||||||
|
'type': 'in',
|
||||||
|
'branch_id': obj.branch_id.id,
|
||||||
|
}
|
||||||
|
payment_id=get_model("account.payment").create(vals,context=context)
|
||||||
obj.write({
|
obj.write({
|
||||||
'state': 'paid',
|
#'state': 'paid',
|
||||||
'payment_lines': [('create',{
|
'payment_lines': [('create',{
|
||||||
'payment_id': payment_id,
|
'payment_id': payment_id,
|
||||||
'amount': pay_amount,
|
'amount': pay_amount,
|
||||||
|
@ -570,6 +574,7 @@ class HDCase(Model):
|
||||||
"company_id": company_id,
|
"company_id": company_id,
|
||||||
"lines": [],
|
"lines": [],
|
||||||
"company_id": company_id,
|
"company_id": company_id,
|
||||||
|
'hdcase_credit': False,
|
||||||
}
|
}
|
||||||
vals["partner_id"]=partner.id
|
vals["partner_id"]=partner.id
|
||||||
vals['lines']=rmb_lines
|
vals['lines']=rmb_lines
|
||||||
|
@ -593,6 +598,7 @@ class HDCase(Model):
|
||||||
"lines": [],
|
"lines": [],
|
||||||
"company_id": company_id,
|
"company_id": company_id,
|
||||||
'partner_id':partner.id,
|
'partner_id':partner.id,
|
||||||
|
'hdcase_credit': True,
|
||||||
}
|
}
|
||||||
vals['lines']=normb_lines
|
vals['lines']=normb_lines
|
||||||
if patient_partner:
|
if patient_partner:
|
||||||
|
@ -1039,11 +1045,13 @@ class HDCase(Model):
|
||||||
lines=[]
|
lines=[]
|
||||||
for line in payment.lines:
|
for line in payment.lines:
|
||||||
amt=line.amount or 0
|
amt=line.amount or 0
|
||||||
|
desc=line.description or ''
|
||||||
|
uom_name=""
|
||||||
lines.append({
|
lines.append({
|
||||||
'no': no,
|
'no': no,
|
||||||
'product_name': '',
|
'product_name': '',
|
||||||
'description': line.description or '',
|
'description': desc,
|
||||||
'uom_name': '',
|
'uom_name': uom_name,
|
||||||
'qty': line.qty or 0,
|
'qty': line.qty or 0,
|
||||||
'price': line.unit_price or 0,
|
'price': line.unit_price or 0,
|
||||||
'amount': amt,
|
'amount': amt,
|
||||||
|
|
|
@ -77,13 +77,21 @@ class HDCasePayment(Model):
|
||||||
hd_case.post_invoices()
|
hd_case.post_invoices()
|
||||||
hd_case.create_cycle_item()
|
hd_case.create_cycle_item()
|
||||||
hd_case.do_expense()
|
hd_case.do_expense()
|
||||||
|
hd_case.write({
|
||||||
|
'state': 'waiting_payment',
|
||||||
|
'req_fee': 0, # force to hide button pay!
|
||||||
|
})
|
||||||
|
inv_number=[]
|
||||||
|
for inv in hd_case.invoices:
|
||||||
|
inv_number.append(inv.number or "")
|
||||||
|
flash='%s is waiting to pay.'% ' and '.join([inv for inv in inv_number])
|
||||||
return {
|
return {
|
||||||
'next': {
|
'next': {
|
||||||
'name': 'clinic_hd_case',
|
'name': 'clinic_hd_case',
|
||||||
'mode': 'form',
|
'mode': 'form',
|
||||||
'active_id': hd_case.id,
|
'active_id': hd_case.id,
|
||||||
},
|
},
|
||||||
'flash': '%s has been paid'%hd_case.number,
|
'flash': flash,
|
||||||
}
|
}
|
||||||
|
|
||||||
def onchange_amount(self,context={}):
|
def onchange_amount(self,context={}):
|
||||||
|
|
|
@ -910,6 +910,7 @@ class ClinicSetting(Model):
|
||||||
'ar_debit_id': ac_prod.ar_debit_id.id,
|
'ar_debit_id': ac_prod.ar_debit_id.id,
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
|
print("res ", res)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_patient_hn(self,ids,context={}):
|
def get_patient_hn(self,ids,context={}):
|
||||||
|
|
|
@ -548,12 +548,22 @@ class Shop(Model):
|
||||||
comp_name=comp.name or ""
|
comp_name=comp.name or ""
|
||||||
if st.default_address_id.company:
|
if st.default_address_id.company:
|
||||||
comp_name=st.default_address_id.company or ""
|
comp_name=st.default_address_id.company or ""
|
||||||
|
number=shop.number or ""
|
||||||
|
ref=shop.ref or ""
|
||||||
|
if shop.pay_type=="cash":
|
||||||
|
for pm in shop.payments:
|
||||||
|
number=pm.number or ""
|
||||||
|
ref=shop.number or ""
|
||||||
|
else:
|
||||||
|
for inv in shop.invoices:
|
||||||
|
number=inv.number or ""
|
||||||
|
ref=shop.number or ""
|
||||||
data={
|
data={
|
||||||
'comp_name': comp_name,
|
'comp_name': comp_name,
|
||||||
'comp_addr': comp_addr or '',
|
'comp_addr': comp_addr or '',
|
||||||
'tax_no': st.tax_no or '',
|
'tax_no': st.tax_no or '',
|
||||||
'number': shop.number or '',
|
'number': number,
|
||||||
'ref': shop.ref,
|
'ref': ref,
|
||||||
'date': shop.date,
|
'date': shop.date,
|
||||||
'datenow': shop.date or time.strftime("%d/%m/%Y"),
|
'datenow': shop.date or time.strftime("%d/%m/%Y"),
|
||||||
'dateprint': shop.date or time.strftime("%d/%m/%Y %H:%M:%S"),
|
'dateprint': shop.date or time.strftime("%d/%m/%Y %H:%M:%S"),
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue