diff --git a/netforce_clinic/fixme.txt b/netforce_clinic/fixme.txt index dd99dd0..382afba 100644 --- a/netforce_clinic/fixme.txt +++ b/netforce_clinic/fixme.txt @@ -1 +1,3 @@ -attr multi_company=True not working +1.print report labor cost +2. +3. diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index bc57792..5ac0f51 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -599,7 +599,7 @@ class HDCase(Model): if obj.invoices: for inv in obj.invoices: inv.void() - due_date=obj.date[1:10] # XXX + due_date=obj.date[0:10] # cash, credit is_credit=context.get('is_credit') or False context['type']='out' diff --git a/netforce_clinic/models/matching_payment.py b/netforce_clinic/models/matching_payment.py index ca98446..40878fb 100644 --- a/netforce_clinic/models/matching_payment.py +++ b/netforce_clinic/models/matching_payment.py @@ -175,9 +175,8 @@ class MatchingPayment(Model): if invoice.related_id: hdcase=invoice.related_id patient=hdcase.patient_id - #pname=patient.name_check or "" #XXX pname='%s%s'%(patient.first_name or "",patient.last_name or "") - #XXX + #XXX partner name should be the same patient name if patient_names.get(pname): pname=patient_names[pname] pname2='%s %s'%(patient.first_name or "",patient.last_name or "") @@ -185,7 +184,6 @@ class MatchingPayment(Model): hn=patient.hn_no or "" elif invoice.ref: pname=invoice.ref or '' - #XXX if patient_names.get(pname): pname=patient_names[pname] pname2=pname @@ -278,8 +276,7 @@ class MatchingPayment(Model): 'invoice_id': None, 'state': 'unmatch', } - #if hn=='100794': - #import pdb; pdb.set_trace() + if matches1.get(key1): print("found ", key1) record.update({ diff --git a/netforce_clinic/models/matching_payment_line.py b/netforce_clinic/models/matching_payment_line.py index 80b12a9..b7f1234 100644 --- a/netforce_clinic/models/matching_payment_line.py +++ b/netforce_clinic/models/matching_payment_line.py @@ -11,6 +11,7 @@ class MatchingPaymentLine(Model): 'amount': (obj.fee or 0)+(obj.epo or 0)+(obj.srv or 0), } return res + _fields={ 'match_id': fields.Many2One("clinic.matching.payment","Match",required=True,on_delete="cascade"), 'invoice_id': fields.Many2One("account.invoice","Invoice (Waiting Payment)"), diff --git a/netforce_clinic/models/partner.py b/netforce_clinic/models/partner.py index 3d58e55..5c7b9f8 100644 --- a/netforce_clinic/models/partner.py +++ b/netforce_clinic/models/partner.py @@ -9,4 +9,25 @@ class Partner(Model): 'is_staff': fields.Boolean("Is Staff"), } + def name_get(self,ids,context={}): + vals=[] + for obj in self.browse(ids): + name=obj.name or "" + if obj.code: + name=" %s (%s)"%(name,obj.code) + vals.append((obj.id,name)) + return vals + + def name_search(self,name,domain=None,condition=[],context={},**kw): + dom=[["name","ilike","%"+name+"%"]] + if domain: + dom=[dom,domain] + ids1=self.search(dom) + dom=[["code","ilike","%"+name+"%"]] + if domain: + dom=[dom,domain] + ids2=self.search(dom) + ids=list(set(ids1+ids2)) + return self.name_get(ids,context=context) + Partner.register() diff --git a/netforce_clinic/models/province.py b/netforce_clinic/models/province.py index a55cbf4..1a300f0 100644 --- a/netforce_clinic/models/province.py +++ b/netforce_clinic/models/province.py @@ -2,6 +2,7 @@ from netforce.model import Model, fields class Province(Model): _inherit="province" + def _get_sort_name(self,ids,context={}): res={} for obj in self.browse(ids): diff --git a/netforce_clinic/models/report_shop.py b/netforce_clinic/models/report_shop.py index f0522ba..fccc8ff 100644 --- a/netforce_clinic/models/report_shop.py +++ b/netforce_clinic/models/report_shop.py @@ -25,19 +25,14 @@ class ReportShop(Model): weekday, total_day=monthrange(int(year), int(month)) date_from=defaults.get('date_from','%s-%s-01'%(year,month)) date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day)) - #date_from=defaults.get('date',date) - #date_to=defaults.get('date',date) product_id=defaults.get('product_id') - branch_id=defaults.get('branch_id',None) - print('defaults ', defaults) if branch_id: branch_id=int(branch_id) department_id=defaults.get('department_id',None) if department_id: department_id=int(department_id) select_dpt=get_model('select.company').get_select() - print('select_dpt ', select_dpt) if select_dpt: if not branch_id: branch_id=select_dpt['branch_id'] diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index e8ebaa2..d051964 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -164,9 +164,13 @@ class ClinicSetting(Model): if user_id !=1: print("Only admin!!") return - obj=self.browse(ids)[0] - obj.merge_staff() - print("Done!") + sql='' + for hdcase in get_model("clinic.hd.case").search_browse([]): + for invoice in hdcase.invoices: + print(hdcase.date,' ---> ', invoice.due_date) + sql+="update account_invoice set due_date='%s' where id=%s;"%(hdcase.date,invoice.id) + db=get_connection() + db.execute(sql) def merge_staff(self,ids,context={}): user_id=get_active_user()