print receipt

conv_bal
watcha.h 2015-03-18 21:40:58 +07:00
parent 329e9ee20d
commit 5ccbb9ab60
6 changed files with 35 additions and 8 deletions

View File

@ -6,6 +6,7 @@ class AccountInvoice(Model):
'clinic_expense_id': fields.Many2One("clinic.hd.case.expense","Expense"),
'department_id': fields.Many2One("clinic.department","Department",search=True),
'patient_partner_id': fields.Many2One("partner","Patient",search=True),
'hdcase_credit': fields.Boolean("HD Case Credit"),
}
def _get_number(self,context={}):
@ -48,5 +49,4 @@ class AccountInvoice(Model):
}
AccountInvoice.register()

View File

@ -444,9 +444,13 @@ class HDCase(Model):
"amount": line.amount or 0,
'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({
'state': 'paid',
#'state': 'paid',
'payment_lines': [('create',{
'payment_id': payment_id,
'amount': pay_amount,
@ -570,6 +574,7 @@ class HDCase(Model):
"company_id": company_id,
"lines": [],
"company_id": company_id,
'hdcase_credit': False,
}
vals["partner_id"]=partner.id
vals['lines']=rmb_lines
@ -593,6 +598,7 @@ class HDCase(Model):
"lines": [],
"company_id": company_id,
'partner_id':partner.id,
'hdcase_credit': True,
}
vals['lines']=normb_lines
if patient_partner:
@ -1039,11 +1045,13 @@ class HDCase(Model):
lines=[]
for line in payment.lines:
amt=line.amount or 0
desc=line.description or ''
uom_name=""
lines.append({
'no': no,
'product_name': '',
'description': line.description or '',
'uom_name': '',
'description': desc,
'uom_name': uom_name,
'qty': line.qty or 0,
'price': line.unit_price or 0,
'amount': amt,

View File

@ -77,13 +77,21 @@ class HDCasePayment(Model):
hd_case.post_invoices()
hd_case.create_cycle_item()
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 {
'next': {
'name': 'clinic_hd_case',
'mode': 'form',
'active_id': hd_case.id,
},
'flash': '%s has been paid'%hd_case.number,
'flash': flash,
}
def onchange_amount(self,context={}):

View File

@ -910,6 +910,7 @@ class ClinicSetting(Model):
'ar_debit_id': ac_prod.ar_debit_id.id,
})
break
print("res ", res)
return res
def get_patient_hn(self,ids,context={}):

View File

@ -548,12 +548,22 @@ class Shop(Model):
comp_name=comp.name or ""
if st.default_address_id.company:
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={
'comp_name': comp_name,
'comp_addr': comp_addr or '',
'tax_no': st.tax_no or '',
'number': shop.number or '',
'ref': shop.ref,
'number': number,
'ref': ref,
'date': shop.date,
'datenow': shop.date or time.strftime("%d/%m/%Y"),
'dateprint': shop.date or time.strftime("%d/%m/%Y %H:%M:%S"),