From 2e60a170f94b87e235eddf111f5cc53dfcb7795f Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Thu, 23 Jul 2015 08:41:29 +0700 Subject: [PATCH] update due_date --- netforce_clinic/models/setting.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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()