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="string">HD Cases</field>
<field name="view_cls">multi_view</field> <field name="view_cls">multi_view</field>
<field name="model">clinic.hd.case</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="modes">list,form</field>
<field name="menu">clinic_menu</field> <field name="menu">clinic_menu</field>
</action> </action>

View File

@ -9,8 +9,8 @@
<tab string="General"> <tab string="General">
<group span="6" columns="1"> <group span="6" columns="1">
<field name="type" required="1"/> <field name="type" required="1"/>
<field name="name"/>
<field name="number"/> <field name="number"/>
<field name="name"/>
<field name="identification"/> <field name="identification"/>
<field name="expiry_card"/> <field name="expiry_card"/>
<field name="department_id"/> <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> <head>
<field name="state"/> <field name="state"/>
<button string="Options" dropdown="1"> <button string="Options" dropdown="1">

View File

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

View File

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

View File

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

View File

@ -41,13 +41,17 @@ class HDcase(Model):
def _get_number(self,context={}): def _get_number(self,context={}):
while 1: 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: if not num:
return None return None
user_id=get_active_user()
set_active_user(1)
res=self.search([["number","=",num]]) res=self.search([["number","=",num]])
set_active_user(user_id)
if not res: if not res:
return num return num
get_model("sequence").increment("sale_order") get_model("sequence").increment_number(seq_id,context=context)
def _get_nurse(self,context={}): def _get_nurse(self,context={}):
user_id=get_active_user() user_id=get_active_user()

View File

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

View File

@ -1,7 +1,7 @@
import time import time
from netforce.model import Model, fields, get_model 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): class Patient(Model):
_name="clinic.patient" _name="clinic.patient"
@ -36,7 +36,7 @@ class Patient(Model):
"height": fields.Float("Height (Kg)"), "height": fields.Float("Height (Kg)"),
"card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"Card Type",required=True), "card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"Card Type",required=True),
'card_no' : fields.Char("Card No."), 'card_no' : fields.Char("Card No."),
'card_exp' : fields.Date("Card Expire"), 'card_exp' : fields.Date("Card Expiry"),
"app_no": fields.Char("Application No."), "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"), "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"), "addresses": fields.One2Many("address","related_id","Addresses"),
@ -59,12 +59,8 @@ class Patient(Model):
"who_transplantation": fields.Char("Who is Transplantation?"), "who_transplantation": fields.Char("Who is Transplantation?"),
"reason_of_chronic_renal_failure": fields.Char("Reason chronic renal failure ?"), "reason_of_chronic_renal_failure": fields.Char("Reason chronic renal failure ?"),
'cause_lines': fields.One2Many("clinic.patient.cause.line","patient_id","Cause Line"), '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"), 'comorbility_lines': fields.One2Many("clinic.patient.comorbidity.line","patient_id","Comorbility"),
#Morbidity
'morbility_lines': fields.One2Many("clinic.patient.morbidity.line","patient_id","Morbility"), 'morbility_lines': fields.One2Many("clinic.patient.morbidity.line","patient_id","Morbility"),
#Healthcare
"comments": fields.One2Many("message","related_id","Comments"), "comments": fields.One2Many("message","related_id","Comments"),
"company_id": fields.Many2One("company","Company"), "company_id": fields.Many2One("company","Company"),
"visits": fields.One2Many("clinic.visit","patient_id","Visits"), "visits": fields.One2Many("clinic.visit","patient_id","Visits"),
@ -72,28 +68,18 @@ class Patient(Model):
} }
def _get_number(self,context={}): 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: while 1:
num=get_model("sequence").get_next_number(seq_id) seq_id=get_model("sequence").find_sequence(name="Clinic Patient")
if not num: num=get_model("sequence").get_next_number(seq_id,context=context)
return None
get_model("sequence").increment_number(seq_id)
return num
return
#XXXX
while 1:
num=get_model("sequence").get_number("clinic_patient")
if not num: if not num:
return None return None
user_id=get_active_user()
set_active_user(1)
res=self.search([["number","=",num]]) res=self.search([["number","=",num]])
set_active_user(user_id)
if not res: if not res:
return num return num
get_model("sequence").increment("clinic_patient") get_model("sequence").increment_number(seq_id,context=context)
_defaults={ _defaults={
"type": "mg", "type": "mg",