runing number

conv_bal
watcha.h 2014-10-02 08:12:46 +07:00
parent c9c7944981
commit fb9633027f
9 changed files with 41 additions and 43 deletions

View File

@ -2,7 +2,7 @@
<field name="string">HD Cases</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.hd.case</field>
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Confirm",[["state","=","corfirmed"]]],["Approved",[["state","=","approved"]]],["Validated",[["state","=","validated"]]],["Paid",[["state","=","paid"]]],["Cancelled",[["state","=","cancelled"]]]]</field>
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Confirmed",[["state","=","confirmed"]]],["Approved",[["state","=","approved"]]],["Validated",[["state","=","validated"]]],["Paid",[["state","=","paid"]]],["Cancelled",[["state","=","cancelled"]]]]</field>
<field name="modes">list,form</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -9,8 +9,8 @@
<tab string="General">
<group span="6" columns="1">
<field name="type" required="1"/>
<field name="name"/>
<field name="number"/>
<field name="name"/>
<field name="identification"/>
<field name="expiry_card"/>
<field name="department_id"/>

View File

@ -1,4 +1,4 @@
<form model="clinic.hd.case" attrs='{"readonly":[["state","in",["cancelled","approved","validated"]]]}' show_company="1">
<form model="clinic.hd.case" attrs='{"readonly":[["state","in",["cancelled","validated"]]]}' show_company="1">
<head>
<field name="state"/>
<button string="Options" dropdown="1">

View File

@ -10,8 +10,8 @@
<item string="Reports">
<item string="Report1" action="report1"/>
</item>
<item string="Import Data">
<item string="Report1" action="report1"/>
<item string="Config/Import">
<item string="Account (TB, Unpaid AP and AR)" action="report1"/>
</item>
<item string="Settings">
<item string="Dialyzer" action="clinic_dialyzer"/>
@ -20,8 +20,8 @@
<item string="Nationalities" action="clinic_nation"/>
<item string="Races" action="clinic_race"/>
<item string="Cause Chronics" action="clinic_cause_chronic"/>
<item string="Comorbidity" action="clinic_comorbidity"/>
<item string="Morbidity" action="clinic_morbidity"/>
<item string="Clinic Setting" action="clinic_setting"/>
<item string="Comorbidities" action="clinic_comorbidity"/>
<item string="Morbidities" action="clinic_morbidity"/>
<item string="Clinic Settings" action="clinic_setting"/>
</item>
</menu>

View File

@ -9,8 +9,8 @@
<tab string="General">
<group span="6" columns="1">
<field name="type" required="1"/>
<field name="name"/>
<field name="number"/>
<field name="name"/>
<field name="identification"/>
<field name="expiry_card"/>
<field name="department_id"/>

View File

