[MERGE]
bzr revid: christophe@tinyerp.com-20081211135314-we2wn2cexqsd3jw5
This commit is contained in:
commit
3767640049
|
@ -35,6 +35,7 @@
|
|||
<rng:optional><rng:attribute name="toolbar"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="position"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="link"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="type"/></rng:optional>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:ref name="field"/>
|
||||
|
@ -213,6 +214,7 @@
|
|||
<rng:optional><rng:attribute name="readonly"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="view_mode"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="widget"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="comparator"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="context"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="groups"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="states"/></rng:optional>
|
||||
|
@ -229,6 +231,7 @@
|
|||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:ref name="form"/>
|
||||
<rng:ref name="calendar"/>
|
||||
<rng:ref name="tree"/>
|
||||
<rng:ref name="field"/>
|
||||
<rng:ref name="label"/>
|
||||
|
@ -236,6 +239,7 @@
|
|||
<rng:ref name="xpath"/>
|
||||
<rng:ref name="button"/>
|
||||
<rng:ref name="group"/>
|
||||
<rng:ref name="graph"/>
|
||||
<rng:element name="newline"><rng:empty/></rng:element>
|
||||
</rng:choice>
|
||||
</rng:zeroOrMore>
|
||||
|
@ -277,6 +281,7 @@
|
|||
<rng:optional><rng:attribute name="date_stop" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="day_length" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="date_delay" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="type" /></rng:optional>
|
||||
<rng:oneOrMore>
|
||||
<rng:ref name="field"/>
|
||||
</rng:oneOrMore>
|
||||
|
|
|
@ -35,6 +35,16 @@ def login(db, login, password):
|
|||
else:
|
||||
return False
|
||||
|
||||
def logout(db, login, password):
|
||||
cr = pooler.get_db(db).cursor()
|
||||
cr.execute('select login from res_users where id=%d'%(login))
|
||||
res = cr.fetchone()
|
||||
cr.close()
|
||||
if res:
|
||||
return res[0]
|
||||
else:
|
||||
return False
|
||||
|
||||
def check_super(passwd):
|
||||
if passwd == tools.config['admin_passwd']:
|
||||
return True
|
||||
|
|
|
@ -282,6 +282,7 @@ class common(netsvc.Service):
|
|||
self.exportMethod(self.ir_del)
|
||||
self.exportMethod(self.about)
|
||||
self.exportMethod(self.login)
|
||||
self.exportMethod(self.logout)
|
||||
self.exportMethod(self.timezone_get)
|
||||
|
||||
def ir_set(self, db, uid, password, keys, args, name, value, replace=True, isobject=False):
|
||||
|
@ -316,8 +317,29 @@ class common(netsvc.Service):
|
|||
res = security.login(db, login, password)
|
||||
logger = netsvc.Logger()
|
||||
msg = res and 'successful login' or 'bad login or password'
|
||||
logger.notifyChannel("web-services", netsvc.LOG_INFO, "%s from '%s' using database '%s'" % (msg, login, db.lower()))
|
||||
logger.notifyChannel("web-service", netsvc.LOG_INFO, "%s from '%s' using database '%s'" % (msg, login, db.lower()))
|
||||
return res or False
|
||||
|
||||
def logout(self, db, login, password):
|
||||
res = security.logout(db, login, password)
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
fields = service.execute(db, login, 'res.users', 'fields_get', {})
|
||||
try:
|
||||
if 'current_status' in fields.keys():
|
||||
service.execute(db, login, 'res.users', 'write', login, {'current_status':False})
|
||||
emp_id = service.execute(db, login, 'hr.employee', 'search',[('user_id','=',login)])
|
||||
emp = emp_id[0]
|
||||
service.execute(db, login, 'hr.attendance', 'create',{'action':'sign_out','employee_id':emp})
|
||||
cr = pooler.get_db(db).cursor()
|
||||
cr.execute("delete from time_sheet_remote_temp where user_id = '%s'"%(res))
|
||||
cr.commit()
|
||||
cr.close()
|
||||
except:
|
||||
pass
|
||||
logger = netsvc.Logger()
|
||||
logger.notifyChannel("web-service", netsvc.LOG_INFO,'Logout=>%s from database %s'%(res,db.lower()))
|
||||
|
||||
|
||||
|
||||
def about(self, extended=False):
|
||||
"""Return information about the OpenERP Server.
|
||||
|
|
Loading…
Reference in New Issue