From 5cf9be65a1d2b1961a9fff9cdf10697b3dc3166d Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 22 Oct 2014 17:13:43 +0700 Subject: [PATCH] link pm from hd case --- netforce_clinic/models/hd_case.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 2d06cf8..3a89dc2 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -300,7 +300,8 @@ class HDcase(Model): context['type']='out' context['inv_type']='invoice' - if obj.lines and obj.amount: + fee_lines=[] + if obj.lines: vals={ "type": "out", "inv_type": "invoice", @@ -317,7 +318,6 @@ class HDcase(Model): if not partner: raise Exception("No contact for patient %s"%obj.patient_id.name) vals["partner_id"]=partner.id - fee_lines=[] for line in obj.lines: if line.product_id: account_id=line.product_id.sale_account_id.id or account_receivable_id @@ -337,7 +337,8 @@ class HDcase(Model): else: vals['lines'].append(('create',inv_line)) - inv_id=get_model("account.invoice").create(vals,context) + if obj.amount: ## not pay yet + inv_id=get_model("account.invoice").create(vals,context) # create picking obj.make_pickings() @@ -571,6 +572,12 @@ class HDcase(Model): def view_payment(self,ids,context={}): print("clinic_view_payment") - pass + return { + 'next': { + 'name': 'payment', + 'mode': 'form', + 'active_id': ids[0], + }, + } HDcase.register()