@ -1,7 +1,7 @@
import time
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company
from netforce.access import get_active_company, get_active_user, set_active_user
class Doctor(Model):
_name="clinic.doctor"
@ -24,7 +24,7 @@ class Doctor(Model):
"number": fields.Char("Doctor No.",required=True,search=True),
"name": fields.Char("Name",required=True,search=True),
"identification" : fields.Char("Identification"),
"expiry_card" : fields.Date("Expiry Card"),
"expiry_card" : fields.Date("Card Expiry"),
"birthday": fields.Date("Birthday",search=True),
"age": fields.Integer("Age", function="_get_age"),
"type": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"Type"),
@ -45,15 +45,20 @@ class Doctor(Model):
'picture': fields.File("Picture"),
}
def _get_number(self,context={}):
while 1:
num=get_model("sequence").get_number("sale_order")
seq_id=get_model("sequence").find_sequence(name="Clinic Doctor")
num=get_model("sequence").get_next_number(seq_id,context=context)
if not num:
return None
user_id=get_active_user()
set_active_user(1)
res=self.search([["number","=",num]])
set_active_user(user_id)
if not res:
return num
get_model("sequence").increment("sale_order")
get_model("sequence").increment_number(seq_id,context=context)
_defaults={
@ -69,5 +74,4 @@ class Doctor(Model):
obj=self.browse(ids)[0]
obj.write({"state":"voided"})
Doctor.register()

View File

@ -41,13 +41,17 @@ class HDcase(Model):
def _get_number(self,context={}):
while 1:
num=get_model("sequence").get_number("sale_order")
seq_id=get_model("sequence").find_sequence(name="Clinic HD Case")
num=get_model("sequence").get_next_number(seq_id,context=context)
if not num:
return None
user_id=get_active_user()
set_active_user(1)
res=self.search([["number","=",num]])
set_active_user(user_id)
if not res:
return num
get_model("sequence").increment("sale_order")
get_model("sequence").increment_number(seq_id,context=context)
def _get_nurse(self,context={}):
user_id=get_active_user()

View File

@ -1,7 +1,7 @@
import time
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company
from netforce.access import get_active_company, get_active_user, set_active_user
class Nurse(Model):
_name="clinic.nurse"
@ -21,10 +21,10 @@ class Nurse(Model):
return res
_fields={
"number": fields.Char("Doctor No.",required=True,search=True),
"number": fields.Char("Nurse No.",required=True,search=True),
"name": fields.Char("Name",required=True,search=True),
"identification" : fields.Char("Identification"),
"expiry_card" : fields.Date("Expiry Card"),
"expiry_card" : fields.Date("Card Expiry"),
"birthday": fields.Date("Birthday",search=True),
"age": fields.Integer("Age", function="_get_age"),
"type": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"Type"),
@ -47,13 +47,17 @@ class Nurse(Model):
def _get_number(self,context={}):
while 1:
num=get_model("sequence").get_number("sale_order")
seq_id=get_model("sequence").find_sequence(name="Clinic Nurse")
num=get_model("sequence").get_next_number(seq_id,context=context)
if not num:
return None
user_id=get_active_user()
set_active_user(1)
res=self.search([["number","=",num]])
set_active_user(user_id)
if not res:
return num
get_model("sequence").increment("sale_order")
get_model("sequence").increment_number(seq_id,context=context)
_defaults={

View File

@ -1,7 +1,7 @@
import time
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company
from netforce.access import get_active_company, get_active_user, set_active_user
class Patient(Model):
_name="clinic.patient"
@ -36,7 +36,7 @@ class Patient(Model):
"height": fields.Float("Height (Kg)"),
"card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"Card Type",required=True),
'card_no' : fields.Char("Card No."),
'card_exp' : fields.Date("Card Expire"),
'card_exp' : fields.Date("Card Expiry"),
"app_no": fields.Char("Application No."),
"salary": fields.Selection([["20000","5,001-20,000"],["50000","20,001-50,000"],["100000","50,001-100,000"],["100001","100,000+"]], "Salary"),
"addresses": fields.One2Many("address","related_id","Addresses"),
@ -59,12 +59,8 @@ class Patient(Model):
"who_transplantation": fields.Char("Who is Transplantation?"),
"reason_of_chronic_renal_failure": fields.Char("Reason chronic renal failure ?"),
'cause_lines': fields.One2Many("clinic.patient.cause.line","patient_id","Cause Line"),
#Co-marbid
#"comarbid" : fields.char("Co-morbid Other"),
'comorbility_lines': fields.One2Many("clinic.patient.comorbidity.line","patient_id","Comorbility"),
#Morbidity
'morbility_lines': fields.One2Many("clinic.patient.morbidity.line","patient_id","Morbility"),
#Healthcare
"comments": fields.One2Many("message","related_id","Comments"),
"company_id": fields.Many2One("company","Company"),
"visits": fields.One2Many("clinic.visit","patient_id","Visits"),
@ -72,28 +68,18 @@ class Patient(Model):
}
def _get_number(self,context={}):
seq_name="clinic_patient"
seq_id=get_model("sequence").find_sequence(name=seq_name)
if not seq_id:
raise Exception("Sequence not found: '%s'"%seq_name)
while 1:
num=get_model("sequence").get_next_number(seq_id)
if not num:
return None
get_model("sequence").increment_number(seq_id)
return num
return
#XXXX
while 1:
num=get_model("sequence").get_number("clinic_patient")
seq_id=get_model("sequence").find_sequence(name="Clinic Patient")
num=get_model("sequence").get_next_number(seq_id,context=context)
if not num:
return None
user_id=get_active_user()
set_active_user(1)
res=self.search([["number","=",num]])
set_active_user(user_id)
if not res:
return num
get_model("sequence").increment("clinic_patient")
get_model("sequence").increment_number(seq_id,context=context)
_defaults={
"type": "mg",