diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 0f499c43ddd..9613c2376fa 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -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 = [] @@ -167,9 +167,9 @@ class hr_employee(osv.osv): 'passport_id':fields.char('Passport', size=64) } - def onchange_company(self, cr, uid, ids, company, context=None): + def onchange_company(self, cr, uid, ids, company, context=None): address_id = False - if company: + if company: company_id = self.pool.get('res.company').browse(cr,uid,company) address = self.pool.get('res.partner').address_get(cr, uid, [company_id.partner_id.id], ['default']) address_id = address and address['default'] or False diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py index ec6f276e670..8e1d11716c2 100644 --- a/addons/hr/hr_department.py +++ b/addons/hr/hr_department.py @@ -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 = [] diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 969637fcd0d..c51406f19de 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -136,7 +136,7 @@ class hr_employee(osv.osv): warning_sign = 'sign' res = {} - #Special case when button calls this method :type=context + #Special case when button calls this method: type=context if isinstance(type, dict): type = type.get('type','action') if type == 'sign_in': diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index 9de7379d962..418bfeddba5 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -76,10 +76,10 @@ class hr_evaluation_plan_phase(osv.osv): 'email_subject':fields.text('char') } _defaults = { - 'sequence' : 1, + 'sequence': 1, 'email_subject': _('''Regarding '''), - 'mail_body' : lambda *a:_(''' -Date : %(date)s + 'mail_body': lambda *a:_(''' +Date: %(date)s Dear %(employee_name)s, @@ -111,8 +111,8 @@ class hr_employee(osv.osv): for id in self.browse(cr, uid, self.search(cr, uid, [], context=context), context=context): if id.evaluation_plan_id and id.evaluation_date: if (parser.parse(id.evaluation_date) + relativedelta(months = int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"): - self.write(cr, uid, id.id, {'evaluation_date' : (parser.parse(id.evaluation_date) + relativedelta(months =+ int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d')}, context=context) - obj_evaluation.create(cr, uid, {'employee_id' : id.id, 'plan_id': id.evaluation_plan_id}, context=context) + self.write(cr, uid, id.id, {'evaluation_date': (parser.parse(id.evaluation_date) + relativedelta(months =+ int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d')}, context=context) + obj_evaluation.create(cr, uid, {'employee_id': id.id, 'plan_id': id.evaluation_plan_id}, context=context) return True def onchange_evaluation_plan_id(self, cr, uid, ids, evaluation_plan_id, evaluation_date, context=None): @@ -139,7 +139,7 @@ class hr_employee(osv.osv): context = {} id = super(hr_employee, self).create(cr, uid, vals, context=context) if vals.get('evaluation_plan_id', False): - self.pool.get('hr_evaluation.evaluation').create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']}, context=context) + self.pool.get('hr_evaluation.evaluation').create(cr, uid, {'employee_id': id, 'plan_id': vals['evaluation_plan_id']}, context=context) return id hr_employee() @@ -172,17 +172,17 @@ class hr_evaluation(osv.osv): ('cancel','Cancelled'), ], 'State', required=True, readonly=True), 'date_close': fields.date('Ending Date'), - 'progress' : fields.float("Progress"), + 'progress': fields.float("Progress"), } _defaults = { - 'date' : lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'), - 'state' : lambda *a: 'draft', + 'date': lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'), + 'state': lambda *a: 'draft', } 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 = [] @@ -249,7 +249,7 @@ class hr_evaluation(osv.osv): if context is None: context = {} self.write(cr, uid, ids, {'state':'progress'}, context=context) - for id in self.browse(cr, uid ,ids, context=context): + for id in self.browse(cr, uid, ids, context=context): if len(id.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', id.id),('state', '=', 'done')], context=context)): raise osv.except_osv(_('Warning !'),_("You cannot change state, because some appraisal in waiting answer or draft state")) return True @@ -266,7 +266,7 @@ class hr_evaluation(osv.osv): context = {} self.write(cr, uid, ids,{'state':'cancel'}, context=context) return True - + def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} @@ -277,7 +277,7 @@ class hr_evaluation(osv.osv): for survey_req in evalutation.survey_request_ids: obj_hr_eval_iterview.write(cr, uid, [survey_req.id], new_vals, context=context) return super(hr_evaluation, self).write(cr, uid, ids, vals, context=context) - + hr_evaluation() class survey_request(osv.osv): @@ -304,11 +304,11 @@ class hr_evaluation_interview(osv.osv): _defaults = { 'is_evaluation': True, } - + 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 = [] @@ -316,11 +316,11 @@ class hr_evaluation_interview(osv.osv): name = record.request_id.survey_id.title res.append((record['id'], name)) return res - + def survey_req_waiting_answer(self, cr, uid, ids, context=None): if context is None: context = {} - self.write(cr, uid, ids, { 'state' : 'waiting_answer'}, context=context) + self.write(cr, uid, ids, { 'state': 'waiting_answer'}, context=context) return True def survey_req_done(self, cr, uid, ids, context=None): @@ -335,12 +335,12 @@ class hr_evaluation_interview(osv.osv): raise osv.except_osv(_('Warning !'),_("You cannot start evaluation without Evaluation.")) records = hr_eval_obj.browse(cr, uid, [id.evaluation_id.id], context=context)[0].survey_request_ids for child in records: - if child.state == "draft" : + if child.state == "draft": wating_id = child.id continue if child.state != "done": flag = True - else : + else: tot_done_req += 1 if not flag and wating_id: self.survey_req_waiting_answer(cr, uid, [wating_id], context=context) @@ -369,7 +369,7 @@ class hr_evaluation_interview(osv.osv): @param uid: the current user’s ID for security checks, @param ids: List of Survey IDs @param context: A standard dictionary for contextual values - @return : Dictionary value for print survey form. + @return: Dictionary value for print survey form. """ if not context: context = {} diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index eb79dc5c52d..e7cff7c6a2f 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -90,10 +90,10 @@ class hr_expense_expense(osv.osv): \nIf the admin accepts it, the state is \'Accepted\'.\n If an invoice is made for the expense request, the state is \'Invoiced\'.\n If the expense is paid to user, the state is \'Reimbursed\'.'), } _defaults = { - 'date' : time.strftime('%Y-%m-%d'), + 'date': time.strftime('%Y-%m-%d'), 'state': 'draft', - 'employee_id' : _employee_get, - 'user_id' : lambda cr, uid, id, c={}: id, + 'employee_id': _employee_get, + 'user_id': lambda cr, uid, id, c={}: id, 'currency_id': _get_currency, 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, } @@ -102,7 +102,7 @@ class hr_expense_expense(osv.osv): department_id = False if employee_id: department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id).department_id.id or False - return {'value':{'department_id':department_id}} + return {'value':{'department_id':department_id}} def expense_confirm(self, cr, uid, ids, *args): self.write(cr, uid, ids, { @@ -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()) @@ -237,7 +237,7 @@ class hr_expense_line(osv.osv): 'description': fields.text('Description'), 'analytic_account': fields.many2one('account.analytic.account','Analytic account'), 'ref': fields.char('Reference', size=32), - 'sequence' : fields.integer('Sequence', help="Gives the sequence order when displaying a list of expense lines."), + 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of expense lines."), } _defaults = { 'unit_quantity': 1, diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 79710a569fb..e8ddc1249a8 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -147,8 +147,8 @@ class hr_holidays(osv.osv): 'date_from': fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}), 'user_id':fields.many2one('res.users', 'User', states={'draft':[('readonly',False)]}, select=True, readonly=True), 'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}), - 'holiday_status_id' : fields.many2one("hr.holidays.status", " Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}), - 'employee_id' : fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'), + 'holiday_status_id': fields.many2one("hr.holidays.status", " Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}), + 'employee_id': fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'), #'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'), #'notes': fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}), 'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'), @@ -167,7 +167,7 @@ class hr_holidays(osv.osv): } _defaults = { - 'employee_id': _employee_get , + 'employee_id': _employee_get, 'state': 'draft', 'type': 'remove', 'allocation_type': 'employee', @@ -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) @@ -424,12 +426,12 @@ class hr_holidays(osv.osv): else:# This condition will never meet!! holiday_ids = [] vals = { - 'name' : record.name, - 'holiday_status_id' : record.holiday_status_id.id, + 'name': record.name, + 'holiday_status_id': record.holiday_status_id.id, 'state': 'draft', - 'date_from' : record.date_from, - 'date_to' : record.date_to, - 'notes' : record.notes, + 'date_from': record.date_from, + 'date_to': record.date_to, + 'notes': record.notes, 'number_of_days': record.number_of_days, 'number_of_days_temp': record.number_of_days_temp, 'type': record.type, @@ -449,12 +451,12 @@ class hr_holidays(osv.osv): if record.holiday_status_id.categ_id and record.date_from and record.date_to and record.employee_id: diff_day = self._get_number_of_days(record.date_from, record.date_to) vals = { - 'name' : record.name, - 'categ_id' : record.holiday_status_id.categ_id.id, - 'duration' : (diff_day) * 8, - 'note' : record.notes, - 'user_id' : record.user_id.id, - 'date' : record.date_from, + 'name': record.name, + 'categ_id': record.holiday_status_id.categ_id.id, + 'duration': (diff_day) * 8, + 'note': record.notes, + 'user_id': record.user_id.id, + 'date': record.date_from, } case_id = meeting_obj.create(cr, uid, vals) self.write(cr, uid, ids, {'case_id': case_id}) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 21bb1fdad60..c93d0df83a0 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -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 @@ -52,7 +53,7 @@ class hr_contract_wage_type(osv.osv): _inherit = 'hr.contract.wage.type' _columns = { - 'type' : fields.selection([('basic','Basic'), ('gross','Gross'), ('net','Net')], 'Type', required=True), + 'type': fields.selection([('basic','Basic'), ('gross','Gross'), ('net','Net')], 'Type', required=True), } hr_contract_wage_type() @@ -178,7 +179,7 @@ class hr_contract(osv.osv): exp = line.category_id.condition calculate = eval(exp, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) if not calculate: continue @@ -193,7 +194,7 @@ class hr_contract(osv.osv): #Please have a look at the configuration guide. amt = eval(base, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) if sal_type in ('gross', 'net'): if line.amount_type == 'per': @@ -231,7 +232,7 @@ class hr_contract(osv.osv): per = (all_per - ded_per) else: per = all_per - if per <=0 : + if per <=0: per *= -1 final = (per * 100) + 100 basic = (sal * 100) / final @@ -283,7 +284,7 @@ class hr_contract(osv.osv): try: amount = line.amount * eval(str(line.category_id.base), obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) elif line.amount_type in ('fix', 'func'): amount = line.amount cd = line.category_id.code.lower() @@ -313,11 +314,11 @@ class hr_contract(osv.osv): _inherit = 'hr.contract' _description = 'Employee Contract' _columns = { - 'permit_no':fields.char('Work Permit No', size=256, required=False, readonly=False), - 'passport_id':fields.many2one('hr.passport', 'Passport', required=False), - 'visa_no':fields.char('Visa No', size=64, required=False, readonly=False), + 'permit_no': fields.char('Work Permit No', size=256, required=False, readonly=False), + 'passport_id': fields.many2one('hr.passport', 'Passport', required=False), + 'visa_no': fields.char('Visa No', size=64, required=False, readonly=False), 'visa_expire': fields.date('Visa Expire Date'), - 'struct_id' : fields.many2one('hr.payroll.structure', 'Salary Structure'), + 'struct_id': fields.many2one('hr.payroll.structure', 'Salary Structure'), 'working_days_per_week': fields.integer('Working Days', help="No of Working days / week for an employee"), 'basic': fields.function(_calculate_salary, method=True, store=True, multi='dc', type='float', string='Basic Salary', digits=(14,2)), 'gross': fields.function(_calculate_salary, method=True, store=True, multi='dc', type='float', string='Gross Salary', digits=(14,2)), @@ -859,7 +860,7 @@ class hr_payslip(osv.osv): try: amount = line.amount * eval(str(line.category_id.base), obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) elif line.amount_type in ('fix', 'func'): amount = line.amount cd = line.category_id.code.lower() @@ -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 @@ -1157,7 +1157,7 @@ class hr_payslip(osv.osv): exp = line.category_id.condition calculate = eval(exp, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) if not calculate: continue @@ -1172,7 +1172,7 @@ class hr_payslip(osv.osv): #Please have a look at the configuration guide. amt = eval(base, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) if sal_type in ('gross', 'net'): if line.amount_type == 'per': @@ -1218,7 +1218,7 @@ class hr_payslip(osv.osv): per = (all_per - ded_per) else: per = all_per - if per <=0 : + if per <=0: per *= -1 final = (per * 100) + 100 basic = (sal * 100) / final @@ -1459,7 +1459,7 @@ class hr_employee(osv.osv): try: amt = eval(base, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) amount = 0.0 if line.amount_type == 'per': amount = amt * line.amount diff --git a/addons/hr_payroll/report/report_employees_detail.py b/addons/hr_payroll/report/report_employees_detail.py index a71fda1492c..6b6f83a6257 100644 --- a/addons/hr_payroll/report/report_employees_detail.py +++ b/addons/hr_payroll/report/report_employees_detail.py @@ -36,15 +36,15 @@ class employees_salary_report(rml_parse.rml_parse): super(employees_salary_report, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, - 'get_employee' : self.get_employee, - 'get_employee_detail' : self.get_employee_detail, - 'cal_monthly_amt':self.cal_monthly_amt, - 'get_periods' : self.get_periods, - 'get_total' : self.get_total, - 'get_allow':self.get_allow, - 'get_deduct':self.get_deduct, - 'get_other':self.get_other, - 'get_monthly_total':self.get_monthly_total, + 'get_employee': self.get_employee, + 'get_employee_detail': self.get_employee_detail, + 'cal_monthly_amt': self.cal_monthly_amt, + 'get_periods': self.get_periods, + 'get_total': self.get_total, + 'get_allow': self.get_allow, + 'get_deduct': self.get_deduct, + 'get_other': self.get_other, + 'get_monthly_total': self.get_monthly_total, }) self.mnths =[] diff --git a/addons/hr_payroll/report/report_payroll_advice.py b/addons/hr_payroll/report/report_payroll_advice.py index ec79d2a85e1..71955a9330f 100644 --- a/addons/hr_payroll/report/report_payroll_advice.py +++ b/addons/hr_payroll/report/report_payroll_advice.py @@ -36,16 +36,16 @@ class payroll_advice_report(report_sxw.rml_parse): self.total_bysal = 0.00 self.localcontext.update({ 'time': time, - 'get_month' : self.get_month, - 'convert' : self.convert, - 'get_detail' : self.get_detail, - 'get_total' : self.get_total, - 'get_bysal_total' : self.get_bysal_total, + 'get_month': self.get_month, + 'convert': self.convert, + 'get_detail': self.get_detail, + 'get_total': self.get_total, + 'get_bysal_total': self.get_bysal_total, }) def get_month(self,input_date): res = { - 'mname':'' + 'mname': '' } date = datetime.strptime(input_date, '%Y-%m-%d') res['mname']= date.strftime('%B')+'-'+date.strftime('%Y') diff --git a/addons/hr_payroll/report/report_payslip.py b/addons/hr_payroll/report/report_payslip.py index 3d6a4fc550a..d2804a764de 100755 --- a/addons/hr_payroll/report/report_payslip.py +++ b/addons/hr_payroll/report/report_payslip.py @@ -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 diff --git a/addons/hr_payroll/report/report_year_salary.py b/addons/hr_payroll/report/report_year_salary.py index f084eb2d340..b1f11b417fc 100755 --- a/addons/hr_payroll/report/report_year_salary.py +++ b/addons/hr_payroll/report/report_year_salary.py @@ -34,10 +34,10 @@ class year_salary_report(rml_parse.rml_parse): super(year_salary_report, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, - 'get_employee' : self.get_employee, - 'get_periods' : self.get_periods, - 'get_months_tol' : self.get_months_tol, - 'get_total' : self.get_total, + 'get_employee': self.get_employee, + 'get_periods': self.get_periods, + 'get_months_tol': self.get_months_tol, + 'get_total': self.get_total, }) self.mnths =[] diff --git a/addons/hr_payroll/report/rml_parse.py b/addons/hr_payroll/report/rml_parse.py index 21fbda2f774..b74a62e955d 100755 --- a/addons/hr_payroll/report/rml_parse.py +++ b/addons/hr_payroll/report/rml_parse.py @@ -32,16 +32,16 @@ class rml_parse(report_sxw.rml_parse): self.localcontext.update({ 'comma_me': self.comma_me, 'format_date': self._get_and_change_date_format_for_swiss, - 'strip_name' : self._strip_name, - 'explode_name' : self._explode_name, + 'strip_name': self._strip_name, + 'explode_name': self._explode_name, }) def comma_me(self,amount): if not amount: amount = 0.0 - if type(amount) is float : + if type(amount) is float: amount = str('%.2f'%amount) - else : + else: amount = str(amount) if (amount == '0'): return ' ' @@ -144,10 +144,10 @@ 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 : + else: found.getparent().replace(found,tag) return True diff --git a/addons/hr_payroll/wizard/hr_payroll_employees_detail.py b/addons/hr_payroll/wizard/hr_payroll_employees_detail.py index 3cd204d76b3..71f2406d167 100755 --- a/addons/hr_payroll/wizard/hr_payroll_employees_detail.py +++ b/addons/hr_payroll/wizard/hr_payroll_employees_detail.py @@ -55,7 +55,7 @@ class hr_payroll_employees_detail(osv.osv_memory): @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary - @return : return report + @return: return report """ if context is None: context = {} diff --git a/addons/hr_payroll/wizard/hr_payroll_year_salary.py b/addons/hr_payroll/wizard/hr_payroll_year_salary.py index 5522e797d87..cea4402665f 100755 --- a/addons/hr_payroll/wizard/hr_payroll_year_salary.py +++ b/addons/hr_payroll/wizard/hr_payroll_year_salary.py @@ -56,7 +56,7 @@ class hr_payroll_year_salary(osv.osv_memory): @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary - @return : return report + @return: return report """ if context is None: context = {} diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index 629aecc9255..0d5b315df62 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -42,7 +42,7 @@ def prev_bounds(cdate=False): class hr_payroll_structure(osv.osv): _inherit = 'hr.payroll.structure' _description = 'Salary Structure' - + _columns = { 'account_id':fields.many2one('account.analytic.account', 'Analytic Account'), } @@ -97,13 +97,13 @@ hr_employee() class payroll_register(osv.osv): _inherit = 'hr.payroll.register' _description = 'Payroll Register' - + _columns = { 'journal_id': fields.many2one('account.journal', 'Expanse Journal'), 'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'), 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."), } - + def compute_sheet(self, cr, uid, ids, context={}): emp_pool = self.pool.get('hr.employee') slip_pool = self.pool.get('hr.payslip') @@ -141,7 +141,7 @@ payroll_register() class payroll_advice(osv.osv): _inherit = 'hr.payroll.advice' _description = 'Bank Advice Note' - + _columns = { 'account_id': fields.many2one('account.account', 'Account'), } @@ -179,7 +179,7 @@ class contrib_register(osv.osv): 'yearly_total_by_comp':c_year } return res - + _columns = { 'account_id': fields.many2one('account.account', 'Account'), 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'), @@ -191,7 +191,7 @@ contrib_register() class contrib_register_line(osv.osv): _inherit = 'hr.contibution.register.line' _description = 'Contribution Register Line' - + _columns = { 'period_id': fields.many2one('account.period', 'Period'), } @@ -296,29 +296,29 @@ class hr_payslip(osv.osv): name = "To %s account" % (slip.employee_id.name) ded_rec = { - 'move_id':move_id, + 'move_id': move_id, 'name': name, 'date': slip.date, 'account_id': slip.employee_id.property_bank_account.id, 'debit': 0.0, - 'credit' : slip.total_pay, - 'journal_id' : slip.journal_id.id, - 'period_id' :period_id, - 'ref':slip.number + 'credit': slip.total_pay, + 'journal_id': slip.journal_id.id, + 'period_id': period_id, + 'ref': slip.number } line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)] name = "By %s account" % (slip.employee_id.property_bank_account.name) cre_rec = { - 'move_id':move_id, + 'move_id': move_id, 'name': name, 'partner_id': partner_id, 'date': slip.date, 'account_id': partner.property_account_payable.id, - 'debit': slip.total_pay, - 'credit' : 0.0, - 'journal_id' : slip.journal_id.id, - 'period_id' :period_id, - 'ref':slip.number + 'debit': slip.total_pay, + 'credit': 0.0, + 'journal_id': slip.journal_id.id, + 'period_id': period_id, + 'ref': slip.number } line_ids += [movel_pool.create(cr, uid, cre_rec, context=context)] @@ -510,17 +510,17 @@ class hr_payslip(osv.osv): continue rec = { - 'move_id':move_id, + 'move_id': move_id, 'name': name, 'date': slip.date, 'account_id': line.account_id.id, 'debit': 0.0, - 'credit' : 0.0, - 'journal_id' : slip.journal_id.id, - 'period_id' :period_id, - 'analytic_account_id':False, - 'ref':slip.number, - 'quantity':1 + 'credit': 0.0, + 'journal_id': slip.journal_id.id, + 'period_id': period_id, + 'analytic_account_id': False, + 'ref': slip.number, + 'quantity': 1 } #Setting Analysis Account for Salary Slip Lines @@ -534,17 +534,17 @@ class hr_payslip(osv.osv): if not partner.property_account_payable: raise osv.except_osv(_('Integrity Error !'), _('Please Configure Partners Payable Account!!')) ded_rec = { - 'move_id':move_id, + 'move_id': move_id, 'name': name, 'partner_id': partner_id, 'date': slip.date, 'account_id': partner.property_account_payable.id, 'debit': 0.0, - 'quantity':1, - 'credit' : amount, - 'journal_id' : slip.journal_id.id, - 'period_id' :period_id, - 'ref':slip.number + 'quantity': 1, + 'credit': amount, + 'journal_id': slip.journal_id.id, + 'period_id': period_id, + 'ref': slip.number } line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)] elif line.type == 'deduction' or line.type == 'otherdeduct': @@ -553,17 +553,17 @@ class hr_payslip(osv.osv): rec['credit'] = amount total_deduct += amount ded_rec = { - 'move_id':move_id, + 'move_id': move_id, 'name': name, 'partner_id': partner_id, 'date': slip.date, - 'quantity':1, + 'quantity': 1, 'account_id': partner.property_account_receivable.id, 'debit': amount, - 'credit' : 0.0, - 'journal_id' : slip.journal_id.id, - 'period_id' :period_id, - 'ref':slip.number + 'credit': 0.0, + 'journal_id': slip.journal_id.id, + 'period_id': period_id, + 'ref': slip.number } line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)] @@ -580,38 +580,38 @@ class hr_payslip(osv.osv): 'period_id': period_id, 'date': slip.date, 'ref':slip.number, - 'narration': 'Adjustment : %s' % (slip.name) + 'narration': 'Adjustment: %s' % (slip.name) } adj_move_id = move_pool.create(cr, uid, move, context=context) name = "Adjustment Entry - %s" % (slip.employee_id.name) self.create_voucher(cr, uid, [slip.id], name, adj_move_id) ded_rec = { - 'move_id':adj_move_id, + 'move_id': adj_move_id, 'name': name, 'partner_id': partner_id, 'date': slip.date, 'account_id': partner.property_account_receivable.id, 'debit': 0.0, - 'quantity':1, - 'credit' : total_deduct, - 'journal_id' : slip.journal_id.id, - 'period_id' :period_id, - 'ref':slip.number + 'quantity': 1, + 'credit': total_deduct, + 'journal_id': slip.journal_id.id, + 'period_id': period_id, + 'ref': slip.number } line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)] cre_rec = { - 'move_id':adj_move_id, + 'move_id': adj_move_id, 'name': name, 'partner_id': partner_id, 'date': slip.date, 'account_id': partner.property_account_payable.id, 'debit': total_deduct, - 'quantity':1, - 'credit' : 0.0, - 'journal_id' : slip.journal_id.id, - 'period_id' :period_id, - 'ref':slip.number + 'quantity': 1, + 'credit': 0.0, + 'journal_id': slip.journal_id.id, + 'period_id': period_id, + 'ref': slip.number } line_ids += [movel_pool.create(cr, uid, cre_rec, context=context)] diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index c676b4199be..fcbb0ffbb5c 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -123,13 +123,13 @@ class hr_applicant(crm.crm_case, osv.osv): 'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."), 'description': fields.text('Description'), 'email_from': fields.char('Email', size=128, help="These people will receive email."), - 'email_cc': fields.text('Watchers Emails', size=252 , help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"), + 'email_cc': fields.text('Watchers Emails', size=252, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"), 'probability': fields.float('Probability'), 'partner_id': fields.many2one('res.partner', 'Partner'), 'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \ domain="[('partner_id','=',partner_id)]"), - 'create_date': fields.datetime('Creation Date' , readonly=True), - 'write_date': fields.datetime('Update Date' , readonly=True), + 'create_date': fields.datetime('Creation Date', readonly=True), + 'write_date': fields.datetime('Update Date', readonly=True), 'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage'), 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True, help='The state is set to \'Draft\', when a case is created.\ @@ -153,10 +153,10 @@ class hr_applicant(crm.crm_case, osv.osv): 'partner_phone': fields.char('Phone', size=32), 'partner_mobile': fields.char('Mobile', size=32), 'type_id': fields.many2one('hr.recruitment.degree', 'Degree'), - 'department_id':fields.many2one('hr.department', 'Department'), + 'department_id': fields.many2one('hr.department', 'Department'), 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True), - 'survey' : fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'), - 'response' : fields.integer("Response"), + 'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'), + 'response': fields.integer("Response"), 'reference': fields.char('Reference', size=128), 'day_open': fields.function(_compute_day, string='Days to Open', \ method=True, multi='day_open', type="float", store=True), @@ -238,7 +238,7 @@ class hr_applicant(crm.crm_case, osv.osv): @param ids: List of Opportunity to Meeting IDs @param context: A standard dictionary for contextual values - @return : Dictionary value for created Meeting view + @return: Dictionary value for created Meeting view """ data_obj = self.pool.get('ir.model.data') if context is None: @@ -289,13 +289,13 @@ class hr_applicant(crm.crm_case, osv.osv): @param uid: the current user’s ID for security checks, @param ids: List of Survey IDs @param context: A standard dictionary for contextual values - @return : Dictionary value for print survey form. + @return: Dictionary value for print survey form. """ if not context: context = {} record = self.browse(cr, uid, ids, context=context) record = record and record[0] - context.update({'survey_id': record.survey.id, 'response_id' : [record.response], 'response_no':0, }) + context.update({'survey_id': record.survey.id, 'response_id': [record.response], 'response_no': 0, }) value = self.pool.get("survey").action_print_survey(cr, uid, ids, context) return value @@ -427,8 +427,8 @@ class hr_applicant(crm.crm_case, osv.osv): self.log(cr, uid, id, message) applicant = self.browse(cr, uid, ids)[0] - if applicant.job_id : - emp_id = employee_obj.create(cr,uid,{'name':applicant.name,'job_id':applicant.job_id.id}) + if applicant.job_id: + emp_id = employee_obj.create(cr,uid,{'name': applicant.name,'job_id': applicant.job_id.id}) return res def case_reset(self, cr, uid, ids, *args): @@ -441,7 +441,7 @@ class hr_applicant(crm.crm_case, osv.osv): """ res = super(hr_applicant, self).case_reset(cr, uid, ids, *args) - self.write(cr, uid, ids, {'date_open': False, 'date_closed':False}) + self.write(cr, uid, ids, {'date_open': False, 'date_closed': False}) return res diff --git a/addons/hr_recruitment/report/hr_recruitment_report.py b/addons/hr_recruitment/report/hr_recruitment_report.py index 405897e95f4..3ba27af9228 100644 --- a/addons/hr_recruitment/report/hr_recruitment_report.py +++ b/addons/hr_recruitment/report/hr_recruitment_report.py @@ -37,7 +37,7 @@ class hr_recruitment_report(osv.osv): _rec_name = 'date' _columns = { - 'user_id':fields.many2one('res.users', 'User', readonly=True), + 'user_id': fields.many2one('res.users', 'User', readonly=True), 'nbr': fields.integer('# of Cases', readonly=True), 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True), 'month':fields.selection([('01', 'January'), ('02', 'February'), \ @@ -54,14 +54,14 @@ class hr_recruitment_report(osv.osv): 'job_id': fields.many2one('hr.job', 'Applied Job',readonly=True), 'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage'), 'type_id': fields.many2one('hr.recruitment.degree', 'Degree'), - 'department_id':fields.many2one('hr.department','Department',readonly=True), + 'department_id': fields.many2one('hr.department','Department',readonly=True), 'priority': fields.selection(hr_recruitment.AVAILABLE_PRIORITIES, 'Appreciation'), - 'salary_prop' : fields.float("Salary Proposed"), - 'salary_prop_avg' : fields.float("Avg Salary Proposed", group_operator="avg"), - 'salary_exp' : fields.float("Salary Expected"), + 'salary_prop': fields.float("Salary Proposed"), + 'salary_prop_avg': fields.float("Avg Salary Proposed", group_operator="avg"), + 'salary_exp': fields.float("Salary Expected"), 'partner_id': fields.many2one('res.partner', 'Partner',readonly=True), 'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact Name',readonly=True), - 'available' : fields.float("Availability"), + 'available': fields.float("Availability"), 'delay_open': fields.float('Avg. Delay to Open', digits=(16,2), readonly=True, group_operator="avg", help="Number of Days to close the project issue"), 'delay_close': fields.float('Avg. Delay to Close', digits=(16,2), readonly=True, group_operator="avg", diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py index 6e817eaf49a..0f557d8b3bf 100644 --- a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py +++ b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py @@ -82,19 +82,19 @@ class job2phonecall(osv.osv_memory): id3 = data_obj.browse(cr, uid, id3, context=context).res_id for job in job_case_obj.browse(cr, uid, context['active_ids'], context=context): - #TODO : Take other info from job + #TODO: Take other info from job new_phonecall_id = phonecall_case_obj.create(cr, uid, { - 'name' : job.name, - 'user_id' : form['user_id'], - 'categ_id' : form['category_id'], - 'description' : form['note'], - 'date' : form['deadline'], - 'description':job.description, - 'partner_id':job.partner_id.id, - 'partner_address_id':job.partner_address_id.id, - 'partner_phone':job.partner_phone, - 'partner_mobile':job.partner_mobile, - 'description':job.description, + 'name': job.name, + 'user_id': form['user_id'], + 'categ_id': form['category_id'], + 'description': form['note'], + 'date': form['deadline'], + 'description': job.description, + 'partner_id': job.partner_id.id, + 'partner_address_id': job.partner_address_id.id, + 'partner_phone': job.partner_phone, + 'partner_mobile': job.partner_mobile, + 'description': job.description, 'date':job.date, }, context=context) new_phonecall = phonecall_case_obj.browse(cr, uid, new_phonecall_id, context=context) @@ -108,7 +108,7 @@ class job2phonecall(osv.osv_memory): 'view_type': 'form', 'view_mode': 'tree,form', 'res_model': 'crm.phonecall', - 'res_id' : new_phonecall_id, + 'res_id': new_phonecall_id, 'views': [(id3,'form'), (id2,'tree'), (False,'calendar'), (False,'graph')], 'type': 'ir.actions.act_window', 'search_view_id': res['res_id'] diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 20d97634214..e03b7f93b3b 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -32,7 +32,7 @@ class hr_employee(osv.osv): 'product_id': fields.many2one('product.product', 'Product', help="Specifies employee's designation as a product with type 'service'."), 'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal') } - + def _getAnalyticJournal(self, cr, uid, context=None): md = self.pool.get('ir.model.data') try: @@ -52,8 +52,8 @@ class hr_employee(osv.osv): return False _defaults = { - 'journal_id' : _getAnalyticJournal, - 'product_id' : _getEmployeeProduct + 'journal_id': _getAnalyticJournal, + 'product_id': _getEmployeeProduct } hr_employee() @@ -65,7 +65,7 @@ class hr_analytic_timesheet(osv.osv): _inherits = {'account.analytic.line': 'line_id'} _order = "id desc" _columns = { - 'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade', required=True), + 'line_id': fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade', required=True), 'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner Id', relation='res.partner', store=True), } @@ -148,12 +148,12 @@ class hr_analytic_timesheet(osv.osv): _defaults = { - 'product_uom_id' : _getEmployeeUnit, - 'product_id' : _getEmployeeProduct, - 'general_account_id' : _getGeneralAccount, - 'journal_id' : _getAnalyticJournal, - 'date' : lambda self, cr, uid, ctx : ctx.get('date', time.strftime('%Y-%m-%d')), - 'user_id' : lambda obj, cr, uid, ctx : ctx.get('user_id', uid), + 'product_uom_id': _getEmployeeUnit, + 'product_id': _getEmployeeProduct, + 'general_account_id': _getGeneralAccount, + 'journal_id': _getAnalyticJournal, + 'date': lambda self, cr, uid, ctx: ctx.get('date', time.strftime('%Y-%m-%d')), + 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid), } def on_change_account_id(self, cr, uid, ids, account_id): return {'value':{}} @@ -184,13 +184,13 @@ class hr_analytic_timesheet(osv.osv): if not user_id: return {} context = {'user_id': user_id} - return {'value' : { - 'product_id' : self._getEmployeeProduct(cr, uid, context), - 'product_uom_id' : self._getEmployeeUnit(cr, uid, context), - 'general_account_id' :self._getGeneralAccount(cr, uid, context), - 'journal_id' : self._getAnalyticJournal(cr, uid, context), + return {'value': { + 'product_id': self. _getEmployeeProduct(cr, uid, context), + 'product_uom_id': self._getEmployeeUnit(cr, uid, context), + 'general_account_id': self._getGeneralAccount(cr, uid, context), + 'journal_id': self._getAnalyticJournal(cr, uid, context), }} - + hr_analytic_timesheet() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index cc1ff3b9324..6d022a3c926 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -66,7 +66,7 @@ class account_analytic_account(osv.osv): _inherit = "account.analytic.account" _columns = { - 'pricelist_id' : fields.many2one('product.pricelist', 'Sale Pricelist', + 'pricelist_id': fields.many2one('product.pricelist', 'Sale Pricelist', help="The product to invoice is defined on the employee form, the price will be deduced by this pricelist on the product."), 'amount_max': fields.float('Max. Invoice Price'), 'amount_invoiced': fields.function(_invoiced_calc, method=True, string='Invoiced Amount', diff --git a/addons/hr_timesheet_invoice/report/cost_ledger.py b/addons/hr_timesheet_invoice/report/cost_ledger.py index 18de548ad1c..614714bb396 100644 --- a/addons/hr_timesheet_invoice/report/cost_ledger.py +++ b/addons/hr_timesheet_invoice/report/cost_ledger.py @@ -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: diff --git a/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py b/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py index 09d6275ede2..90ba2aa7f6c 100644 --- a/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py +++ b/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py @@ -28,16 +28,16 @@ class report_timesheet_line(osv.osv): _auto = False _columns = { 'name': fields.char('Year',size=64,required=False, readonly=True), - 'user_id':fields.many2one('res.users', 'User', readonly=True), - 'date' : fields.date('Date', readonly=True), + 'user_id': fields.many2one('res.users', 'User', readonly=True), + 'date': fields.date('Date', readonly=True), 'day': fields.char('Day', size=128, readonly=True), 'quantity': fields.float('Quantity', readonly=True), 'cost': fields.float('Cost', readonly=True), - 'product_id' : fields.many2one('product.product', 'Product',readonly=True), - 'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), - 'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True), + 'product_id': fields.many2one('product.product', 'Product',readonly=True), + 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), + 'general_account_id': fields.many2one('account.account', 'General Account', readonly=True), 'invoice_id': fields.many2one('account.invoice', 'Invoiced', readonly=True), - 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), + 'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True), } _order = 'name desc,user_id desc' @@ -223,11 +223,11 @@ class report_random_timsheet(osv.osv): _auto = False _columns = { - 'analytic_account_id' : fields.many2one('account.analytic.account','Analytic Account', readonly=True), + 'analytic_account_id': fields.many2one('account.analytic.account','Analytic Account', readonly=True), 'name': fields.char('Description', size=64, readonly=True), - 'quantity' : fields.float('Quantity', readonly=True), + 'quantity': fields.float('Quantity', readonly=True), 'date': fields.date('Date', readonly=True), - 'user_id' : fields.many2one('res.users', 'User', readonly=True) + 'user_id': fields.many2one('res.users', 'User', readonly=True) } _order = "date desc" @@ -273,14 +273,14 @@ class random_timesheet_lines(osv.osv): _columns = { 'date': fields.date('Date', readonly=True), 'name': fields.char('Description', size=64, readonly=True), - 'user_id' : fields.many2one('res.users', 'User', readonly=True), - 'quantity' : fields.float('Quantity', readonly=True), - 'product_id' : fields.many2one('product.product', 'Product', readonly=True), - 'analytic_account_id' : fields.many2one('account.analytic.account','Analytic Account', readonly=True), - 'uom_id' : fields.many2one('product.uom', 'UoM', readonly=True), - 'amount' : fields.float('Amount', readonly=True), + 'user_id': fields.many2one('res.users', 'User', readonly=True), + 'quantity': fields.float('Quantity', readonly=True), + 'product_id': fields.many2one('product.product', 'Product', readonly=True), + 'analytic_account_id': fields.many2one('account.analytic.account','Analytic Account', readonly=True), + 'uom_id': fields.many2one('product.uom', 'UoM', readonly=True), + 'amount': fields.float('Amount', readonly=True), 'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Invoicing', readonly=True), - 'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True) + 'general_account_id': fields.many2one('account.account', 'General Account', readonly=True) } _order = "date desc" diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 475315068ae..075a68907ae 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -176,7 +176,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): curr_line['note'] = "\n".join(map(lambda x: unicode(x) or '',note)) invoice_line_obj.create(cr, uid, curr_line, context=context) - cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id IN %s" ,(last_invoice, account.id, tuple(context['active_ids']))) + cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id IN %s", (last_invoice, account.id, tuple(context['active_ids']))) invoice_obj.button_reset_taxes(cr, uid, [last_invoice], context)