From cb16c13565799b4378dac07fe8d4c707fff85efa Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Fri, 21 Aug 2015 16:00:45 +0700 Subject: [PATCH 1/5] nurse would like to see only receipt so they have to select claim : "yes" and pay_type : "cash" --- .../clinic_report_account_hd_case_summary.xml | 3 ++- .../models/report_account_hd_case_summary.py | 16 ++++++++++++++++ netforce_clinic/models/shop.py | 12 +++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/netforce_clinic/layouts/clinic_report_account_hd_case_summary.xml b/netforce_clinic/layouts/clinic_report_account_hd_case_summary.xml index 4dd358c..5977ec8 100644 --- a/netforce_clinic/layouts/clinic_report_account_hd_case_summary.xml +++ b/netforce_clinic/layouts/clinic_report_account_hd_case_summary.xml @@ -6,7 +6,8 @@ - + + diff --git a/netforce_clinic/models/report_account_hd_case_summary.py b/netforce_clinic/models/report_account_hd_case_summary.py index 0a2c9e2..5ded9b8 100644 --- a/netforce_clinic/models/report_account_hd_case_summary.py +++ b/netforce_clinic/models/report_account_hd_case_summary.py @@ -19,6 +19,7 @@ class ReportAccountHDCaseSummary(Model): 'reimbursable': fields.Selection([['yes','Yes'],['no','No']],'Claim'), 'walkin': fields.Selection([['yes','Yes'],['no','No']],'Walkin'), 'cycle_id': fields.Many2One("clinic.cycle","Cycle"), + 'pay_type': fields.Selection([['cash','Cash'],['credit','Credit']],'Pay Type'), 'product_id': fields.Many2One("product","Product"), } @@ -76,6 +77,7 @@ class ReportAccountHDCaseSummary(Model): walkin=defaults.get('walkin') ptype_id=None cycle_id=None + pay_type='' if ids: obj=self.browse(ids)[0] branch_id=obj.branch_id.id @@ -87,6 +89,7 @@ class ReportAccountHDCaseSummary(Model): cycle_id=obj.cycle_id.id reimbursable=obj.reimbursable or "" product_id=obj.product_id.id + pay_type=obj.pay_type walkin=obj.walkin dom=[ ['hd_case_id.date','>=', date_from], @@ -214,7 +217,20 @@ class ReportAccountHDCaseSummary(Model): else: records[hdcase_id]['misc']+=amt lines=[] + + # nurse would like to see only receipt + del_invoice=False + del_receipt=False + if pay_type and reimbursable=='no' and pay_type=='cash': + del_invoice=True + elif pay_type and reimbursable=='no' and pay_type=='credit': + del_receipt=True + for hdcase_id, vals in records.items(): + if del_invoice and vals['inv_number']: + continue + elif del_receipt and vals['pm_number']: + continue lines.append(vals) company_name=company.name or "" if department_id: diff --git a/netforce_clinic/models/shop.py b/netforce_clinic/models/shop.py index 028d799..9eabe06 100644 --- a/netforce_clinic/models/shop.py +++ b/netforce_clinic/models/shop.py @@ -892,6 +892,10 @@ class Shop(Model): for pick in shop.pickings: pick_id=pick.id pick_number=pick.number + st=get_model('clinic.setting').browse(1) + ct_ids=[] + for ct in st.product_categ_view: + ct_ids.append(ct.id) for line in shop.lines: prod=line.product_id categ=line.categ_id @@ -902,8 +906,10 @@ class Shop(Model): fee=0 dlz=0 mdc_names=[] - if categ.parent_id: - if categ.parent_id.code=='MDC': + #if categ.parent_id: + #if categ.parent_id.code=='MDC': #XXX + if categ: + if categ.id in ct_ids: mdc+=amount name=prod.name or "" name=name.split("-") @@ -940,7 +946,7 @@ class Shop(Model): 'fee': fee, 'mdc': mdc, 'mdc_name': ','.join([n for n in mdc_names]), - 'dlz_name': "", #XXX + 'dlz_name': "", 'dlz_id': "", 'dlz': dlz, 'lab': lab, From 8409fc1db7dad183427af68f44aea267a9628300 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Sun, 23 Aug 2015 12:41:16 +0700 Subject: [PATCH 2/5] remove shop_categs --- netforce_clinic/layouts/clinic_shop_form.xml | 1 - netforce_clinic/models/shop.py | 9 --------- 2 files changed, 10 deletions(-) diff --git a/netforce_clinic/layouts/clinic_shop_form.xml b/netforce_clinic/layouts/clinic_shop_form.xml index 6245a88..ed81ebe 100644 --- a/netforce_clinic/layouts/clinic_shop_form.xml +++ b/netforce_clinic/layouts/clinic_shop_form.xml @@ -24,7 +24,6 @@ - diff --git a/netforce_clinic/models/shop.py b/netforce_clinic/models/shop.py index 9eabe06..a8adab3 100644 --- a/netforce_clinic/models/shop.py +++ b/netforce_clinic/models/shop.py @@ -13,8 +13,6 @@ class Shop(Model): def _get_all(self,ids,context={}): res={} - st=get_model("clinic.setting").browse(1) - shop_categs=[x.id for x in st.shop_categs] for obj in self.browse(ids): sub_total=0 tax_amount=0 @@ -30,7 +28,6 @@ class Shop(Model): 'tax_amount': tax_amount, 'total': total, 'due_amount': total, - 'shop_categs': shop_categs, } return res @@ -54,7 +51,6 @@ class Shop(Model): "invoices": fields.One2Many("account.invoice","related_id","Invoices"), "payments": fields.One2Many("account.payment","related_id","Payments"), 'dom_str': fields.Char("Dom Str"), - 'shop_categs': fields.Many2Many("product.categ","Categs",function="_get_all",function_multi=True,store=True), "related_id": fields.Reference([["sale.order","Sales Order"],["purchase.order","Purchase Order"],["project","Project"],["job","Service Order"],["service.contract","Service Contract"]],"Related To"), 'company_id': fields.Many2One("company","Company"), "pay_type": fields.Selection([("cash","Cash"),("credit","Credit")],"Pay Type"), @@ -70,10 +66,6 @@ class Shop(Model): _order="date desc" - def _get_shop_categs(self,context={}): - st=get_model("clinic.setting").browse(1) - shop_categs=[x.id for x in st.shop_categs] - return shop_categs def _get_related(self,context={}): related_id=None @@ -169,7 +161,6 @@ class Shop(Model): 'branch_id': _get_branch, 'department_id': _get_department, 'state': 'draft', - 'shop_categs': _get_shop_categs, 'related_id': _get_related, 'patient_id': _get_patient, 'contact_id': _get_contact, From 4fe5529c8368b443f35e8f8c5848330d95508073 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Tue, 25 Aug 2015 22:40:48 +0700 Subject: [PATCH 3/5] print invoice from hd case --- .../actions/clinic_hdcase_invoice_print.xml | 6 + .../layouts/clinic_hd_case_form.xml | 3 + netforce_clinic/models/account_invoice.py | 126 ++++++++++++++++++ netforce_clinic/reports/cust_invoice.odt | Bin 44426 -> 40891 bytes 4 files changed, 135 insertions(+) create mode 100644 netforce_clinic/actions/clinic_hdcase_invoice_print.xml diff --git a/netforce_clinic/actions/clinic_hdcase_invoice_print.xml b/netforce_clinic/actions/clinic_hdcase_invoice_print.xml new file mode 100644 index 0000000..217d76c --- /dev/null +++ b/netforce_clinic/actions/clinic_hdcase_invoice_print.xml @@ -0,0 +1,6 @@ + + report_odt2 + account.invoice + get_invoice_data + cust_invoice + diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml index 0e95784..0a6e647 100644 --- a/netforce_clinic/layouts/clinic_hd_case_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_form.xml @@ -128,6 +128,9 @@ + + + -->