parent
e531cce3fc
commit
cd8e9de724
|
@ -30,7 +30,7 @@ import addons
|
|||
class hr_employee_category(osv.osv):
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name','parent_id'], context)
|
||||
res = []
|
||||
|
|
|
@ -26,7 +26,7 @@ class hr_department(osv.osv):
|
|||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
|
||||
res = []
|
||||
|
|
|
@ -182,7 +182,7 @@ class hr_evaluation(osv.osv):
|
|||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.browse(cr, uid, ids, context=context)
|
||||
res = []
|
||||
|
@ -308,7 +308,7 @@ class hr_evaluation_interview(osv.osv):
|
|||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.browse(cr, uid, ids, context=context)
|
||||
res = []
|
||||
|
|
|
@ -219,7 +219,7 @@ class hr_expense_line(osv.osv):
|
|||
def _amount(self, cr, uid, ids, field_name, arg, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return {}
|
||||
cr.execute("SELECT l.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_line l WHERE id IN %s GROUP BY l.id ",(tuple(ids),))
|
||||
res = dict(cr.fetchall())
|
||||
|
|
|
@ -235,10 +235,11 @@ class hr_holidays(osv.osv):
|
|||
return diff_day
|
||||
|
||||
def _update_user_holidays(self, cr, uid, ids):
|
||||
obj_crm_meeting = self.pool.get('crm.meeting')
|
||||
for record in self.browse(cr, uid, ids):
|
||||
if record.state=='validate':
|
||||
if record.case_id:
|
||||
self.pool.get('crm.meeting').unlink(cr, uid, [record.case_id.id])
|
||||
obj_crm_meeting.unlink(cr, uid, [record.case_id.id])
|
||||
if record.linked_request_ids:
|
||||
list_ids = [ lr.id for lr in record.linked_request_ids]
|
||||
self.holidays_cancel(cr, uid, list_ids)
|
||||
|
@ -358,6 +359,7 @@ class hr_holidays(osv.osv):
|
|||
return True
|
||||
|
||||
def holidays_confirm(self, cr, uid, ids, *args):
|
||||
obj_hr_holiday_status = self.pool.get('hr.holidays.status')
|
||||
for record in self.browse(cr, uid, ids):
|
||||
user_id = False
|
||||
leave_asked = record.number_of_days_temp
|
||||
|
@ -369,7 +371,7 @@ class hr_holidays(osv.osv):
|
|||
nb = -(record.number_of_days_temp)
|
||||
elif record.holiday_type == 'category' and record.type == 'remove':
|
||||
if record.category_id and not record.holiday_status_id.limit:
|
||||
leaves_rest = self.pool.get('hr.holidays.status').get_days_cat( cr, uid, [record.holiday_status_id.id], record.category_id.id, False)[record.holiday_status_id.id]['remaining_leaves']
|
||||
leaves_rest = obj_hr_holiday_status.get_days_cat( cr, uid, [record.holiday_status_id.id], record.category_id.id, False)[record.holiday_status_id.id]['remaining_leaves']
|
||||
if leaves_rest < leave_asked:
|
||||
raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for %s while available leaves are less than asked leaves.' %(record.category_id.name)))
|
||||
nb = -(record.number_of_days_temp)
|
||||
|
|
|
@ -24,6 +24,7 @@ import time
|
|||
from datetime import date
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
import datetime
|
||||
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
|
@ -1090,7 +1091,6 @@ class hr_payslip(osv.osv):
|
|||
#Check for the Holidays
|
||||
def get_days(start, end, month, year, calc_day):
|
||||
count = 0
|
||||
import datetime
|
||||
for day in range(start, end):
|
||||
if datetime.date(year, month, day).weekday() == calc_day:
|
||||
count += 1
|
||||
|
|
|
@ -51,7 +51,7 @@ class payslip_report(report_sxw.rml_parse):
|
|||
for id in range(len(obj)):
|
||||
if obj[id].category_id.type in ('advance', 'loan', 'otherpay', 'otherdeduct', 'installment'):
|
||||
ids.append(obj[id].id)
|
||||
if len(ids):
|
||||
if ids:
|
||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
|
||||
|
@ -62,7 +62,7 @@ class payslip_report(report_sxw.rml_parse):
|
|||
for id in range(len(obj)):
|
||||
if obj[id].type == 'leaves':
|
||||
ids.append(obj[id].id)
|
||||
if len(ids):
|
||||
if ids:
|
||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
|
||||
|
@ -73,7 +73,7 @@ class payslip_report(report_sxw.rml_parse):
|
|||
for id in range(len(obj)):
|
||||
if obj[id].category_id.type == 'allowance' and obj[id].type != 'leaves':
|
||||
ids.append(obj[id].id)
|
||||
if len(ids):
|
||||
if ids:
|
||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
|
||||
|
@ -84,7 +84,7 @@ class payslip_report(report_sxw.rml_parse):
|
|||
for id in range(len(obj)):
|
||||
if obj[id].category_id.type == 'deduction' and obj[id].type != 'leaves':
|
||||
ids.append(obj[id].id)
|
||||
if len(ids):
|
||||
if ids:
|
||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ class rml_parse(report_sxw.rml_parse):
|
|||
head_dom = etree.XML(rml_head)
|
||||
for tag in head_dom:
|
||||
found = rml_dom.find('.//'+tag.tag)
|
||||
if found is not None and len(found):
|
||||
if found is not None and found:
|
||||
if tag.get('position'):
|
||||
found.append(tag)
|
||||
else:
|
||||
|
|
|
@ -128,14 +128,14 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
|||
|
||||
def _sum_debit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id =ANY(%s) AND date>=%s AND date<=%s AND amount>0", (ids,date1, date2))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id =ANY(%s) AND date>=%s AND date<=%s AND amount<0", (ids, date1, date2))
|
||||
|
@ -148,7 +148,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
|||
|
||||
def _sum_qty(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line WHERE account_id =ANY(%s) AND date>=%s AND date<=%s", (ids,date1, date2))
|
||||
|
@ -156,7 +156,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
|||
|
||||
def _sum_revenue(self, accounts):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
res = 0.0
|
||||
for id in ids:
|
||||
|
|
Loading…
Reference in New Issue