[MERGE] merged the xrg branch with misc. patches

bzr revid: qdp-launchpad@tinyerp.com-20101216164012-u0t0m6iima8dybyj
This commit is contained in:
qdp-launchpad@tinyerp.com
2010-12-16 17:40:12 +01:00
4 changed files with 25 additions and 35 deletions
@@ -94,7 +94,7 @@ class account_entries_report(osv.osv):
return super(account_entries_report, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order,
context=context, count=count)
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None):
def read_group(self, cr, uid, domain, *args, **kwargs):
todel=[]
fiscalyear_obj = self.pool.get('account.fiscalyear')
period_obj = self.pool.get('account.period')
@@ -112,7 +112,7 @@ class account_entries_report(osv.osv):
for a in [['period_id','in','current_year'], ['period_id','in','current_period']]:
if a in domain:
domain.remove(a)
return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context)
return super(account_entries_report, self).read_group(cr, uid, domain, *args, **kwargs)
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_entries_report')
+12 -24
View File
@@ -131,32 +131,20 @@
</stylesheet>
<story>
<pto>
<pto_header>
<blockTable colWidths="202.0,87.0,71.0,57.0,42.0,71.0" style="Table7">
<tr>
<td>
<para style="terp_tblheader_Details">Description</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Taxes</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Quantity</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Unit Price </para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Disc.(%)</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Price</para>
</td>
</tr>
</blockTable>
</pto_header>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
<para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
<pto_header><!-- Must be after setLang() -->
<blockTable colWidths="202.0,87.0,71.0,57.0,42.0,71.0" style="Table7">
<tr>
<td> <para style="terp_tblheader_Details">Description</para> </td>
<td> <para style="terp_tblheader_Details_Centre">Taxes</para> </td>
<td> <para style="terp_tblheader_Details_Centre">Quantity</para> </td>
<td> <para style="terp_tblheader_Details_Right">Unit Price </para> </td>
<td> <para style="terp_tblheader_Details_Right">Disc.(%)</para> </td>
<td> <para style="terp_tblheader_Details_Right">Price</para> </td>
</tr>
</blockTable>
</pto_header>
<blockTable colWidths="297.0,233.0" style="Table_Partner_Address">
<tr>
<td>
@@ -55,14 +55,14 @@ class account_followup_stat(osv.osv):
return super(account_followup_stat, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order,
context=context, count=count)
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None):
def read_group(self, cr, uid, domain, *args, **kwargs):
for arg in domain:
if arg[0] == 'period_id' and arg[2] == 'current_year':
current_year = self.pool.get('account.fiscalyear').find(cr, uid)
ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
domain.append(['period_id','in',ids])
domain.remove(arg)
return super(account_followup_stat, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context)
return super(account_followup_stat, self).read_group(cr, uid, domain, *args, **kwargs)
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_followup_stat')
+9 -7
View File
@@ -21,6 +21,7 @@
from osv import fields, osv
import pooler
import tools
import logging
from service import security
import ldap
from ldap.filter import filter_format
@@ -66,9 +67,9 @@ class users(osv.osv):
_inherit = "res.users"
def login(self, db, login, password):
ret = super(users,self).login(db, login, password)
tools.debug(ret)
if ret:
return ret
logger = logging.getLogger('orm.ldap')
pool = pooler.get_pool(db)
cr = pooler.get_db(db).cursor()
action_obj = pool.get('ir.actions.actions')
@@ -78,7 +79,7 @@ class users(osv.osv):
FROM res_company_ldap
WHERE ldap_server != '' and ldap_binddn != '' ORDER BY sequence""")
for res_company_ldap in cr.dictfetchall():
tools.debug(res_company_ldap)
logger.debug(res_company_ldap)
try:
l = ldap.open(res_company_ldap['ldap_server'], res_company_ldap['ldap_server_port'])
if l.simple_bind_s(res_company_ldap['ldap_binddn'], res_company_ldap['ldap_password']):
@@ -93,13 +94,13 @@ class users(osv.osv):
continue
if result_type == ldap.RES_SEARCH_RESULT and len(result_data) == 1:
dn = result_data[0][0]
tools.debug(dn)
logger.debug(dn)
name = result_data[0][1]['cn'][0]
if l.bind_s(dn, password):
l.unbind()
cr.execute("SELECT id FROM res_users WHERE login=%s",(tools.ustr(login),))
res = cr.fetchone()
tools.debug(res)
logger.debug(res)
if res:
cr.close()
return res[0]
@@ -127,7 +128,7 @@ class users(osv.osv):
return res
l.unbind()
except Exception, e:
tools.debug(e)
logger.warning("Cannot auth", exc_info=True)
continue
cr.close()
return False
@@ -135,10 +136,11 @@ class users(osv.osv):
def check(self, db, uid, passwd):
try:
return super(users,self).check(db, uid, passwd)
except: # AccessDenied
except security.ExceptionNoTb: # AccessDenied
pass
cr = pooler.get_db(db).cursor()
user = self.browse(cr, 1, uid)
logger = logging.getLogger('orm.ldap')
if user and user.company_id.ldaps:
for res_company_ldap in user.company_id.ldaps:
try:
@@ -161,7 +163,7 @@ class users(osv.osv):
return True
l.unbind()
except Exception, e:
tools.debug(e)
logger.warning('cannot check', exc_info=True)
pass
cr.close()
raise security.ExceptionNoTb('AccessDenied')