From 8980bc9f3abde10d60062017243d67c8839c3595 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Wed, 1 Apr 2015 17:31:43 +0700 Subject: [PATCH] fix runing number --- netforce_clinic/layouts/clinic_menu.xml | 4 ++-- netforce_clinic/models/hd_case.py | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 42a4826..3486a56 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -45,8 +45,8 @@ - - + + diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 2ce1bb5..39465ce 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -265,7 +265,6 @@ class HDCase(Model): def _get_number(self,context={}): while 1: - #seq_id=get_model("sequence").find_sequence(name="Clinic HD Case") seq_id=get_model("sequence").find_sequence(type="clinic_hdcase") num=get_model("sequence").get_next_number(seq_id,context=context) if not num: @@ -278,7 +277,7 @@ class HDCase(Model): return num get_model("sequence").increment_number(seq_id,context=context) - def _get_invoice_noclaim_number(self,context={}): + def _get_number_invoice_noclaim(self,context={}): while 1: seq_id=get_model("sequence").find_sequence(type="clinic_invoice_noclaim") num=get_model("sequence").get_next_number(seq_id,context=context) @@ -654,7 +653,7 @@ class HDCase(Model): "type": "out", "inv_type": "invoice", "tax_type": "tax_in", - 'date': obj.date, #XXX + 'date': obj.date, 'due_date': due_date, "ref": '%s (%s)'%(patient.name or '',patient.number or ''), 'department_id': obj.department_id.id, @@ -669,13 +668,16 @@ class HDCase(Model): vals['lines']=rmb_lines if patient_partner: vals['patient_partner_id']=patient_partner.id, - get_model("account.invoice").create(vals,context) + #XXX + if obj.branch_id: + context['branch_id']=obj.branch_id.id + get_model("account.invoice").create(vals,context=context) if normb_lines and is_credit: partner=patient.partner_id if not partner: raise Exception("No contact for this patient %s"%obj.partner.name) - number=self._get_invoice_noclaim_number(context=context) + number=self._get_number_invoice_noclaim(context=context) vals={ 'number': number, "type": "out",