conv_bal
watcha.h@almacom.co.th 2014-12-22 02:43:59 +07:00
parent 9555384428
commit 99e0107cab
3 changed files with 29 additions and 46 deletions

View File

@ -47,6 +47,7 @@
</tabs>
<related>
<!--<field name="visits"/>-->
<field name="hd_cases"/>
<field name="comments"/>
</related>
</form>

View File

@ -7,7 +7,7 @@
<group form_layout="stacked">
<field name="waiting_approval" span="3"/>
<field name="real_time" span="3"/>
<field name="auto_gen" span="3"/>
<field name="auto_gen" invisible="1" span="3"/>
<separator string="Expenes"/>
<field name="products" nolabel="1">
<list>
@ -79,8 +79,16 @@
<tab string="Dialyzer">
<field name="stock_journal_id"/>
</tab>
<tab string="Schedule">
<separator string='Transfer nurses to cycle item'/>
<field name="schd_from"/>
<field name="schd_to"/>
<button string="Confirm" type="success" method="schd_confirm"/>
</tab>
<tab string="Testing">
<button string="Run Script" type="default" method="run_script"/>
</tab>
</tabs>
<foot>
<button string="Update Date" type="default" method="update_date"/>
</foot>
</form>

View File

@ -21,7 +21,9 @@ class ClinicSetting(Model):
'imp_patient_type_id': fields.Many2One("clinic.patient.type","Import UC Type"), # Import payment
'find_dlz': fields.Boolean("Find Dialyzer After Confirm Visit"), # Visit
'stock_journal_id': fields.Many2One("stock.journal","Default Journal"),
'auto_gen': fields.Boolean("Auto Gen") # HD Case
'auto_gen': fields.Boolean("Auto Gen"), # HD Case
'schd_from': fields.Date("From"),
'schd_to': fields.Date("To"),
}
_defaults={
@ -72,7 +74,8 @@ class ClinicSetting(Model):
line['amount']=amt
return data
def update_date(self,ids,context={}):
def run_script(self,ids,context={}):
return
for inv in get_model("account.invoice").search_browse([]):
amount_total=0
for line in inv.lines:
@ -82,48 +85,19 @@ class ClinicSetting(Model):
'amount_due': amount_total,
})
print("Done!")
def schd_confirm(self,ids,context={}):
obj=self.browse(ids)[0]
if not obj.schd_from:
raise Exception("No date from")
if not obj.schd_to:
raise Exception("No date to")
dom=[]
dom.append(['date', '>=', obj.schd_from])
dom.append(['date', '<=', obj.schd_to])
for schd in get_model('clinic.schedule').search_browse(dom):
schd.confirm()
return True
#for hd_case in get_model("clinic.hd.case").search_browse([]):
#if hd_case.state!='waiting_treatment':
#continue
#for line in hd_case.lines:
#categ=line.product_categ_id
#if categ:
#if categ.code=='SRV':
#line.delete()
#for vs in get_model("clinic.visit").search_browse([]):
#if vs.state=='pending':
#vs.confirm()
#print(vs.number)
#obj=self.browse(ids)[0]
#for hd_case in get_model("clinic.hd.case").search_browse([]):
#number='/'
#if hd_case.number=='/':
#number=get_model("clinic.hd.case")._get_number()
#if hd_case.state=='waiting_treatment':
#hd_case.complete()
#date,time=hd_case.time_start.split(" ")
#hd_case.write({
#'date': date,
#'number': number,
#})
#for inv in hd_case.invoices:
#inv.write({
#'date': date,
#'due_date': date,
#})
#for pick in hd_case.pickings:
#pick.write({
#'date': date,
#})
#for exp in get_model('clinic.hd.case.expense').search_browse([]):
#exp.write({
#'date': exp.hd_case_id.date,
#})
#print('done')
ClinicSetting.register()