diff --git a/addons/account/account.py b/addons/account/account.py index 6c394611e6c..329ae2579e2 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -30,7 +30,7 @@ from osv import fields, osv import decimal_precision as dp from tools.translate import _ -def check_cycle(self, cr, uid, ids): +def check_cycle(self, cr, uid, ids, context=None): """ climbs the ``self._table.parent_id`` chains for 100 levels or until it can't find any more parent(s) @@ -194,7 +194,7 @@ class account_account(osv.osv): if not args[pos][2]: del args[pos] continue - jour = self.pool.get('account.journal').browse(cr, uid, args[pos][2]) + jour = self.pool.get('account.journal').browse(cr, uid, args[pos][2], context=context) if (not (jour.account_control_ids or jour.type_control_ids)) or not args[pos][2]: args[pos] = ('type','not in',('consolidation','view')) continue @@ -207,7 +207,7 @@ class account_account(osv.osv): if context and context.has_key('consolidate_childs'): #add consolidated childs of accounts ids = super(account_account, self).search(cr, uid, args, offset, limit, order, context=context, count=count) - for consolidate_child in self.browse(cr, uid, context['account_id']).child_consol_ids: + for consolidate_child in self.browse(cr, uid, context['account_id'], context=context).child_consol_ids: ids.append(consolidate_child.id) return ids @@ -681,7 +681,7 @@ class account_journal(osv.osv): @return: Returns a list of tupples containing id, name """ - result = self.browse(cr, user, ids, context) + result = self.browse(cr, user, ids, context=context) res = [] for rs in result: name = rs.name @@ -729,7 +729,7 @@ class account_journal(osv.osv): view_id = 'account_journal_bank_view_multi' data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=',view_id)]) - data = obj_data.browse(cr, uid, data_id[0]) + data = obj_data.browse(cr, uid, data_id[0], context=context) res.update({ 'centralisation':type == 'situation', @@ -2059,7 +2059,7 @@ class account_model(osv.osv): raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !')) period_id = period_id[0] - for model in self.browse(cr, uid, ids, context): + for model in self.browse(cr, uid, ids, context=context): entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')} move_id = account_move_obj.create(cr, uid, { 'ref': entry['name'], @@ -2721,7 +2721,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): # Creating Journals Sales and Purchase vals_journal={} data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')]) - data = obj_data.browse(cr, uid, data_id[0]) + data = obj_data.browse(cr, uid, data_id[0], context=context) view_id = data.res_id seq_id = obj_sequence.search(cr, uid, [('name','=','Account Journal')])[0] diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 4dcdcffec2b..ab2f72e92dd 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -385,7 +385,7 @@ class account_bank_statement(osv.osv): return {'value': {'balance_start': balance_start, 'account_id': account_id}} def unlink(self, cr, uid, ids, context=None): - stat = self.read(cr, uid, ids, ['state']) + stat = self.read(cr, uid, ids, ['state'], context=context) unlink_ids = [] for t in stat: if t['state'] in ('draft'): diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index a49349800b4..86b00ad98b3 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -283,7 +283,7 @@ class account_cash_statement(osv.osv): @return: True on success, False otherwise """ - super(account_cash_statement, self).write(cr, uid, ids, vals) + super(account_cash_statement, self).write(cr, uid, ids, vals, context=context) res = self._get_starting_balance(cr, uid, ids) for rs in res: super(account_cash_statement, self).write(cr, uid, [rs], res.get(rs)) @@ -338,7 +338,7 @@ class account_cash_statement(osv.osv): 'state': 'open', }) - self.write(cr, uid, [statement.id], vals) + self.write(cr, uid, [statement.id], vals, context=context) return True def balance_check(self, cr, uid, cash_id, journal_type='bank', context=None): diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 3837d6a2b61..02c5abcb130 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -552,7 +552,7 @@ class account_move_line(osv.osv): if (not currency_id) or (not account_id): return {} result = {} - acc = account_obj.browse(cr, uid, account_id) + acc = account_obj.browse(cr, uid, account_id, context=context) if (amount>0) and journal: x = journal_obj.browse(cr, uid, journal).default_credit_account_id if x: acc = x @@ -668,7 +668,7 @@ class account_move_line(osv.osv): raise osv.except_osv(_('Warning !'), _('To reconcile the entries company should be the same for all entries')) company_list.append(line.company_id.id) - for line in self.browse(cr, uid, ids, context): + for line in self.browse(cr, uid, ids, context=context): if line.reconcile_id: raise osv.except_osv(_('Warning'), _('Already Reconciled!')) if line.reconcile_partial_id: @@ -814,8 +814,10 @@ class account_move_line(osv.osv): partner_obj.write(cr, uid, [partner_id], {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')}) return r_id - def view_header_get(self, cr, user, view_id, view_type, context): - context = self.convert_to_period(cr, user, context) + def view_header_get(self, cr, user, view_id, view_type, context=None): + if context is None: + context = {} + context = self.convert_to_period(cr, user, context=context) if context.get('account_id', False): cr.execute('SELECT code FROM account_account WHERE id = %s', (context['account_id'], )) res = cr.fetchone() diff --git a/addons/account/installer.py b/addons/account/installer.py index b1be04f7c70..9dce3186393 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -45,7 +45,7 @@ class account_installer(osv.osv_memory): ids = modules.search(cr, uid, [('category_id', '=', 'Account Charts')], context=context) charts = list( sorted(((m.name, m.shortdesc) - for m in modules.browse(cr, uid, ids)), + for m in modules.browse(cr, uid, ids, context=context)), key=itemgetter(1))) charts.insert(0, ('configurable', 'Generic Chart Of Account')) return charts diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 93e54df2a32..57178c03c72 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -60,7 +60,7 @@ class account_invoice(osv.osv): return res and res[0] or False def _get_currency(self, cr, uid, context=None): - user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0] + user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid], context=context)[0] if user.company_id: return user.company_id.currency_id.id return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=', 1.0)])[0] @@ -396,7 +396,7 @@ class account_invoice(osv.osv): return True def unlink(self, cr, uid, ids, context=None): - invoices = self.read(cr, uid, ids, ['state']) + invoices = self.read(cr, uid, ids, ['state'], context=context) unlink_ids = [] for t in invoices: if t['state'] in ('draft', 'cancel'): diff --git a/addons/account/partner.py b/addons/account/partner.py index 5789e7669fd..c710e8949c4 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -134,10 +134,10 @@ class res_partner(osv.osv): return [('id','=','0')] return [('id','in',map(itemgetter(0), res))] - def _credit_search(self, cr, uid, obj, name, args, context): + def _credit_search(self, cr, uid, obj, name, args, context=None): return self._asset_difference_search(cr, uid, obj, name, 'receivable', args, context=context) - def _debit_search(self, cr, uid, obj, name, args, context): + def _debit_search(self, cr, uid, obj, name, args, context=None): return self._asset_difference_search(cr, uid, obj, name, 'payable', args, context=context) _columns = { diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py index b6dccb6e5b1..47f9ac9c2c8 100644 --- a/addons/account/wizard/account_change_currency.py +++ b/addons/account/wizard/account_change_currency.py @@ -51,7 +51,7 @@ class account_change_currency(osv.osv_memory): invoice = obj_inv.browse(cr, uid, context['active_id'], context=context) if invoice.currency_id.id == new_currency: return {} - rate = obj_currency.browse(cr, uid, new_currency).rate + rate = obj_currency.browse(cr, uid, new_currency, context=context).rate for line in invoice.invoice_line: new_price = 0 if invoice.company_id.currency_id.id == invoice.currency_id.id: diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index 0ad0cf61999..672e2a28fba 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -93,7 +93,7 @@ class account_invoice_refund(osv.osv_memory): date = False period = False description = False - company = res_users_obj.browse(cr, uid, uid).company_id + company = res_users_obj.browse(cr, uid, uid, context=context).company_id journal_id = form.get('journal_id', False) for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context): if inv.state in ['draft', 'proforma2', 'cancel']: diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index 4f68699a841..c7adb387724 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -33,8 +33,6 @@ class account_move_journal(osv.osv_memory): """ Return default account period value """ - if context is None: - context = {} account_period_obj = self.pool.get('account.period') ids = account_period_obj.find(cr, uid, context=context) period_id = False @@ -48,8 +46,6 @@ class account_move_journal(osv.osv_memory): """ journal_id = False - if context is None: - context = {} journal_pool = self.pool.get('account.journal') if context.get('journal_type', False): @@ -142,8 +138,8 @@ class account_move_journal(osv.osv_memory): ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context) if not ids: - journal = journal_pool.browse(cr, uid, journal_id) - period = account_period_obj.browse(cr, uid, period_id) + journal = journal_pool.browse(cr, uid, journal_id, context=context) + period = account_period_obj.browse(cr, uid, period_id, context=context) name = journal.name state = period.state diff --git a/addons/account/wizard/account_move_line_reconcile_select.py b/addons/account/wizard/account_move_line_reconcile_select.py index d7cfbdb7990..8e57c57884d 100644 --- a/addons/account/wizard/account_move_line_reconcile_select.py +++ b/addons/account/wizard/account_move_line_reconcile_select.py @@ -39,8 +39,6 @@ class account_move_line_reconcile_select(osv.osv_memory): @return: dictionary of Open account move line window for reconcile on given account id """ - if context is None: - context = {} data = self.read(cr, uid, ids, context=context)[0] return { 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['account_id'], diff --git a/addons/account/wizard/account_move_line_select.py b/addons/account/wizard/account_move_line_select.py index 7ece00ca8b5..12ab0236759 100644 --- a/addons/account/wizard/account_move_line_select.py +++ b/addons/account/wizard/account_move_line_select.py @@ -42,7 +42,7 @@ class account_move_line_select(osv.osv_memory): else: fiscalyear_ids = [context['fiscalyear']] - fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids) + fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids, context=context) period_ids = [] if fiscalyears: diff --git a/addons/account/wizard/account_move_line_unreconcile_select.py b/addons/account/wizard/account_move_line_unreconcile_select.py index 62f6dd24810..ad59493503d 100644 --- a/addons/account/wizard/account_move_line_unreconcile_select.py +++ b/addons/account/wizard/account_move_line_unreconcile_select.py @@ -28,8 +28,6 @@ class account_move_line_unreconcile_select(osv.osv_memory): 'account_id': fields.many2one('account.account','Account',required=True), } def action_open_window(self, cr, uid, ids, context=None): - if context is None: - context = {} data = self.read(cr, uid, ids, context=context)[0] return { 'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data['account_id'], diff --git a/addons/account/wizard/account_open_closed_fiscalyear.py b/addons/account/wizard/account_open_closed_fiscalyear.py index 1f780ae0132..582bbc36619 100644 --- a/addons/account/wizard/account_open_closed_fiscalyear.py +++ b/addons/account/wizard/account_open_closed_fiscalyear.py @@ -31,12 +31,10 @@ class account_open_closed_fiscalyear(osv.osv_memory): } def remove_entries(self, cr, uid, ids, context=None): - if context is None: - context = {} fy_obj = self.pool.get('account.fiscalyear') move_obj = self.pool.get('account.move') - data = self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] data_fyear = fy_obj.browse(cr, uid, data['fyear_id'], context=context) if not data_fyear.end_journal_period_id: raise osv.except_osv(_('Error'), _('No journal for ending writing has been defined for the fiscal year')) diff --git a/addons/account/wizard/account_reconcile_partner_process.py b/addons/account/wizard/account_reconcile_partner_process.py index e65ed778ef4..9f91d1ec2d2 100644 --- a/addons/account/wizard/account_reconcile_partner_process.py +++ b/addons/account/wizard/account_reconcile_partner_process.py @@ -73,6 +73,8 @@ class account_partner_reconcile_process(osv.osv_memory): return res def next_partner(self, cr, uid, ids, context=None): + if context is None: + context = {} move_line_obj = self.pool.get('account.move.line') res_partner_obj = self.pool.get('res.partner') diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py index 0d64a753f55..6ce36242f47 100644 --- a/addons/account/wizard/account_report_balance_sheet.py +++ b/addons/account/wizard/account_report_balance_sheet.py @@ -57,7 +57,7 @@ class account_bs_report(osv.osv_memory): if context is None: context = {} data = self.pre_print_report(cr, uid, ids, data, context=context) - account = self.pool.get('account.account').browse(cr, uid, data['form']['chart_account_id']) + account = self.pool.get('account.account').browse(cr, uid, data['form']['chart_account_id'], context=context) if not account.company_id.property_reserve_and_surplus_account: raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !')) data['form']['reserve_account_id'] = account.company_id.property_reserve_and_surplus_account.id diff --git a/addons/account/wizard/account_report_common_account.py b/addons/account/wizard/account_report_common_account.py index 4ed71ec9389..7205a9e53bf 100644 --- a/addons/account/wizard/account_report_common_account.py +++ b/addons/account/wizard/account_report_common_account.py @@ -38,7 +38,7 @@ class account_common_account_report(osv.osv_memory): def pre_print_report(self, cr, uid, ids, data, context=None): if context is None: context = {} - data['form'].update(self.read(cr, uid, ids, ['display_account'])[0]) + data['form'].update(self.read(cr, uid, ids, ['display_account'], context=context)[0]) return data account_common_account_report() diff --git a/addons/account/wizard/account_report_common_journal.py b/addons/account/wizard/account_report_common_journal.py index 9ec12b16177..8e9db058d31 100644 --- a/addons/account/wizard/account_report_common_journal.py +++ b/addons/account/wizard/account_report_common_journal.py @@ -41,7 +41,7 @@ class account_common_journal_report(osv.osv_memory): def pre_print_report(self, cr, uid, ids, data, context=None): if context is None: context = {} - data['form'].update(self.read(cr, uid, ids, ['amount_currency'])[0]) + data['form'].update(self.read(cr, uid, ids, ['amount_currency'], context=context)[0]) fy_ids = data['form']['fiscalyear_id'] and [data['form']['fiscalyear_id']] or self.pool.get('account.fiscalyear').search(cr, uid, [('state', '=', 'draft')], context=context) period_list = data['form']['periods'] or self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', fy_ids)], context=context) data['form']['active_ids'] = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', data['form']['journal_ids']), ('period_id', 'in', period_list)], context=context) diff --git a/addons/account/wizard/account_report_common_partner.py b/addons/account/wizard/account_report_common_partner.py index 3fafb400bb1..05003041eeb 100644 --- a/addons/account/wizard/account_report_common_partner.py +++ b/addons/account/wizard/account_report_common_partner.py @@ -39,7 +39,7 @@ class account_common_partner_report(osv.osv_memory): def pre_print_report(self, cr, uid, ids, data, context=None): if context is None: context = {} - data['form'].update(self.read(cr, uid, ids, ['result_selection'])[0]) + data['form'].update(self.read(cr, uid, ids, ['result_selection'], context=context)[0]) return data account_common_partner_report() diff --git a/addons/account/wizard/account_report_print_journal.py b/addons/account/wizard/account_report_print_journal.py index 6256cca8ab6..b1ca30dc560 100644 --- a/addons/account/wizard/account_report_print_journal.py +++ b/addons/account/wizard/account_report_print_journal.py @@ -39,7 +39,7 @@ class account_print_journal(osv.osv_memory): if context is None: context = {} data = self.pre_print_report(cr, uid, ids, data, context=context) - data['form'].update(self.read(cr, uid, ids, ['sort_selection'])[0]) + data['form'].update(self.read(cr, uid, ids, ['sort_selection'], context=context)[0]) return {'type': 'ir.actions.report.xml', 'report_name': 'account.journal.period.print', 'datas': data} account_print_journal() diff --git a/addons/account/wizard/account_subscription_generate.py b/addons/account/wizard/account_subscription_generate.py index aabb980a91c..4c99539301b 100644 --- a/addons/account/wizard/account_subscription_generate.py +++ b/addons/account/wizard/account_subscription_generate.py @@ -34,8 +34,6 @@ class account_subscription_generate(osv.osv_memory): 'date': lambda *a: time.strftime('%Y-%m-%d'), } def action_generate(self, cr, uid, ids, context=None): - if context is None: - context = {} mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') moves_created=[] diff --git a/addons/account/wizard/account_unreconcile.py b/addons/account/wizard/account_unreconcile.py index 88b58b68a1e..3a067b4a598 100644 --- a/addons/account/wizard/account_unreconcile.py +++ b/addons/account/wizard/account_unreconcile.py @@ -41,11 +41,11 @@ class account_unreconcile_reconcile(osv.osv_memory): def trans_unrec_reconcile(self, cr, uid, ids, context=None): obj_move_reconcile = self.pool.get('account.move.reconcile') - rec_ids = context['active_ids'] if context is None: context = {} + rec_ids = context['active_ids'] if rec_ids: - obj_move_reconcile.unlink(cr, uid, rec_ids) + obj_move_reconcile.unlink(cr, uid, rec_ids, context=context) return {} account_unreconcile_reconcile() diff --git a/addons/account/wizard/account_use_model.py b/addons/account/wizard/account_use_model.py index 51bd3a96083..15719dcf138 100644 --- a/addons/account/wizard/account_use_model.py +++ b/addons/account/wizard/account_use_model.py @@ -59,9 +59,9 @@ class account_use_model(osv.osv_memory): data = self.read(cr, uid, ids, context=context)[0] record_id = context and context.get('model_line', False) or False if record_id: - data_model = account_model_obj.browse(cr, uid, data['model']) + data_model = account_model_obj.browse(cr, uid, data['model'], context=context) else: - data_model = account_model_obj.browse(cr, uid, context['active_ids']) + data_model = account_model_obj.browse(cr, uid, context['active_ids'], context=context) for model in data_model: entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%d')} period_id = account_period_obj.find(cr, uid, context=context) diff --git a/addons/account/wizard/account_validate_account_move.py b/addons/account/wizard/account_validate_account_move.py index 0f963b44fa6..f840d2b5532 100644 --- a/addons/account/wizard/account_validate_account_move.py +++ b/addons/account/wizard/account_validate_account_move.py @@ -33,11 +33,11 @@ class validate_account_move(osv.osv_memory): obj_move = self.pool.get('account.move') if context is None: context = {} - data = self.read(cr, uid, ids)[0] + data = self.read(cr, uid, ids, context=context)[0] ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data['journal_id']),('period_id','=',data['period_id'])]) if not ids_move: raise osv.except_osv(_('Warning'), _('Specified Journal does not have any account move entries in draft state for this period')) - obj_move.button_validate(cr, uid, ids_move, context) + obj_move.button_validate(cr, uid, ids_move, context=context) return {} validate_account_move() diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index d4ee5428bb9..9c8d657d537 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -33,8 +33,6 @@ class account_analytic_account(osv.osv): def _analysis_all(self, cr, uid, ids, fields, arg, context=None): dp = 2 res = dict([(i, {}) for i in ids]) - if context is None: - context = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) accounts = self.browse(cr, uid, ids, context=context) @@ -253,8 +251,6 @@ class account_analytic_account(osv.osv): def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} res_final = {} - if context is None: - context = {} child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) for i in child_ids: res[i] = {} @@ -281,8 +277,6 @@ class account_analytic_account(osv.osv): def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} res_final = {} - if context is None: - context = {} child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) for i in child_ids: @@ -309,8 +303,6 @@ class account_analytic_account(osv.osv): def _remaining_hours_calc(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} for account in self.browse(cr, uid, ids, context=context): if account.quantity_max != 0: res[account.id] = account.quantity_max - account.hours_quantity @@ -322,8 +314,6 @@ class account_analytic_account(osv.osv): def _hours_qtt_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} for account in self.browse(cr, uid, ids, context=context): res[account.id] = account.hours_quantity - account.hours_qtt_non_invoiced if res[account.id] < 0: @@ -334,8 +324,6 @@ class account_analytic_account(osv.osv): def _revenue_per_hour_calc(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} for account in self.browse(cr, uid, ids, context=context): if account.hours_qtt_invoiced == 0: res[account.id]=0.0 @@ -347,8 +335,6 @@ class account_analytic_account(osv.osv): def _real_margin_rate_calc(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} for account in self.browse(cr, uid, ids, context=context): if account.ca_invoiced == 0: res[account.id]=0.0 @@ -362,8 +348,6 @@ class account_analytic_account(osv.osv): def _remaining_ca_calc(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} for account in self.browse(cr, uid, ids, context=context): if account.amount_max != 0: res[account.id] = account.amount_max - account.ca_invoiced @@ -375,8 +359,6 @@ class account_analytic_account(osv.osv): def _real_margin_calc(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} for account in self.browse(cr, uid, ids, context=context): res[account.id] = account.ca_invoiced + account.total_cost for id in ids: @@ -385,8 +367,6 @@ class account_analytic_account(osv.osv): def _theorical_margin_calc(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} for account in self.browse(cr, uid, ids, context=context): res[account.id] = account.ca_theorical + account.total_cost for id in ids: @@ -450,8 +430,6 @@ class account_analytic_account_summary_user(osv.osv): def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} account_obj = self.pool.get('account.analytic.account') cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] @@ -618,8 +596,6 @@ class account_analytic_account_summary_month(osv.osv): def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} - if context is None: - context = {} account_obj = self.pool.get('account.analytic.account') account_ids = [int(str(int(x))[:-6]) for x in ids] month_ids = [int(str(int(x))[-6:]) for x in ids] diff --git a/addons/account_analytic_default/account_analytic_default.py b/addons/account_analytic_default/account_analytic_default.py index 7c3117ce59f..b41c9b9e5d2 100644 --- a/addons/account_analytic_default/account_analytic_default.py +++ b/addons/account_analytic_default/account_analytic_default.py @@ -41,8 +41,6 @@ class account_analytic_default(osv.osv): def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context=None): domain = [] - if context is None: - context = {} if product_id: domain += ['|', ('product_id', '=', product_id)] domain += [('product_id','=', False)] @@ -106,8 +104,6 @@ class sale_order_line(osv.osv): # Method overridden to set the analytic account by default on criterion match def invoice_line_create(self, cr, uid, ids, context=None): - if context is None: - context = {} create_ids = super(sale_order_line, self).invoice_line_create(cr, uid, ids, context=context) if not ids: return create_ids diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py index edb675862ca..6d8a06755d6 100644 --- a/addons/account_analytic_plans/account_analytic_plans.py +++ b/addons/account_analytic_plans/account_analytic_plans.py @@ -355,8 +355,6 @@ class account_invoice(osv.osv): _inherit = "account.invoice" def line_get_convert(self, cr, uid, x, part, date, context=None): - if context is None: - context = {} res=super(account_invoice,self).line_get_convert(cr, uid, x, part, date, context=context) res['analytics_id'] = x.get('analytics_id', False) return res @@ -425,8 +423,6 @@ class sale_order_line(osv.osv): # Method overridden to set the analytic account by default on criterion match def invoice_line_create(self, cr, uid, ids, context=None): - if context is None: - context = {} create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context=context) inv_line_obj = self.pool.get('account.invoice.line') acct_anal_def_obj = self.pool.get('account.analytic.default') @@ -447,8 +443,6 @@ class account_bank_statement(osv.osv): _name = "account.bank.statement" def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): - if context is None: - context = {} account_move_line_pool = self.pool.get('account.move.line') account_bank_statement_line_pool = self.pool.get('account.bank.statement.line') st_line = account_bank_statement_line_pool.browse(cr, uid, st_line_id, context=context) @@ -460,10 +454,8 @@ class account_bank_statement(osv.osv): return result def button_confirm_bank(self, cr, uid, ids, context=None): - if context is None: - context = {} super(account_bank_statement,self).button_confirm_bank(cr, uid, ids, context=context) - for st in self.browse(cr, uid, ids, context): + for st in self.browse(cr, uid, ids, context=context): for st_line in st.line_ids: if st_line.analytics_id: if not st.journal_id.analytic_journal_id: diff --git a/addons/account_analytic_plans/wizard/analytic_plan_create_model.py b/addons/account_analytic_plans/wizard/analytic_plan_create_model.py index 777421798cd..0581197aaca 100644 --- a/addons/account_analytic_plans/wizard/analytic_plan_create_model.py +++ b/addons/account_analytic_plans/wizard/analytic_plan_create_model.py @@ -30,6 +30,8 @@ class analytic_plan_create_model(osv.osv_memory): plan_obj = self.pool.get('account.analytic.plan.instance') mod_obj = self.pool.get('ir.model.data') anlytic_plan_obj = self.pool.get('account.analytic.plan') + if context is None: + context = {} if 'active_id' in context and context['active_id']: plan = plan_obj.browse(cr, uid, context['active_id'], context=context) if (not plan.name) or (not plan.code): diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py index eea19354630..a0aab8298dc 100644 --- a/addons/account_anglo_saxon/invoice.py +++ b/addons/account_anglo_saxon/invoice.py @@ -27,8 +27,6 @@ class account_invoice_line(osv.osv): _inherit = "account.invoice.line" def move_line_get(self, cr, uid, invoice_id, context=None): - if context is None: - context = {} res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context) inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context) if inv.type in ('out_invoice','out_refund'): @@ -130,8 +128,6 @@ class account_invoice_line(osv.osv): return res def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): - if context is None: - context = {} if not product: return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context) else: diff --git a/addons/account_anglo_saxon/stock.py b/addons/account_anglo_saxon/stock.py index ad7bba3103e..a544b9a6e2a 100644 --- a/addons/account_anglo_saxon/stock.py +++ b/addons/account_anglo_saxon/stock.py @@ -31,7 +31,6 @@ class stock_picking(osv.osv): def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None): '''Return ids of created invoices for the pickings''' - if context is None: context = {} res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context=context) if type == 'in_refund': for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context): diff --git a/addons/account_budget/account_budget.py b/addons/account_budget/account_budget.py index 590b431a63f..f6e7c7e3990 100644 --- a/addons/account_budget/account_budget.py +++ b/addons/account_budget/account_budget.py @@ -111,7 +111,8 @@ class crossovered_budget_lines(osv.osv): def _prac_amt(self, cr, uid, ids, context=None): res = {} result = 0.0 - if context is None: context = {} + if context is None: + context = {} for line in self.browse(cr, uid, ids, context=context): acc_ids = [x.id for x in line.general_budget_id.account_ids] if not acc_ids: @@ -134,14 +135,14 @@ class crossovered_budget_lines(osv.osv): def _prac(self, cr, uid, ids, name, args, context=None): res={} - if context is None: context = {} for line in self.browse(cr, uid, ids, context=context): res[line.id] = self._prac_amt(cr, uid, [line.id], context=context)[line.id] return res def _theo_amt(self, cr, uid, ids, context=None): res = {} - if context is None: context = {} + if context is None: + context = {} for line in self.browse(cr, uid, ids, context=context): today = datetime.datetime.today() date_to = today.strftime("%Y-%m-%d") @@ -172,7 +173,6 @@ class crossovered_budget_lines(osv.osv): def _theo(self, cr, uid, ids, name, args, context=None): res = {} - if context is None: context = {} for line in self.browse(cr, uid, ids, context=context): res[line.id] = self._theo_amt(cr, uid, [line.id], context=context)[line.id] return res diff --git a/addons/account_budget/wizard/account_budget_analytic.py b/addons/account_budget/wizard/account_budget_analytic.py index ef970c92904..b2a33434016 100644 --- a/addons/account_budget/wizard/account_budget_analytic.py +++ b/addons/account_budget/wizard/account_budget_analytic.py @@ -39,7 +39,7 @@ class account_budget_analytic(osv.osv_memory): datas = {} if context is None: context = {} - data = self.read(cr, uid, ids)[0] + data = self.read(cr, uid, ids, context=context)[0] datas = { 'ids': context.get('active_ids',[]), 'model': 'account.analytic.account', diff --git a/addons/account_budget/wizard/account_budget_crossovered_report.py b/addons/account_budget/wizard/account_budget_crossovered_report.py index 99c6989e845..5667a264d2a 100644 --- a/addons/account_budget/wizard/account_budget_crossovered_report.py +++ b/addons/account_budget/wizard/account_budget_crossovered_report.py @@ -39,7 +39,7 @@ class account_budget_crossvered_report(osv.osv_memory): datas = {} if context is None: context = {} - data = self.read(cr, uid, ids)[0] + data = self.read(cr, uid, ids, context=context)[0] datas = { 'ids': context.get('active_ids',[]), 'model': 'crossovered.budget', diff --git a/addons/account_budget/wizard/account_budget_crossovered_summary_report.py b/addons/account_budget/wizard/account_budget_crossovered_summary_report.py index ad0237af051..c2e34b2f2da 100644 --- a/addons/account_budget/wizard/account_budget_crossovered_summary_report.py +++ b/addons/account_budget/wizard/account_budget_crossovered_summary_report.py @@ -41,7 +41,7 @@ class account_budget_crossvered_summary_report(osv.osv_memory): datas = {} if context is None: context = {} - data = self.read(cr, uid, ids)[0] + data = self.read(cr, uid, ids, context=context)[0] datas = { 'ids': context.get('active_ids',[]), 'model': 'crossovered.budge', diff --git a/addons/account_budget/wizard/account_budget_report.py b/addons/account_budget/wizard/account_budget_report.py index 67359cf45f1..a85ff42fe4d 100644 --- a/addons/account_budget/wizard/account_budget_report.py +++ b/addons/account_budget/wizard/account_budget_report.py @@ -40,7 +40,7 @@ class account_budget_report(osv.osv_memory): datas = {} if context is None: context = {} - data = self.read(cr, uid, ids)[0] + data = self.read(cr, uid, ids, context=context)[0] datas = { 'ids': context.get('active_ids',[]), 'model': 'account.budget.post', diff --git a/addons/account_coda/account_coda.py b/addons/account_coda/account_coda.py index ab3aa8c37f6..e2cde58fd5c 100644 --- a/addons/account_coda/account_coda.py +++ b/addons/account_coda/account_coda.py @@ -43,7 +43,8 @@ class account_coda(osv.osv): } def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): - if context is None: context = {} + if context is None: + context = {} res = super(account_coda, self).search(cr, user, args=args, offset=offset, limit=limit, order=order, context=context, count=count) if context.get('bank_statement', False) and not res: diff --git a/addons/account_coda/wizard/account_coda_import.py b/addons/account_coda/wizard/account_coda_import.py index 6219d210e53..6d3743116db 100644 --- a/addons/account_coda/wizard/account_coda_import.py +++ b/addons/account_coda/wizard/account_coda_import.py @@ -72,7 +72,7 @@ class account_coda_import(osv.osv_memory): data = self.read(cr, uid, ids)[0] codafile = data['coda'] - journal_code = journal_obj.browse(cr, uid, data['journal_id'], context).code + journal_code = journal_obj.browse(cr, uid, data['journal_id'], context=context).code period = account_period_obj.find(cr, uid, context=context)[0] def_pay_acc = data['def_payable'] diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index 611170dadf4..7d296f74f76 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -39,7 +39,7 @@ class account_followup_print(osv.osv_memory): context = {} if context.get('active_model', 'ir.ui.menu') == 'account_followup.followup': return context.get('active_id', False) - company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id + company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id followp_id = self.pool.get('account_followup.followup').search(cr, uid, [('company_id', '=', company_id)], context=context) return followp_id and followp_id[0] or False @@ -48,7 +48,7 @@ class account_followup_print(osv.osv_memory): if context is None: context = {} - data = self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context) resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] context.update({'followup_id': data['followup_id'], 'date':data['date']}) @@ -146,7 +146,7 @@ class account_followup_print_all(osv.osv_memory): if context is None: context = {} if ids: - data = self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] cr.execute( "SELECT l.partner_id, l.followup_line_id,l.date_maturity, l.date, l.id "\ "FROM account_move_line AS l "\ @@ -208,7 +208,7 @@ class account_followup_print_all(osv.osv_memory): if context is None: context = {} - data = self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all_msg')], context=context) resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] if data['email_conf']: @@ -306,7 +306,7 @@ class account_followup_print_all(osv.osv_memory): def do_print(self, cr, uid, ids, context=None): if context is None: context = {} - data = self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] res = self._get_partners_followp(cr, uid, ids, context)['to_update'] to_update = res data['followup_id'] = 'followup_id' in context and context['followup_id'] or False diff --git a/addons/account_invoice_layout/account_invoice_layout.py b/addons/account_invoice_layout/account_invoice_layout.py index 5945eb88442..3337710420f 100644 --- a/addons/account_invoice_layout/account_invoice_layout.py +++ b/addons/account_invoice_layout/account_invoice_layout.py @@ -127,13 +127,11 @@ class account_invoice_line(osv.osv): def copy_data(self, cr, uid, id, default=None, context=None): if default is None: default = {} - if context is None: context = {} default['state'] = self.browse(cr, uid, id, context=context).state return super(account_invoice_line, self).copy_data(cr, uid, id, default, context) def _fnct(self, cr, uid, ids, name, args, context=None): res = {} - if context is None: context = {} lines = self.browse(cr, uid, ids, context=context) account_ids = [line.account_id.id for line in lines] account_names = dict(self.pool.get('account.account').name_get(cr, uid, account_ids, context=context)) diff --git a/addons/account_invoice_layout/wizard/account_invoice_special_message.py b/addons/account_invoice_layout/wizard/account_invoice_special_message.py index adc3261fa64..a0bd6b328c3 100644 --- a/addons/account_invoice_layout/wizard/account_invoice_special_message.py +++ b/addons/account_invoice_layout/wizard/account_invoice_special_message.py @@ -34,7 +34,7 @@ class account_invoice_special_msg(osv.osv_memory): if context is None: context = {} - data = self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] datas = { 'ids': context.get('active_ids',[]), 'model': 'account.invoice', diff --git a/addons/account_payment/account_invoice.py b/addons/account_payment/account_invoice.py index 5876f138095..1f882b48421 100644 --- a/addons/account_payment/account_invoice.py +++ b/addons/account_payment/account_invoice.py @@ -31,7 +31,6 @@ class Invoice(osv.osv): if not ids: return {} res = {} - if context is None: context = {} for invoice in self.browse(cursor, user, ids, context=context): res[invoice.id] = 0.0 if invoice.move_id: diff --git a/addons/account_payment/account_move_line.py b/addons/account_payment/account_move_line.py index 12e2b53bedb..68bb33ca4e5 100644 --- a/addons/account_payment/account_move_line.py +++ b/addons/account_payment/account_move_line.py @@ -50,7 +50,6 @@ class account_move_line(osv.osv): def _to_pay_search(self, cr, uid, obj, name, args, context=None): if not args: return [] - if context is None: context = {} line_obj = self.pool.get('account.move.line') query = line_obj._query_get(cr, uid, context={}) where = ' and '.join(map(lambda x: '''(SELECT @@ -89,7 +88,6 @@ class account_move_line(osv.osv): """ payment_mode_obj = self.pool.get('payment.mode') line2bank = {} - if context is None: context = {} if not ids: return {} bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type, diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py index 10904e2d181..d5858d94f80 100644 --- a/addons/account_payment/account_payment.py +++ b/addons/account_payment/account_payment.py @@ -67,7 +67,6 @@ class payment_order(osv.osv): if not ids: return {} res = {} - if context is None: context = {} for order in self.browse(cursor, user, ids, context=context): if order.line_ids: res[order.id] = reduce(lambda x, y: x + y.amount, order.line_ids, 0.0) @@ -128,7 +127,6 @@ class payment_order(osv.osv): return True def copy(self, cr, uid, id, default={}, context=None): - if context is None: context = {} default.update({ 'state': 'draft', 'line_ids': [], @@ -272,7 +270,6 @@ class payment_line(osv.osv): def _get_currency(self, cr, uid, context=None): user_obj = self.pool.get('res.users') currency_obj = self.pool.get('res.currency') - if context is None: context = {} user = user_obj.browse(cr, uid, uid, context=context) if user.company_id: @@ -367,7 +364,7 @@ class payment_line(osv.osv): data['amount_currency'] = data['communication'] = data['partner_id'] = data['reference'] = data['date_created'] = data['bank_id'] = data['amount'] = False if move_line_id: - line = move_line_obj.browse(cr, uid, move_line_id) + line = move_line_obj.browse(cr, uid, move_line_id, context=context) data['amount_currency'] = line.amount_to_pay res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency, @@ -410,7 +407,6 @@ class payment_line(osv.osv): def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None): data = {} - if context is None: context = {} partner_zip_obj = self.pool.get('res.partner.zip') partner_obj = self.pool.get('res.partner') payment_mode_obj = self.pool.get('payment.mode') diff --git a/addons/account_payment/wizard/account_payment_order.py b/addons/account_payment/wizard/account_payment_order.py index 662ed495d31..b8328aee333 100644 --- a/addons/account_payment/wizard/account_payment_order.py +++ b/addons/account_payment/wizard/account_payment_order.py @@ -62,7 +62,7 @@ class payment_order_create(osv.osv_memory): payment_obj = self.pool.get('payment.line') if context is None: context = {} - data = self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] line_ids = data['entries'] if not line_ids: return {} diff --git a/addons/account_payment/wizard/account_payment_pay.py b/addons/account_payment/wizard/account_payment_pay.py index 8e524c78959..6627ffaa614 100644 --- a/addons/account_payment/wizard/account_payment_pay.py +++ b/addons/account_payment/wizard/account_payment_pay.py @@ -31,6 +31,8 @@ class account_payment_make_payment(osv.osv_memory): If type is manual. just confirm the order. """ obj_payment_order = self.pool.get('payment.order') + if context is None: + context = {} # obj_model = self.pool.get('ir.model.data') # obj_act = self.pool.get('ir.actions.act_window') # order = obj_payment_order.browse(cr, uid, context['active_id'], context) diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index bd61d58be3f..cac06bb472a 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -60,7 +60,7 @@ class account_payment_populate_statement(osv.osv_memory): if context is None: context = {} - data = self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] line_ids = data['lines'] if not line_ids: return {} diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py index 3c45604b726..1649a8890fa 100644 --- a/addons/account_sequence/account_sequence.py +++ b/addons/account_sequence/account_sequence.py @@ -30,11 +30,10 @@ class account_move(osv.osv): } def post(self, cr, uid, ids, context=None): - if context is None: context = {} obj_sequence = self.pool.get('ir.sequence') res = super(account_move, self).post(cr, uid, ids, context=context) seq_no = False - for move in self.browse(cr, uid, ids, context): + for move in self.browse(cr, uid, ids, context=context): if move.journal_id.internal_sequence_id: seq_no = obj_sequence.get_id(cr, uid, move.journal_id.internal_sequence_id.id, context=context) if seq_no: diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py index f7bcb113388..d27d0aa9f32 100644 --- a/addons/account_sequence/account_sequence_installer.py +++ b/addons/account_sequence/account_sequence_installer.py @@ -47,7 +47,7 @@ class account_sequence_installer(osv.osv_memory): context = {} jou_obj = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') - record = self.browse(cr, uid, ids, context)[0] + record = self.browse(cr, uid, ids, context=context)[0] j_ids = [] if record.company_id: company_id = record.company_id.id, @@ -70,7 +70,7 @@ class account_sequence_installer(osv.osv_memory): ir_seq = obj_sequence.create(cr, uid, vals, context) res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context) journal_ids = jou_obj.search(cr, uid, search_criteria, context=context) - for journal in jou_obj.browse(cr, uid, journal_ids, context): + for journal in jou_obj.browse(cr, uid, journal_ids, context=context): if not journal.internal_sequence_id: j_ids.append(journal.id) if j_ids: diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 401af122951..9dc496c5ec6 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -32,7 +32,6 @@ class account_move_line(osv.osv): def _unreconciled(self, cr, uid, ids, prop, unknow_none, context=None): res = {} - if context is None: context = {} for line in self.browse(cr, uid, ids, context=context): res[line.id] = line.debit - line.credit if line.reconcile_partial_id: @@ -299,7 +298,6 @@ class account_voucher(osv.osv): } voucher_total = 0.0 voucher_line_ids = [] - if context is None: context = {} total = 0.0 total_tax = 0.0 @@ -358,7 +356,6 @@ class account_voucher(osv.osv): default = { 'value':{}, } - if context is None: context = {} if not partner_id or not journal_id: return default @@ -530,7 +527,6 @@ class account_voucher(osv.osv): def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None): if not journal_id: return False - if context is None: context = {} journal_pool = self.pool.get('account.journal') journal = journal_pool.browse(cr, uid, journal_id, context=context) account_id = journal.default_credit_account_id or journal.default_debit_account_id @@ -560,7 +556,6 @@ class account_voucher(osv.osv): def cancel_voucher(self, cr, uid, ids, context=None): reconcile_pool = self.pool.get('account.move.reconcile') move_pool = self.pool.get('account.move') - if context is None: context = {} for voucher in self.browse(cr, uid, ids, context=context): recs = [] @@ -803,7 +798,6 @@ class account_voucher_line(osv.osv): def _compute_balance(self, cr, uid, ids, name, args, context=None): currency_pool = self.pool.get('res.currency') rs_data = {} - if context is None: context = {} for line in self.browse(cr, uid, ids, context=context): res = {} company_currency = line.voucher_id.journal_id.company_id.currency_id.id @@ -855,7 +849,6 @@ class account_voucher_line(osv.osv): @return: Returns a dict which contains new values, and context """ res = {} - if context is None: context = {} move_line_pool = self.pool.get('account.move.line') if move_line_id: move_line = move_line_pool.browse(cr, user, move_line_id, context=context) @@ -880,7 +873,8 @@ class account_voucher_line(osv.osv): @return: Returns a dict that contains default values for fields """ - if context is None: context = {} + if context is None: + context = {} journal_id = context.get('journal_id', False) partner_id = context.get('partner_id', False) journal_pool = self.pool.get('account.journal') @@ -917,7 +911,6 @@ class account_bank_statement(osv.osv): def button_cancel(self, cr, uid, ids, context=None): voucher_obj = self.pool.get('account.voucher') - if context is None: context = {} for st in self.browse(cr, uid, ids, context=context): voucher_ids = [] for line in st.line_ids: @@ -931,7 +924,6 @@ class account_bank_statement(osv.osv): wf_service = netsvc.LocalService("workflow") move_line_obj = self.pool.get('account.move.line') bank_st_line_obj = self.pool.get('account.bank.statement.line') - if context is None: context = {} st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context) if st_line.voucher_id: voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context) @@ -957,7 +949,6 @@ class account_bank_statement_line(osv.osv): return {} res = {} - if context is None: context = {} # company_currency_id = False for line in self.browse(cursor, user, ids, context=context): # if not company_currency_id: @@ -979,7 +970,6 @@ class account_bank_statement_line(osv.osv): } def unlink(self, cr, uid, ids, context=None): - if context is None: context = {} voucher_obj = self.pool.get('account.voucher') statement_line = self.browse(cr, uid, ids, context=context) unlink_ids = [] diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py index c8e90d283cc..0230cac1009 100644 --- a/addons/account_voucher/invoice.py +++ b/addons/account_voucher/invoice.py @@ -27,7 +27,6 @@ class invoice(osv.osv): def invoice_pay_customer(self, cr, uid, ids, context=None): if not ids: return [] - if context is None: context = {} inv = self.browse(cr, uid, ids[0], context=context) return { 'name':_("Pay Invoice"), diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py index df314012ccd..fa1a66e0135 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice.py +++ b/addons/account_voucher/wizard/account_statement_from_invoice.py @@ -35,7 +35,8 @@ class account_statement_from_invoice_lines(osv.osv_memory): } def populate_statement(self, cr, uid, ids, context=None): - if context is None: context = {} + if context is None: + context = {} statement_id = context.get('statement_id', False) if not statement_id: return {} @@ -134,7 +135,8 @@ class account_statement_from_invoice(osv.osv_memory): } def search_invoices(self, cr, uid, ids, context=None): - if context is None: context = {} + if context is None: + context = {} line_obj = self.pool.get('account.move.line') statement_obj = self.pool.get('account.bank.statement') journal_obj = self.pool.get('account.journal') diff --git a/addons/auction/auction.py b/addons/auction/auction.py index 7a12adb6721..983bdeb0144 100644 --- a/addons/auction/auction.py +++ b/addons/auction/auction.py @@ -59,7 +59,7 @@ class auction_dates(osv.osv): def name_get(self, cr, uid, ids, context=None): if not ids: return [] - reads = self.read(cr, uid, ids, ['name', 'auction1'], context) + reads = self.read(cr, uid, ids, ['name', 'auction1'], context=context) name = [(r['id'], '['+r['auction1']+'] '+ r['name']) for r in reads] return name @@ -193,7 +193,7 @@ class aie_category(osv.osv): res = [] if not ids: return res - reads = self.read(cr, uid, ids, ['name', 'parent_id'], context) + reads = self.read(cr, uid, ids, ['name', 'parent_id'], context=context) for record in reads: name = record['name'] if record['parent_id']: diff --git a/addons/auction/wizard/auction_aie_send.py b/addons/auction/wizard/auction_aie_send.py index 53f96c1263b..7c904cf850b 100644 --- a/addons/auction/wizard/auction_aie_send.py +++ b/addons/auction/wizard/auction_aie_send.py @@ -60,7 +60,8 @@ class auction_lots_send_aie(osv.osv_memory): @param context: A standard dictionary @return: A dictionary which of fields with values. """ - if context is None: context = {} + if context is None: + context = {} res = super(auction_lots_send_aie, self).default_get(cr, uid, fields, context=context) if 'uname' in fields and context.get('uname',False): res['uname'] = context.get('uname') @@ -149,7 +150,8 @@ class auction_lots_send_aie(osv.osv_memory): self._photo_bin_send(uname, passwd, ref, did, fname, bin) def get_dates(self, cr, uid, ids, context=None): - if context is None: context = {} + if context is None: + context = {} import httplib data_obj = self.pool.get('ir.model.data') conn = httplib.HTTPConnection('www.auction-in-europe.com') @@ -181,7 +183,8 @@ class auction_lots_send_aie(osv.osv_memory): cr.execute('select name,aie_categ from auction_lot_category') vals = dict(cr.fetchall()) cr.close() - if context is None: context = {} + if context is None: + context = {} service = netsvc.LocalService("object_proxy") lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids',[]), ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ']) diff --git a/addons/auction/wizard/auction_aie_send_result.py b/addons/auction/wizard/auction_aie_send_result.py index dd302ac73b5..5b2b4eca7fd 100644 --- a/addons/auction/wizard/auction_aie_send_result.py +++ b/addons/auction/wizard/auction_aie_send_result.py @@ -55,7 +55,8 @@ class auction_lots_pay(osv.osv_memory): @param context: A standard dictionary @return: A dictionary which of fields with values. """ - if context is None: context = {} + if context is None: + context = {} res = super(auction_lots_pay, self).default_get(cr, uid, fields, context=context) if 'uname' in fields and context.get('uname',False): res['uname'] = context.get('uname') @@ -98,7 +99,8 @@ class auction_lots_pay(osv.osv_memory): return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),)) def get_dates(self, cr, uid, ids, context=None): - if context is None: context = {} + if context is None: + context = {} import httplib conn = httplib.HTTPConnection('www.auction-in-europe.com') data_obj = self.pool.get('ir.model.data') @@ -127,7 +129,8 @@ class auction_lots_pay(osv.osv_memory): } def send(self, cr, uid, ids, context=None): - if context is None: context = {} + if context is None: + context = {} import pickle service = netsvc.LocalService("object_proxy") datas = self.read(cr, uid, ids[0],['uname','password','dates']) diff --git a/addons/auction/wizard/auction_catalog_flagey_report.py b/addons/auction/wizard/auction_catalog_flagey_report.py index ef626bca57f..03c8236c55c 100644 --- a/addons/auction/wizard/auction_catalog_flagey_report.py +++ b/addons/auction/wizard/auction_catalog_flagey_report.py @@ -53,7 +53,8 @@ class auction_catalog_flagey(osv.osv_memory): """ lots_obj = self.pool.get('auction.lots') auc_dates_obj = self.pool.get('auction.dates') - if context is None: context = {} + if context is None: + context = {} current_auction = auc_dates_obj.browse(cr, uid, context.get('active_ids', [])) v_lots = lots_obj.search(cr, uid, [('auction_id','=',current_auction.id)]) v_ids = lots_obj.browse(cr, uid, v_lots, context=context) @@ -72,7 +73,8 @@ class auction_catalog_flagey(osv.osv_memory): @param context: A standard dictionary @return: Report """ - if context is None: context = {} + if context is None: + context = {} datas = {'ids': context.get('active_ids',[])} return { 'type': 'ir.actions.report.xml', diff --git a/addons/auction/wizard/auction_lots_able.py b/addons/auction/wizard/auction_lots_able.py index d9da89385a1..369d762727a 100644 --- a/addons/auction/wizard/auction_lots_able.py +++ b/addons/auction/wizard/auction_lots_able.py @@ -38,7 +38,8 @@ class auction_lots_able(osv.osv_memory): @param uid: the current user’s ID for security checks, @param ids: List of auction lots able’s IDs. """ - if context is None: context = {} + if context is None: + context = {} self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'ach_emp':True}) return {} diff --git a/addons/auction/wizard/auction_lots_buyer_map.py b/addons/auction/wizard/auction_lots_buyer_map.py index 0ab08e0cd03..e50f11fd1ec 100644 --- a/addons/auction/wizard/auction_lots_buyer_map.py +++ b/addons/auction/wizard/auction_lots_buyer_map.py @@ -42,7 +42,8 @@ class wiz_auc_lots_buyer_map(osv.osv_memory): @param context: A standard dictionary @return: A dictionary which of fields with values. """ - if context is None: context = {} + if context is None: + context = {} res = super(wiz_auc_lots_buyer_map,self).default_get(cr, uid, fields, context=context) auction_lots_obj = self.pool.get('auction.lots') lots_ids = auction_lots_obj.search(cr, uid, [('ach_uid', '=', ''), ('ach_login', '!=', '')]) diff --git a/addons/auction/wizard/auction_lots_enable.py b/addons/auction/wizard/auction_lots_enable.py index 41b6ec909cc..ed6b8950d2e 100644 --- a/addons/auction/wizard/auction_lots_enable.py +++ b/addons/auction/wizard/auction_lots_enable.py @@ -35,7 +35,8 @@ class auction_lots_enable(osv.osv_memory): @param uid: the current user’s ID for security checks, @param ids: List of auction lots enable’s IDs. """ - if context is None: context = {} + if context is None: + context = {} self.pool.get('auction.lots').write(cr, uid, context.get('active_id',False), {'ach_emp':False}) return {} diff --git a/addons/auction/wizard/auction_lots_invoice.py b/addons/auction/wizard/auction_lots_invoice.py index ac296ec1dd7..66bb5e42f2b 100644 --- a/addons/auction/wizard/auction_lots_invoice.py +++ b/addons/auction/wizard/auction_lots_invoice.py @@ -46,7 +46,8 @@ class auction_lots_invoice(osv.osv_memory): @param context: A standard dictionary @return: A dictionary which of fields with values. """ - if context is None: context = {} + if context is None: + context = {} res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context) service = netsvc.LocalService("object_proxy") lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids', [])) @@ -102,7 +103,8 @@ class auction_lots_invoice(osv.osv_memory): @param ids: List of Auction lots make invoice buyer’s IDs @return: dictionary of account invoice form. """ - if context is None: context = {} + if context is None: + context = {} service = netsvc.LocalService("object_proxy") datas = {'ids' : context.get('active_ids',[])} res = self.read(cr, uid, ids, ['number','ach_uid']) diff --git a/addons/auction/wizard/auction_lots_numerotate.py b/addons/auction/wizard/auction_lots_numerotate.py index 5085ba39134..0712e21565e 100644 --- a/addons/auction/wizard/auction_lots_numerotate.py +++ b/addons/auction/wizard/auction_lots_numerotate.py @@ -91,7 +91,6 @@ class auction_lots_numerotate_per_lot(osv.osv_memory): } def numerotate(self, cr, uid, ids, context=None): - if context is None: context = {} record_ids = context and context.get('active_ids',False) or False assert record_ids, _('Active IDs not Found') datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num','obj_num']) @@ -134,7 +133,6 @@ class auction_lots_numerotate_per_lot(osv.osv_memory): return lots_datas[0] def test_exist(self, cr, uid, ids, context=None): - if context is None: context = {} record_ids = context and context.get('active_ids',False) or False assert record_ids, _('Active IDs not Found') data_obj = self.pool.get('ir.model.data') diff --git a/addons/auction/wizard/auction_lots_sms_send.py b/addons/auction/wizard/auction_lots_sms_send.py index ea1d094f55b..93faab41275 100644 --- a/addons/auction/wizard/auction_lots_sms_send.py +++ b/addons/auction/wizard/auction_lots_sms_send.py @@ -48,7 +48,7 @@ class auction_lots_sms_send(osv.osv_memory): lot_obj = self.pool.get('auction.lots') partner_obj = self.pool.get('res.partner') partner_address_obj = self.pool.get('res.partner.address') - for data in self.read(cr, uid, ids): + for data in self.read(cr, uid, ids, context=context): lots = lot_obj.read(cr, uid, context.get('active_ids', []), ['obj_num','obj_price','ach_uid']) res = partner_obj.read(cr, uid, [l['ach_uid'][0] for l in lots if l['ach_uid']], ['gsm'], context) diff --git a/addons/auction/wizard/auction_pay_sel.py b/addons/auction/wizard/auction_pay_sel.py index 23b16743246..7265a4e7f98 100644 --- a/addons/auction/wizard/auction_pay_sel.py +++ b/addons/auction/wizard/auction_pay_sel.py @@ -42,7 +42,8 @@ class auction_pay_sel(osv.osv_memory): @param context: A standard dictionary @return: """ - if context is None: context = {} + if context is None: + context = {} lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context=context) invoice_obj = self.pool.get('account.invoice') for datas in self.read(cr, uid, ids, context=context): diff --git a/addons/auction/wizard/auction_payer_sel.py b/addons/auction/wizard/auction_payer_sel.py index f1df4d1cd47..808826cfc23 100644 --- a/addons/auction/wizard/auction_payer_sel.py +++ b/addons/auction/wizard/auction_payer_sel.py @@ -26,7 +26,8 @@ class auction_payer(osv.osv_memory): _description = "Auction payer" def payer(self, cr, uid, ids, context=None): - if context is None: context = {} + if context is None: + context = {} self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'is_ok':True, 'state':'paid'}) return {} @@ -46,7 +47,8 @@ class auction_payer_sel(osv.osv_memory): @param uid: the current user’s ID for security checks, @param ids: List of auction payer sel’s IDs. """ - if context is None: context = {} + if context is None: + context = {} self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'paid_vnd':True}) return {} diff --git a/addons/audittrail/wizard/audittrail_view_log.py b/addons/audittrail/wizard/audittrail_view_log.py index 7d3894c8a1d..65165c1d2d8 100644 --- a/addons/audittrail/wizard/audittrail_view_log.py +++ b/addons/audittrail/wizard/audittrail_view_log.py @@ -46,8 +46,8 @@ class audittrail_view_log(osv.osv_memory): mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') result = mod_obj._get_id(cr, uid, 'audittrail', 'action_audittrail_log_tree') - id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id'] - result = act_obj.read(cr, uid, [id])[0] + id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id'] + result = act_obj.read(cr, uid, [id], context=context)[0] #start Loop for datas in self.read(cr, uid, ids, context=context): diff --git a/addons/base_calendar/wizard/base_calendar_set_exrule.py b/addons/base_calendar/wizard/base_calendar_set_exrule.py index fa65c27f72c..4f5d57235e5 100644 --- a/addons/base_calendar/wizard/base_calendar_set_exrule.py +++ b/addons/base_calendar/wizard/base_calendar_set_exrule.py @@ -82,7 +82,8 @@ class base_calendar_set_exrule(osv.osv_memory): @param fields: List of fields for default value @param context: A standard dictionary for contextual values """ - if context is None: context = {} + if context is None: + context = {} event_obj = self.pool.get(context.get('active_model')) for event in event_obj.browse(cr, uid, context.get('active_ids', []), context=context): if not event.rrule: @@ -103,7 +104,8 @@ class base_calendar_set_exrule(osv.osv_memory): weekstring = '' monthstring = '' yearstring = '' - if context is None: context = {} + if context is None: + context = {} ex_id = base_calendar.base_calendar_id2real_id(context.get('active_id', False)) model = context.get('model', False) model_obj = self.pool.get(model) diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py index 9342bf812b2..8a003ec7cf1 100644 --- a/addons/base_contact/base_contact.py +++ b/addons/base_contact/base_contact.py @@ -131,7 +131,8 @@ class res_partner_address(osv.osv): if not len(ids): return [] res = [] - if context is None: context = {} + if context is None: + context = {} for r in self.read(cr, user, ids, ['zip', 'city', 'partner_id', 'street']): if context.get('contact_display', 'contact')=='partner' and r['partner_id']: res.append((r['id'], r['partner_id'][1])) @@ -169,7 +170,7 @@ class res_partner_job(osv.osv): return [] res = [] - jobs = self.browse(cr, uid, ids) + jobs = self.browse(cr, uid, ids, context=context) contact_ids = [rec.contact_id.id for rec in jobs] contact_names = dict(self.pool.get('res.partner.contact').name_get(cr, uid, contact_ids, context=context)) diff --git a/addons/base_report_creator/wizard/report_menu_create.py b/addons/base_report_creator/wizard/report_menu_create.py index 9f6eba3f806..efa61c556d1 100644 --- a/addons/base_report_creator/wizard/report_menu_create.py +++ b/addons/base_report_creator/wizard/report_menu_create.py @@ -52,7 +52,7 @@ class report_menu_create(osv.osv_memory): return {} data = data[0] - board = obj_board.browse(cr, uid, context_id) + board = obj_board.browse(cr, uid, context_id, context=context) view = board.view_type1 if board.view_type2: view += ',' + board.view_type2 diff --git a/addons/base_report_designer/wizard/base_report_designer_modify.py b/addons/base_report_designer/wizard/base_report_designer_modify.py index fef2d1c56af..d0790cdc0ad 100644 --- a/addons/base_report_designer/wizard/base_report_designer_modify.py +++ b/addons/base_report_designer/wizard/base_report_designer_modify.py @@ -39,7 +39,7 @@ class base_report_sxw(osv.osv_memory): def get_report(self, cr, uid, ids, context=None): - data = self.read(cr,uid,ids)[0] + data = self.read(cr, uid, ids, context=context)[0] data_obj = self.pool.get('ir.model.data') id2 = data_obj._get_id(cr, uid, 'base_report_designer', 'view_base_report_file_sxw') report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context) @@ -76,7 +76,7 @@ class base_report_file_sxw(osv.osv_memory): """ res = super(base_report_file_sxw, self).default_get(cr, uid, fields, context=context) report_id1 = self.pool.get('base.report.sxw').search(cr,uid,[]) - data=self.pool.get('base.report.sxw').read(cr,uid,report_id1)[0] + data = self.pool.get('base.report.sxw').read(cr, uid, report_id1, context=context)[0] report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context) if context is None: context={} @@ -137,7 +137,7 @@ class base_report_rml_save(osv.osv_memory): res = super(base_report_rml_save, self).default_get(cr, uid, fields, context=context) report_id = self.pool.get('base.report.sxw').search(cr,uid,[]) - data=self.pool.get('base.report.file.sxw').read(cr,uid,report_id)[0] + data = self.pool.get('base.report.file.sxw').read(cr, uid, report_id, context=context)[0] report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context) if 'file_rml' in fields: diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py index bb2f19334d8..e7269b7ed89 100644 --- a/addons/caldav/calendar.py +++ b/addons/caldav/calendar.py @@ -656,7 +656,7 @@ class Calendar(CalDAV, osv.osv): ctx_model = context.get('model', None) ctx_res_id = context.get('res_id', None) ical = vobject.iCalendar() - for cal in self.browse(cr, uid, ids): + for cal in self.browse(cr, uid, ids, context=context): for line in cal.line_ids: if ctx_model and ctx_model != line.object_id.model: continue @@ -1124,8 +1124,6 @@ class Alarm(CalDAV, osv.osv_memory): @param alarm_id: Get Alarm's Id @param context: A standard dictionary for contextual values """ - if context is None: - context = {} valarm = vevent.add('valarm') alarm_object = self.pool.get(model) alarm_data = alarm_object.read(cr, uid, alarm_id, []) @@ -1159,7 +1157,8 @@ class Alarm(CalDAV, osv.osv_memory): @param ical_data: Get calendar's Data @param context: A standard dictionary for contextual values """ - + if context is None: + context = {} ctx = context.copy() ctx.update({'model': context.get('model', None)}) self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, ctx) @@ -1221,7 +1220,8 @@ class Attendee(CalDAV, osv.osv_memory): @param ical_data: Get calendar's Data @param context: A standard dictionary for contextual values """ - + if context is None: + context = {} ctx = context.copy() ctx.update({'model': context.get('model', None)}) self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, ctx) diff --git a/addons/caldav/wizard/calendar_event_import.py b/addons/caldav/wizard/calendar_event_import.py index 51d7e007fcf..fc54d6e77df 100644 --- a/addons/caldav/wizard/calendar_event_import.py +++ b/addons/caldav/wizard/calendar_event_import.py @@ -48,7 +48,7 @@ class calendar_event_import(osv.osv_memory): context = context.copy() context['uid'] = uid - for data in self.read(cr, uid, ids): + for data in self.read(cr, uid, ids, context=context): model = data.get('model', 'basic.calendar') model_obj = self.pool.get(model) context.update({'model': model}) diff --git a/addons/caldav/wizard/calendar_event_subscribe.py b/addons/caldav/wizard/calendar_event_subscribe.py index f8dc7614507..f4f9e22cc60 100644 --- a/addons/caldav/wizard/calendar_event_subscribe.py +++ b/addons/caldav/wizard/calendar_event_subscribe.py @@ -50,7 +50,7 @@ class calendar_event_subscribe(osv.osv_memory): context = context.copy() context['uid'] = uid - for data in self.read(cr, uid, ids): + for data in self.read(cr, uid, ids, context=context): try: f = urllib.urlopen(data['url_path']) caldata = f.fp.read() diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index b520ab4bb64..69b27e0393c 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -281,9 +281,9 @@ class crm_lead(crm_case, osv.osv): } return value - def write(self, cr, uid, ids, vals, context={}): + def write(self, cr, uid, ids, vals, context=None): if 'date_closed' in vals: - return super(crm_lead,self).write(cr, uid, ids, vals, context) + return super(crm_lead,self).write(cr, uid, ids, vals, context=context) if 'stage_id' in vals and vals['stage_id']: stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, vals['stage_id'], context=context) @@ -297,7 +297,7 @@ class crm_lead(crm_case, osv.osv): return super(crm_lead,self).write(cr, uid, ids, vals, context) def stage_next(self, cr, uid, ids, context=None): - stage = super(crm_lead, self).stage_next(cr, uid, ids, context) + stage = super(crm_lead, self).stage_next(cr, uid, ids, context=context) if stage: stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage, context=context) if stage_obj.on_change: diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index e5d7190f5d3..cc12caf315c 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -176,8 +176,6 @@ class res_users(osv.osv): _inherit = 'res.users' def create(self, cr, uid, data, context=None): - if context is None: - context = {} user_id = super(res_users, self).create(cr, uid, data, context=context) data_obj = self.pool.get('ir.model.data') try: diff --git a/addons/crm/wizard/crm_phonecall_to_meeting.py b/addons/crm/wizard/crm_phonecall_to_meeting.py index 06c46b8bf55..3f726af15ef 100644 --- a/addons/crm/wizard/crm_phonecall_to_meeting.py +++ b/addons/crm/wizard/crm_phonecall_to_meeting.py @@ -32,8 +32,6 @@ import pooler class phonecall2meeting(wizard.interface): def _makeMeeting(self, cr, uid, data, context=None): - if context is None: - context = {} pool = pooler.get_pool(cr.dbname) phonecall_case_obj = pool.get('crm.phonecall') data_obj = pool.get('ir.model.data') diff --git a/addons/document/directory_content.py b/addons/document/directory_content.py index cd0c44584a7..e690e50d4b4 100644 --- a/addons/document/directory_content.py +++ b/addons/document/directory_content.py @@ -110,8 +110,6 @@ class document_directory_content(osv.osv): return True def process_read(self, cr, uid, node, context=None): - if context is None: - context = {} if node.extension != '.pdf': raise Exception("Invalid content: %s" % node.extension) report = self.pool.get('ir.actions.report.xml').browse(cr, uid, node.report_id, context=context) diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 1f7d1e15807..2a3f54f53ba 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -196,7 +196,7 @@ class document_directory(osv.osv): else: raise ValueError("dir node for %s type", dbro.type) - def _prepare_context(self, cr, uid, nctx, context): + def _prepare_context(self, cr, uid, nctx, context=None): """ Fill nctx with properties for this database @param nctx instance of nodes.node_context, to be filled @param context ORM context (dict) for us @@ -210,7 +210,7 @@ class document_directory(osv.osv): """ return - def get_dir_permissions(self, cr, uid, ids, context=None ): + def get_dir_permissions(self, cr, uid, ids, context=None): """Check what permission user 'uid' has on directory 'id' """ assert len(ids) == 1 diff --git a/addons/document_ics/document_ics.py b/addons/document_ics/document_ics.py index 82a672c2006..45b89997287 100644 --- a/addons/document_ics/document_ics.py +++ b/addons/document_ics/document_ics.py @@ -347,7 +347,6 @@ class crm_meeting(osv.osv): """ if not default: default = {} - if context is None: context = {} default.update({'code': self.pool.get('ir.sequence').get(cr, uid, 'crm.meeting'), 'id': False}) return super(crm_meeting, self).copy(cr, uid, id, default, context) diff --git a/addons/document_ics/document_ics_config_wizard.py b/addons/document_ics/document_ics_config_wizard.py index 51ccab59204..5c338cf6dd0 100644 --- a/addons/document_ics/document_ics_config_wizard.py +++ b/addons/document_ics/document_ics_config_wizard.py @@ -78,7 +78,7 @@ class document_ics_crm_wizard(osv.osv_memory): @param ids: List of Document CRM wizard’s IDs @param context: A standard dictionary for contextual values """ - data=self.read(cr, uid, ids, [])[0] + data = self.read(cr, uid, ids, [], context=context)[0] dir_obj = self.pool.get('document.directory') dir_cont_obj = self.pool.get('document.directory.content') dir_id = dir_obj.search(cr, uid, [('name', '=', 'Calendars')]) diff --git a/addons/email_template/email_template_mailbox.py b/addons/email_template/email_template_mailbox.py index 738c9034366..2fb3b0fa54c 100644 --- a/addons/email_template/email_template_mailbox.py +++ b/addons/email_template/email_template_mailbox.py @@ -40,7 +40,7 @@ class email_template_mailbox(osv.osv): to periodically send emails """ try: - self.send_all_mail(cursor, user, context) + self.send_all_mail(cursor, user, context=context) except Exception, e: LOGGER.notifyChannel( "Email Template", diff --git a/addons/event/event.py b/addons/event/event.py index dd0ad21157b..b18f7618985 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -104,8 +104,6 @@ class event_event(osv.osv): res = False if type(ids) in (int, long,): ids = [ids] - if context is None: - context = {} data_pool = self.pool.get('ir.model.data') unconfirmed_ids = [] for event in self.browse(cr, uid, ids, context=context): @@ -267,8 +265,6 @@ class event_event(osv.osv): """ if not team_id: return {} - if context is None: - context = {} team_pool = self.pool.get('crm.case.section') res = {} team = team_pool.browse(cr, uid, team_id, context=context) @@ -287,7 +283,6 @@ class event_registration(osv.osv): def _amount_line(self, cr, uid, ids, field_name, arg, context=None): cur_obj = self.pool.get('res.currency') res = {} - context = context or {} for line in self.browse(cr, uid, ids, context=context): price = line.unit_price * line.nb_register pricelist = line.event_id.pricelist_id or line.partner_invoice_id.property_product_pricelist @@ -490,8 +485,6 @@ class event_registration(osv.osv): """ data_pool = self.pool.get('ir.model.data') unclosed_ids = [] - if context is None: - context = {} for registration in self.browse(cr, uid, ids, context=context): if registration.tobe_invoiced and not registration.invoice_id: unclosed_ids.append(registration.id) diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py index 8e1d11716c2..c885fdf30bd 100644 --- a/addons/hr/hr_department.py +++ b/addons/hr/hr_department.py @@ -38,8 +38,6 @@ class hr_department(osv.osv): return res def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None): - if context is None: - context = {} res = self.name_get(cr, uid, ids, context=context) return dict(res) @@ -58,8 +56,6 @@ class hr_department(osv.osv): } def _get_members(self, cr, uid, context=None): - if context is None: - context = {} mids = self.search(cr, uid, [('manager_id', '=', uid)], context=context) result = {uid: 1} for m in self.browse(cr, uid, mids, context=context): diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 087a80c6bc5..584340d6c1d 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -38,8 +38,6 @@ class hr_action_reason(osv.osv): hr_action_reason() def _employee_get(obj, cr, uid, context=None): - if context is None: - context = {} ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context) return ids and ids[0] or False @@ -48,8 +46,6 @@ class hr_attendance(osv.osv): _description = "Attendance" def _day_compute(self, cr, uid, ids, fieldnames, args, context=None): - if context is None: - context = {} res = dict.fromkeys(ids, '') for obj in self.browse(cr, uid, ids, context=context): res[obj.id] = time.strftime('%Y-%m-%d', time.strptime(obj.name, '%Y-%m-%d %H:%M:%S')) @@ -93,8 +89,6 @@ class hr_employee(osv.osv): _description = "Employee" def _state(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} result = {} if not ids: return result @@ -120,16 +114,12 @@ class hr_employee(osv.osv): } def _action_check(self, cr, uid, emp_id, dt=False, context=None): - if context is None: - context = {} cr.execute('SELECT MAX(name) FROM hr_attendance WHERE employee_id=%s', (emp_id,)) res = cr.fetchone() return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S')))) def attendance_action_change(self, cr, uid, ids, type='action', context=None, dt=False, *args): obj_attendance = self.pool.get('hr.attendance') - if context is None: - context = {} id = False warning_sign = 'sign' res = {} diff --git a/addons/hr_attendance/wizard/hr_attendance_bymonth.py b/addons/hr_attendance/wizard/hr_attendance_bymonth.py index 7d673b825f8..6f44729c01b 100644 --- a/addons/hr_attendance/wizard/hr_attendance_bymonth.py +++ b/addons/hr_attendance/wizard/hr_attendance_bymonth.py @@ -36,8 +36,6 @@ class hr_attendance_bymonth(osv.osv_memory): } def print_report(self, cr, uid, ids, context=None): - if context is None: - context = {} datas = { 'ids': [], 'model': 'hr.employee', diff --git a/addons/hr_attendance/wizard/hr_attendance_byweek.py b/addons/hr_attendance/wizard/hr_attendance_byweek.py index f969e88b66b..139ff94cd5a 100644 --- a/addons/hr_attendance/wizard/hr_attendance_byweek.py +++ b/addons/hr_attendance/wizard/hr_attendance_byweek.py @@ -35,8 +35,6 @@ class hr_attendance_byweek(osv.osv_memory): } def print_report(self, cr, uid, ids, context=None): - if context is None: - context = {} datas = { 'ids': [], 'model': 'hr.employee', diff --git a/addons/hr_attendance/wizard/hr_attendance_error.py b/addons/hr_attendance/wizard/hr_attendance_error.py index c3b31bb6491..bb181268195 100644 --- a/addons/hr_attendance/wizard/hr_attendance_error.py +++ b/addons/hr_attendance/wizard/hr_attendance_error.py @@ -39,8 +39,6 @@ class hr_attendance_error(osv.osv_memory): } def print_report(self, cr, uid, ids, context=None): - if context is None: - context = {} emp_ids = [] data_error = self.read(cr, uid, ids, context=context)[0] date_from = data_error['init_date'] diff --git a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py index 09f9f9364c5..4e079584053 100644 --- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py +++ b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py @@ -33,8 +33,6 @@ class hr_si_so_ask(osv.osv_memory): } def _get_empname(self, cr, uid, context=None): - if context is None: - context = {} emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context) if emp_id: employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0].name @@ -53,14 +51,10 @@ class hr_si_so_ask(osv.osv_memory): } def sign_in(self, cr, uid, ids, context=None): - if context is None: - context = {} data = self.read(cr, uid, ids, [], context=context)[0] return self.pool.get('hr.sign.in.out').sign_in(cr, uid, data, context) def sign_out(self, cr, uid, ids, context=None): - if context is None: - context = {} data = self.read(cr, uid, ids, [], context=context)[0] return self.pool.get('hr.sign.in.out').sign_out(cr, uid, data, context) @@ -78,8 +72,6 @@ class hr_sign_in_out(osv.osv_memory): } def _get_empid(self, cr, uid, context=None): - if context is None: - context = {} emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context) if emp_id: employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0] @@ -87,8 +79,6 @@ class hr_sign_in_out(osv.osv_memory): return {} def default_get(self, cr, uid, fields_list, context=None): - if context is None: - context = {} res = super(hr_sign_in_out, self).default_get(cr, uid, fields_list, context=context) res_emp = self._get_empid(cr, uid, context=context) res.update(res_emp) @@ -97,8 +87,6 @@ class hr_sign_in_out(osv.osv_memory): def si_check(self, cr, uid, ids, context=None): obj_model = self.pool.get('ir.model.data') att_obj = self.pool.get('hr.attendance') - if context is None: - context = {} data = self.read(cr, uid, ids, [], context=context)[0] emp_id = data['emp_id'] att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id)], limit=1, order='name desc') @@ -124,8 +112,6 @@ class hr_sign_in_out(osv.osv_memory): def so_check(self, cr, uid, ids, context=None): obj_model = self.pool.get('ir.model.data') att_obj = self.pool.get('hr.attendance') - if context is None: - context = {} data = self.read(cr, uid, ids, [], context=context)[0] emp_id = data['emp_id'] att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action', '!=', 'action')], limit=1, order='name desc') @@ -177,8 +163,6 @@ class hr_sign_in_out(osv.osv_memory): return {} # To do: Return Success message def sign_out(self, cr, uid, data, context=None): - if context is None: - context = {} emp_id = data['emp_id'] if 'last_time' in data: if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'): diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index 4e635f5f594..58631761fa9 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -106,8 +106,6 @@ class hr_employee(osv.osv): def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None): obj_evaluation = self.pool.get('hr_evaluation.evaluation') - if context is None: - context = {} 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"): @@ -116,8 +114,6 @@ class hr_employee(osv.osv): return True def onchange_evaluation_plan_id(self, cr, uid, ids, evaluation_plan_id, evaluation_date, context=None): - if context is None: - context = {} if evaluation_plan_id: evaluation_plan_obj=self.pool.get('hr_evaluation.plan') obj_evaluation = self.pool.get('hr_evaluation.evaluation') @@ -135,8 +131,6 @@ class hr_employee(osv.osv): return {'value': {'evaluation_date': evaluation_date}} def create(self, cr, uid, vals, context=None): - if context is None: - 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) @@ -180,8 +174,6 @@ class hr_evaluation(osv.osv): } def name_get(self, cr, uid, ids, context=None): - if context is None: - context = {} if not ids: return [] reads = self.browse(cr, uid, ids, context=context) @@ -192,8 +184,6 @@ class hr_evaluation(osv.osv): return res def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): - if context is None: - context = {} evaluation_plan_id=False if employee_id: employee_obj=self.pool.get('hr.employee') @@ -246,8 +236,6 @@ class hr_evaluation(osv.osv): def button_final_validation(self, cr, uid, ids, context=None): request_obj = self.pool.get('hr.evaluation.interview') - if context is None: - context = {} self.write(cr, uid, ids, {'state':'progress'}, 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)): @@ -255,21 +243,15 @@ class hr_evaluation(osv.osv): return True def button_done(self,cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids,{'progress': 1 * 100}, context=context) self.write(cr, uid, ids,{'state':'done', 'date_close': time.strftime('%Y-%m-%d')}, context=context) return True def button_cancel(self, cr, uid, ids, context=None): - if context is None: - 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 = {} if 'date' in vals: new_vals = {'date_deadline': vals.get('date')} obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview') @@ -306,8 +288,6 @@ class hr_evaluation_interview(osv.osv): } def name_get(self, cr, uid, ids, context=None): - if context is None: - context = {} if not ids: return [] reads = self.browse(cr, uid, ids, context=context) @@ -318,15 +298,11 @@ class hr_evaluation_interview(osv.osv): 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) return True def survey_req_done(self, cr, uid, ids, context=None): hr_eval_obj = self.pool.get('hr_evaluation.evaluation') - if context is None: - context = {} for id in self.browse(cr, uid, ids, context=context): flag = False wating_id = 0 @@ -349,14 +325,10 @@ class hr_evaluation_interview(osv.osv): return True def survey_req_draft(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, { 'state': 'draft'}, context=context) return True def survey_req_cancel(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, { 'state': 'cancel'}, context=context) return True diff --git a/addons/hr_evaluation/wizard/hr_evaluation_mail.py b/addons/hr_evaluation/wizard/hr_evaluation_mail.py index 3464c4beaee..17ad7415cb5 100644 --- a/addons/hr_evaluation/wizard/hr_evaluation_mail.py +++ b/addons/hr_evaluation/wizard/hr_evaluation_mail.py @@ -30,8 +30,6 @@ class hr_evaluation_reminder(osv.osv_memory): def send_mail(self, cr, uid, ids, context=None): hr_evaluation_interview_obj = self.pool.get('hr.evaluation.interview') - if context is None: - context = {} evaluation_data = self.read(cr, uid, ids, context=context)[0] current_interview = hr_evaluation_interview_obj.browse(cr, uid, evaluation_data.get('evaluation_id')) if current_interview.state == "waiting_answer" and current_interview.user_to_review_id.work_email : diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 638d6eb19fb..acec2f3a240 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -43,15 +43,11 @@ class hr_expense_expense(osv.osv): return super(hr_expense_expense, self).copy(cr, uid, id, default, context=context) def _amount(self, cr, uid, ids, field_name, arg, context=None): - if context is None: - context = {} cr.execute("SELECT s.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_expense s LEFT OUTER JOIN hr_expense_line l ON (s.id=l.expense_id) WHERE s.id IN %s GROUP BY s.id ", (tuple(ids),)) res = dict(cr.fetchall()) return res def _get_currency(self, cr, uid, context=None): - if context is None: - context = {} user = self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0] if user.company_id: return user.company_id.currency_id.id @@ -217,8 +213,6 @@ class hr_expense_line(osv.osv): _description = "Expense Line" def _amount(self, cr, uid, ids, field_name, arg, context=None): - if context is None: - context = {} 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),)) @@ -246,8 +240,6 @@ class hr_expense_line(osv.osv): _order = "sequence, date_value desc" def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None): - if context is None: - context = {} res = {} if product_id: product = self.pool.get('product.product').browse(cr, uid, product_id, context=context) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 4194ff402be..314e053ac12 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -36,8 +36,6 @@ class hr_holidays_status(osv.osv): _description = "Leave Type" def get_days_cat(self, cr, uid, ids, category_id, return_false, context=None): - if context is None: - context = {} cr.execute("""SELECT id, type, number_of_days, holiday_status_id FROM hr_holidays WHERE category_id = %s AND state='validate' AND holiday_status_id in %s""", [category_id, tuple(ids)]) @@ -61,8 +59,6 @@ class hr_holidays_status(osv.osv): return res def get_days(self, cr, uid, ids, employee_id, return_false, context=None): - if context is None: - context = {} cr.execute("""SELECT id, type, number_of_days, holiday_status_id FROM hr_holidays WHERE employee_id = %s AND state='validate' AND holiday_status_id in %s""", [employee_id, tuple(ids)]) @@ -86,8 +82,6 @@ class hr_holidays_status(osv.osv): return res def _user_left_days(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} return_false = False employee_id = False res = {} @@ -133,8 +127,6 @@ class hr_holidays(osv.osv): _order = "type desc, date_from asc" def _employee_get(obj, cr, uid, context=None): - if context is None: - context = {} ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context) if ids: return ids[0] @@ -177,16 +169,12 @@ class hr_holidays(osv.osv): def _create_resource_leave(self, cr, uid, vals, context=None): '''This method will create entry in resource calendar leave object at the time of holidays validated ''' - if context is None: - context = {} obj_res_leave = self.pool.get('resource.calendar.leaves') return obj_res_leave.create(cr, uid, vals, context=context) def _remove_resouce_leave(self, cr, uid, ids, context=None): '''This method will create entry in resource calendar leave object at the time of holidays cancel/removed''' obj_res_leave = self.pool.get('resource.calendar.leaves') - if context is None: - context = {} leave_ids = obj_res_leave.search(cr, uid, [('holiday_id', 'in', ids)], context=context) return obj_res_leave.unlink(cr, uid, leave_ids) @@ -205,8 +193,6 @@ class hr_holidays(osv.osv): return super(hr_holidays, self).create(cr, uid, vals, context=context) def write(self, cr, uid, ids, vals, context=None): - if context is None: - context = {} if 'holiday_type' in vals: if vals['holiday_type'] == 'employee': vals.update({'category_id': False}) @@ -260,8 +246,6 @@ class hr_holidays(osv.osv): _constraints = [(_check_date, 'Start date should not be larger than end date!\nNumber of Days should be greater than 1!', ['number_of_days_temp'])] def unlink(self, cr, uid, ids, context=None): - if context is None: - context = {} self._update_user_holidays(cr, uid, ids) self._remove_resouce_leave(cr, uid, ids, context=context) return super(hr_holidays, self).unlink(cr, uid, ids, context) @@ -283,8 +267,6 @@ class hr_holidays(osv.osv): return self.onchange_date_from(cr, uid, ids, date_to, date_from) def onchange_sec_id(self, cr, uid, ids, status, context=None): - if context is None: - context = {} warning = {} if status: brows_obj = self.pool.get('hr.holidays.status').browse(cr, uid, [status], context=context)[0] diff --git a/addons/hr_holidays/wizard/hr_holidays_summary_department.py b/addons/hr_holidays/wizard/hr_holidays_summary_department.py index b7f206b22ab..f21dca92393 100644 --- a/addons/hr_holidays/wizard/hr_holidays_summary_department.py +++ b/addons/hr_holidays/wizard/hr_holidays_summary_department.py @@ -39,8 +39,6 @@ class hr_holidays_summary_dept(osv.osv_memory): } def print_report(self, cr, uid, ids, context=None): - if context is None: - context = {} data = self.read(cr, uid, ids, [], context=context)[0] if not data['depts']: raise osv.except_osv(_('Error'), _('You have to select at least 1 Department. And try again')) diff --git a/addons/hr_holidays/wizard/hr_holidays_summary_employees.py b/addons/hr_holidays/wizard/hr_holidays_summary_employees.py index 984a1f51e4b..b6aeee96b00 100644 --- a/addons/hr_holidays/wizard/hr_holidays_summary_employees.py +++ b/addons/hr_holidays/wizard/hr_holidays_summary_employees.py @@ -37,8 +37,6 @@ class hr_holidays_summary_employee(osv.osv_memory): } def print_report(self, cr, uid, ids, context=None): - if context is None: - context = {} data = self.read(cr, uid, ids, [], context=context)[0] data['emp'] = context['active_ids'] datas = { diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index a9c6a7d03a4..2319b3a352c 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -114,8 +114,6 @@ class hr_payroll_structure(osv.osv): @return: returns a id of newly created record """ - if context is None: - context = {} code = self.browse(cr, uid, id, context=context).code default = { 'code':code+"(copy)", @@ -424,20 +422,14 @@ class payroll_register(osv.osv): return True def set_to_draft(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'draft'}, context=context) return True def cancel_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'cancel'}, context=context) return True def verify_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} slip_pool = self.pool.get('hr.payslip') for id in ids: @@ -455,8 +447,6 @@ class payroll_register(osv.osv): advice_line_pool = self.pool.get('hr.payroll.advice.line') sequence_pool = self.pool.get('ir.sequence') users_pool = self.pool.get('res.users') - if context is None: - context = {} for id in ids: sids = slip_pool.search(cr, uid, [('register_id','=',id), ('state','=','hr_check')], context=context) @@ -533,27 +523,19 @@ class payroll_advice(osv.osv): } def confirm_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'confirm'}, context=context) return True def set_to_draft(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'draft'}, context=context) return True def cancel_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'cancel'}, context=context) return True def onchange_company_id(self, cr, uid, ids, company_id=False, context=None): res = {} - if context is None: - context = {} if company_id: company = self.pool.get('res.company').browse(cr, uid, company_id, context=context) if company.partner_id.bank_ids: @@ -585,8 +567,6 @@ class payroll_advice_line(osv.osv): def onchange_employee_id(self, cr, uid, ids, ddate, employee_id, context=None): vals = {} slip_pool = self.pool.get('hr.payslip') - if context is None: - context = {} if employee_id: dates = prev_bounds(ddate) sids = False @@ -650,8 +630,6 @@ class contrib_register_line(osv.osv): _description = 'Contribution Register Line' def _total(self, cr, uid, ids, field_names, arg, context=None): - if context is None: - context = {} res={} for line in self.browse(cr, uid, ids, context=context): res[line.id] = line.emp_deduction + line.comp_deduction @@ -763,8 +741,6 @@ class company_contribution(osv.osv): uid: user id of current executer """ line_pool = self.pool.get('company.contribution.line') - if context is None: - context = {} res = 0 ids = line_pool.search(cr, uid, [('category_id','=',id), ('to_val','>=',value),('from_val','<=',value)], context=context) if not ids: @@ -839,8 +815,6 @@ class hr_payslip(osv.osv): def _calculate(self, cr, uid, ids, field_names, arg, context=None): slip_line_obj = self.pool.get('hr.payslip.line') - if context is None: - context = {} res = {} for rs in self.browse(cr, uid, ids, context=context): allow = 0.0 @@ -935,8 +909,6 @@ class hr_payslip(osv.osv): } def copy(self, cr, uid, id, default=None, context=None): - if context is None: - context = {} company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id default = { 'line_ids': False, @@ -963,32 +935,22 @@ class hr_payslip(osv.osv): slip_move.create(cr, uid, res) def set_to_draft(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'draft'}, context=context) return True def cancel_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'cancel'}, context=context) return True def account_check_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'accont_check'}, context=context) return True def hr_check_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'hr_check'}, context=context) return True def process_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'paid':True, 'state':'done'}, context=context) return True @@ -1023,8 +985,6 @@ class hr_payslip(osv.osv): return True def get_contract(self, cr, uid, employee, date, context=None): - if context is None: - context = {} sql_req= ''' SELECT c.id as id, c.wage as wage, struct_id as function FROM hr_contract c @@ -1055,8 +1015,6 @@ class hr_payslip(osv.osv): @return: return a result """ - if context is None: - context = {} result = [] dates = prev_bounds(slip.date) @@ -1381,8 +1339,6 @@ class hr_payslip_line(osv.osv): } def execute_function(self, cr, uid, id, value, context=None): - if context is None: - context = {} line_pool = self.pool.get('hr.payslip.line.line') res = 0 ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from_val','<=',value), ('to_val','>=',value)], context=context) diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index a3b3cd72b9b..adf1fada169 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -156,19 +156,19 @@ class contrib_register(osv.osv): period_id = self.pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d')),('date_stop','>=',time.strftime('%Y-%m-%d'))])[0] fiscalyear_id = self.pool.get('account.period').browse(cr, uid, period_id, context=context).fiscalyear_id res = {} - for cur in self.browse(cr, uid, ids): + for cur in self.browse(cr, uid, ids, context=context): current = line_pool.search(cr, uid, [('period_id','=',period_id),('register_id','=',cur.id)]) years = line_pool.search(cr, uid, [('period_id.fiscalyear_id','=',fiscalyear_id.id), ('register_id','=',cur.id)]) e_month = 0.0 c_month = 0.0 - for i in line_pool.browse(cr, uid, current): + for i in line_pool.browse(cr, uid, current, context=context): e_month += i.emp_deduction c_month += i.comp_deduction e_year = 0.0 c_year = 0.0 - for j in line_pool.browse(cr, uid, years): + for j in line_pool.browse(cr, uid, years, context=context): e_year += i.emp_deduction c_year += i.comp_deduction @@ -235,8 +235,6 @@ class hr_payslip(osv.osv): def cancel_sheet(self, cr, uid, ids, context=None): move_pool = self.pool.get('account.move') slip_move = self.pool.get('hr.payslip.account.move') - if context is None: - context = {} move_ids = [] for slip in self.browse(cr, uid, ids, context=context): for line in slip.move_ids: @@ -256,8 +254,6 @@ class hr_payslip(osv.osv): invoice_pool = self.pool.get('account.invoice') fiscalyear_pool = self.pool.get('account.fiscalyear') period_pool = self.pool.get('account.period') - if context is None: - context = {} for slip in self.browse(cr, uid, ids, context=context): line_ids = [] @@ -398,14 +394,10 @@ class hr_payslip(osv.osv): return True def account_check_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'accont_check'}, context=context) return True def hr_check_sheet(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'hr_check'}, context=context) return True @@ -418,8 +410,6 @@ class hr_payslip(osv.osv): property_pool = self.pool.get('ir.property') payslip_pool = self.pool.get('hr.payslip.line') - if context is None: - context = {} for slip in self.browse(cr, uid, ids, context=context): total_deduct = 0.0 diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index bc38e9444ee..7aebc3ef268 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -82,8 +82,6 @@ class hr_applicant(crm.crm_case, osv.osv): _inherit = ['mailgate.thread'] def _compute_day(self, cr, uid, ids, fields, args, context=None): - if context is None: - context = {} """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -165,8 +163,6 @@ class hr_applicant(crm.crm_case, osv.osv): } def _get_stage(self, cr, uid, context=None): - if context is None: - context = {} ids = self.pool.get('hr.recruitment.stage').search(cr, uid, [], context=context) return ids and ids[0] or False @@ -181,8 +177,6 @@ class hr_applicant(crm.crm_case, osv.osv): } def onchange_job(self,cr, uid, ids, job, context=None): - if context is None: - context = {} result = {} if job: @@ -305,8 +299,6 @@ class hr_applicant(crm.crm_case, osv.osv): """ mailgate_pool = self.pool.get('email.server.tools') attach_obj = self.pool.get('ir.attachment') - if context is None: - context = {} subject = msg.get('subject') body = msg.get('body') @@ -349,8 +341,6 @@ class hr_applicant(crm.crm_case, osv.osv): @param uid: the current user’s ID for security checks, @param ids: List of update mail’s IDs """ - if context is None: - context = {} if isinstance(ids, (str, int, long)): ids = [ids] diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index e03b7f93b3b..65310cd59ac 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -70,8 +70,6 @@ class hr_analytic_timesheet(osv.osv): } def unlink(self, cr, uid, ids, context=None): - if context is None: - context = {} toremove = {} for obj in self.browse(cr, uid, ids, context=context): toremove[obj.line_id.id] = True @@ -80,8 +78,6 @@ class hr_analytic_timesheet(osv.osv): def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit=False, journal_id=False, context=None): - if context is None: - context = {} res = {'value':{}} if prod_id and unit_amount: # find company diff --git a/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py b/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py index 9d00cbe26cb..9775a8518ff 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py @@ -37,8 +37,6 @@ class analytical_timesheet_employee(osv.osv_memory): def _get_user(self, cr, uid, context=None): emp_obj = self.pool.get('hr.employee') - if context is None: - context = {} emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context) if not emp_id: raise osv.except_osv(_("Warning"), _("No employee defined for this user")) @@ -51,8 +49,6 @@ class analytical_timesheet_employee(osv.osv_memory): } def print_report(self, cr, uid, ids, context=None): - if context is None: - context = {} data = self.read(cr, uid, ids, context=context)[0] datas = { 'ids': [], diff --git a/addons/hr_timesheet/wizard/hr_timesheet_print_users.py b/addons/hr_timesheet/wizard/hr_timesheet_print_users.py index 53d4427482f..865ccacb393 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_print_users.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_print_users.py @@ -39,8 +39,6 @@ class analytical_timesheet_employees(osv.osv_memory): } def print_report(self, cr, uid, ids, context=None): - if context is None: - context = {} data = self.read(cr, uid, ids, context=context)[0] datas = { 'ids': [], diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py index cf1e10bce37..596076cf336 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py @@ -40,16 +40,12 @@ class hr_so_project(osv.osv_memory): def _get_empid(self, cr, uid, context=None): emp_obj = self.pool.get('hr.employee') - if context is None: - context = {} emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context) if emp_ids: for employee in emp_obj.browse(cr, uid, emp_ids, context=context): return {'name': employee.name, 'state': employee.state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')} def _get_empid2(self, cr, uid, context=None): - if context is None: - context = {} res = self._get_empid(cr, uid, context=context) cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],)) @@ -61,8 +57,6 @@ class hr_so_project(osv.osv_memory): return res def default_get(self, cr, uid, fields_list, context=None): - if context is None: - context = {} res = super(hr_so_project, self).default_get(cr, uid, fields_list, context=context) res.update(self._get_empid2(cr, uid, context=context)) return res @@ -94,8 +88,6 @@ class hr_so_project(osv.osv_memory): return timesheet_obj.create(cr, uid, res, context=context) def sign_out_result_end(self, cr, uid, ids, context=None): - if context is None: - context = {} emp_obj = self.pool.get('hr.employee') for data in self.browse(cr, uid, ids, context=context): emp_id = data.emp_id.id @@ -104,8 +96,6 @@ class hr_so_project(osv.osv_memory): return {} def sign_out_result(self, cr, uid, ids, context=None): - if context is None: - context = {} emp_obj = self.pool.get('hr.employee') for data in self.browse(cr, uid, ids, context=context): emp_id = data.emp_id.id @@ -137,8 +127,6 @@ class hr_si_project(osv.osv_memory): @param context: A standard dictionary for contextual values """ emp_obj = self.pool.get('hr.employee') - if context is None: - context = {} emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context) if not emp_id: raise osv.except_osv(_('UserError'), _('No employee defined for your user !')) @@ -146,8 +134,6 @@ class hr_si_project(osv.osv_memory): def check_state(self, cr, uid, ids, context=None): obj_model = self.pool.get('ir.model.data') - if context is None: - context = {} emp_id = self.default_get(cr, uid, context)['emp_id'] # get the latest action (sign_in or out) for this employee cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,)) @@ -168,8 +154,6 @@ class hr_si_project(osv.osv_memory): def sign_in_result(self, cr, uid, ids, context=None): emp_obj = self.pool.get('hr.employee') - if context is None: - context = {} for data in self.browse(cr, uid, ids, context=context): emp_id = data.emp_id.id emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data.date or False) @@ -177,8 +161,6 @@ class hr_si_project(osv.osv_memory): def default_get(self, cr, uid, fields_list, context=None): res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context) - if context is None: - context = {} emp_obj = self.pool.get('hr.employee') emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context) if emp_id: diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 6d022a3c926..54d82ed2c79 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -41,8 +41,6 @@ hr_timesheet_invoice_factor() class account_analytic_account(osv.osv): def _invoiced_calc(self, cr, uid, ids, name, arg, context=None): obj_invoice = self.pool.get('account.invoice') - if context is None: - context = {} res = {} cr.execute('SELECT account_id as account_id, l.invoice_id ' @@ -90,14 +88,10 @@ class account_analytic_line(osv.osv): } def unlink(self, cursor, user, ids, context=None): - if context is None: - context = {} return super(account_analytic_line,self).unlink(cursor, user, ids, context=context) def write(self, cr, uid, ids, vals, context=None): - if context is None: - context = {} self._check_inv(cr, uid, ids, vals) return super(account_analytic_line,self).write(cr, uid, ids, vals, context=context) @@ -114,8 +108,6 @@ class account_analytic_line(osv.osv): return True def copy(self, cursor, user, obj_id, default=None, context=None): - if context is None: - context = {} if default is None: default = {} default = default.copy() @@ -144,8 +136,6 @@ class hr_analytic_timesheet(osv.osv): return res def copy(self, cursor, user, obj_id, default=None, context=None): - if context is None: - context = {} if default is None: default = {} default = default.copy() diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit.py index 4630ea1e833..068119c44a1 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit.py @@ -46,8 +46,6 @@ class account_analytic_profit(osv.osv_memory): def print_report(self, cr, uid, ids, context=None): line_obj = self.pool.get('account.analytic.line') - if context is None: - context = {} data = {} data['form'] = self.read(cr, uid , ids, [], context=context)[0] ids_chk = line_obj.search(cr, uid, [ diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index ddaba6ebdf9..e3ddd4fed6a 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -116,8 +116,6 @@ class hr_timesheet_sheet(osv.osv): def _total_day(self, cr, uid, ids, name, args, context=None): res = {} - if context is None: - context = {} cr.execute('SELECT sheet.id, day.total_attendance, day.total_timesheet, day.total_difference\ FROM hr_timesheet_sheet_sheet AS sheet \ LEFT JOIN hr_timesheet_sheet_sheet_day AS day \ @@ -133,8 +131,6 @@ class hr_timesheet_sheet(osv.osv): def _total(self, cr, uid, ids, name, args, context=None): res = {} - if context is None: - context = {} cr.execute('SELECT s.id, COALESCE(SUM(d.total_attendance),0), COALESCE(SUM(d.total_timesheet),0), COALESCE(SUM(d.total_difference),0) \ FROM hr_timesheet_sheet_sheet s \ LEFT JOIN hr_timesheet_sheet_sheet_day d \ @@ -152,8 +148,6 @@ class hr_timesheet_sheet(osv.osv): result = {} link_emp = {} emp_ids = [] - if context is None: - context = {} for sheet in self.browse(cr, uid, ids, context=context): result[sheet.id] = 'none' @@ -195,8 +189,6 @@ class hr_timesheet_sheet(osv.osv): return super(hr_timesheet_sheet, self).write(cr, uid, ids, vals, *args, **argv) def button_confirm(self, cr, uid, ids, context=None): - if context is None: - context = {} for sheet in self.browse(cr, uid, ids, context=context): self.check_employee_attendance_state(cr, uid, sheet.id, context) di = sheet.user_id.company_id.timesheet_max_difference @@ -208,8 +200,6 @@ class hr_timesheet_sheet(osv.osv): return True def date_today(self, cr, uid, ids, context=None): - if context is None: - context = {} for sheet in self.browse(cr, uid, ids, context=context): if datetime.today() <= datetime.strptime(sheet.date_from, '%Y-%m-%d'): self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,}, context=context) @@ -220,8 +210,6 @@ class hr_timesheet_sheet(osv.osv): return True def date_previous(self, cr, uid, ids, context=None): - if context is None: - context = {} for sheet in self.browse(cr, uid, ids, context=context): if datetime.strptime(sheet.date_current, '%Y-%m-%d') <= datetime.strptime(sheet.date_from, '%Y-%m-%d'): self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,}, context=context) @@ -232,8 +220,6 @@ class hr_timesheet_sheet(osv.osv): return True def date_next(self, cr, uid, ids, context=None): - if context is None: - context = {} for sheet in self.browse(cr, uid, ids, context=context): if datetime.strptime(sheet.date_current, '%Y-%m-%d') >= datetime.strptime(sheet.date_to, '%Y-%m-%d'): self.write(cr, uid, [sheet.id], {'date_current': sheet.date_to,}, context=context) @@ -244,8 +230,6 @@ class hr_timesheet_sheet(osv.osv): return True def button_dummy(self, cr, uid, ids, context=None): - if context is None: - context = {} for sheet in self.browse(cr, uid, ids, context=context): if datetime.strptime(sheet.date_current, '%Y-%m-%d') <= datetime.strptime(sheet.date_from, '%Y-%m-%d'): self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,}, context=context) @@ -312,8 +296,6 @@ class hr_timesheet_sheet(osv.osv): } def _default_date_from(self,cr, uid, context=None): - if context is None: - context = {} user = self.pool.get('res.users').browse(cr, uid, uid, context=context) r = user.company_id and user.company_id.timesheet_range or 'month' if r=='month': @@ -381,8 +363,6 @@ class hr_timesheet_sheet(osv.osv): return True def name_get(self, cr, uid, ids, context=None): - if context is None: - context = {} if not len(ids): return [] return [(r['id'], r['date_from'] + ' - ' + r['date_to']) \ @@ -390,8 +370,6 @@ class hr_timesheet_sheet(osv.osv): context=context, load='_classic_write')] def unlink(self, cr, uid, ids, context=None): - if context is None: - context = {} sheets = self.read(cr, uid, ids, ['state','total_attendance'], context=context) for sheet in sheets: if sheet['state'] in ('confirm', 'done'): @@ -415,8 +393,6 @@ class hr_timesheet_line(osv.osv): def _sheet(self, cursor, user, ids, name, args, context=None): sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') - if context is None: - context = {} cursor.execute('SELECT l.id, COALESCE(MAX(s.id), 0) \ FROM hr_timesheet_sheet_sheet s \ LEFT JOIN (hr_analytic_timesheet l \ @@ -441,8 +417,6 @@ class hr_timesheet_line(osv.osv): return res def _sheet_search(self, cursor, user, obj, name, args, context=None): - if context is None: - context = {} if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') @@ -537,8 +511,6 @@ class hr_attendance(osv.osv): return time.strftime('%Y-%m-%d %H:%M:%S') def _sheet(self, cursor, user, ids, name, args, context=None): - if context is None: - context = {} sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') cursor.execute("SELECT a.id, COALESCE(MAX(s.id), 0) \ FROM hr_timesheet_sheet_sheet s \ @@ -569,8 +541,6 @@ class hr_attendance(osv.osv): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') - if context is None: - context = {} i = 0 while i < len(args): fargs = args[i][0].split('.', 1) diff --git a/addons/idea/wizard/idea_post_vote.py b/addons/idea/wizard/idea_post_vote.py index a4f179eedbb..712f84d4053 100644 --- a/addons/idea/wizard/idea_post_vote.py +++ b/addons/idea/wizard/idea_post_vote.py @@ -108,7 +108,7 @@ class idea_post_vote(osv.osv_memory): idea_pool = self.pool.get('idea.idea') comment_pool = self.pool.get('idea.comment') - for do_vote_obj in self.read(cr, uid, ids): + for do_vote_obj in self.read(cr, uid, ids, context=context): score = str(do_vote_obj['vote']) comment = do_vote_obj.get('note', False) vote = { diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index e1ef873275f..ed5489fda79 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -54,8 +54,6 @@ class mailgate_thread(osv.osv): @param default: Dictionary of default values for copy. @param context: A standard dictionary for contextual values """ - if context is None: - context = {} if default is None: default = {} diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py index 5222e2b0868..041515da436 100644 --- a/addons/marketing_campaign/marketing_campaign.py +++ b/addons/marketing_campaign/marketing_campaign.py @@ -562,8 +562,6 @@ class marketing_campaign_workitem(osv.osv): def _resource_search(self, cr, uid, obj, name, args, domain=None, context=None): """Returns id of workitem whose resource_name matches with the given name""" - if context is None: - context = {} if not len(args): return [] diff --git a/addons/membership/membership.py b/addons/membership/membership.py index 5f9a9e6ee66..7353ac33336 100644 --- a/addons/membership/membership.py +++ b/addons/membership/membership.py @@ -385,8 +385,6 @@ class Partner(osv.osv): def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {} - if context is None: - context = {} default = default.copy() default['member_lines'] = [] return super(Partner, self).copy(cr, uid, id, default, context=context) @@ -401,8 +399,6 @@ class Partner(osv.osv): invoice_tax_obj = self.pool.get('account.invoice.tax') product_id = product_id or datas.get('membership_product_id', False) amount = datas.get('amount', 0.0) - if context is None: - context={} invoice_list = [] if type(ids) in (int, long,): ids = [ids] @@ -513,8 +509,6 @@ class account_invoice_line(osv.osv): def write(self, cr, uid, ids, vals, context=None): """Overrides orm write method """ - if context is None: - context={} member_line_obj = self.pool.get('membership.membership_line') res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context) for line in self.browse(cr, uid, ids, context=context): @@ -543,8 +537,6 @@ class account_invoice_line(osv.osv): def unlink(self, cr, uid, ids, context=None): """Remove Membership Line Record for Account Invoice Line """ - if context is None: - context={} member_line_obj = self.pool.get('membership.membership_line') for id in ids: ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line', '=', id)], context=context) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 3cbfadf2720..135d5007f90 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -641,8 +641,6 @@ class mrp_production(osv.osv): @param production_mode: specify production mode (consume/consume&produce). @return: True """ - if context is None: - context = {} stock_mov_obj = self.pool.get('stock.move') production = self.browse(cr, uid, production_id, context=context) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index d4fdf0adbc9..f2ffd87c095 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -474,7 +474,7 @@ class mrp_repair(osv.osv): """ Writes repair order state to 'Ready' if invoice method is Before repair. @return: True """ - for order in self.browse(cr, uid, ids): + for order in self.browse(cr, uid, ids, context=context): val = {} if (order.invoice_method == 'b4repair'): val['state'] = 'ready' @@ -488,7 +488,7 @@ class mrp_repair(osv.osv): After repair else state is set to 'Ready'. @return: True """ - for order in self.browse(cr, uid, ids): + for order in self.browse(cr, uid, ids, context=context): val = {} val['repaired'] = True if (not order.invoiced and order.invoice_method=='after_repair'): diff --git a/addons/point_of_sale/account_bank_statement.py b/addons/point_of_sale/account_bank_statement.py index edcf8573451..706cd50a84b 100644 --- a/addons/point_of_sale/account_bank_statement.py +++ b/addons/point_of_sale/account_bank_statement.py @@ -41,8 +41,6 @@ class account_cash_statement(osv.osv): _inherit = 'account.bank.statement' def _equal_balance(self, cr, uid, cash_id, context=None): - if context is None: - context = {} statement = self.browse(cr, uid, cash_id, context=context) if not statement.journal_id.check_dtls: return True @@ -52,8 +50,6 @@ class account_cash_statement(osv.osv): return True def _user_allow(self, cr, uid, statement_id, context=None): - if context is None: - context = {} statement = self.browse(cr, uid, statement_id, context=context) if (not statement.journal_id.journal_users) and uid == 1: return True for user in statement.journal_id.journal_users: @@ -62,8 +58,6 @@ class account_cash_statement(osv.osv): return False def _get_cash_open_box_lines(self, cr, uid, context=None): - if context is None: - context = {} res = super(account_cash_statement,self)._get_cash_open_box_lines(cr, uid, context) curr = [0.01, 0.02, 0.05, 0.10, 0.20, 0.50] for rs in curr: @@ -76,8 +70,6 @@ class account_cash_statement(osv.osv): return res def _get_default_cash_close_box_lines(self, cr, uid, context=None): - if context is None: - context = {} res = super(account_cash_statement,self)._get_default_cash_close_box_lines(cr, uid, context=context) curr = [0.01, 0.02, 0.05, 0.10, 0.20, 0.50] for rs in curr: diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index fa2de26f4e8..71333fc7c9d 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -125,7 +125,7 @@ class pos_order(osv.osv): @return: Dictionary of values """ res = {} val = None - for order in self.browse(cr, uid, ids): + for order in self.browse(cr, uid, ids, context=context): cr.execute("SELECT date_validation FROM pos_order WHERE id = %s", (order.id,)) date_p = cr.fetchone() date_p = date_p and date_p[0] or None diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 84413116222..7a7fc4530c5 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -128,7 +128,7 @@ class procurement_order(osv.osv): } def unlink(self, cr, uid, ids, context=None): - procurements = self.read(cr, uid, ids, ['state']) + procurements = self.read(cr, uid, ids, ['state'], context=context) unlink_ids = [] for s in procurements: if s['state'] in ['draft','cancel']: diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 04228bb7e5c..e2c4f6735b2 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -307,7 +307,8 @@ class product_pricelist(osv.osv): ''' price = False item_id = 0 - context = context or {} + if context is None: + context = {} currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product') supplierinfo_obj = self.pool.get('product.supplierinfo') diff --git a/addons/product_expiry/product_expiry.py b/addons/product_expiry/product_expiry.py index fb53d9d0c03..4497ca71957 100644 --- a/addons/product_expiry/product_expiry.py +++ b/addons/product_expiry/product_expiry.py @@ -60,7 +60,8 @@ class stock_production_lot(osv.osv): for f in ('life_date', 'use_date', 'removal_date', 'alert_date'): if not getattr(obj, f): towrite.append(f) - context = context or {} + if context is None: + context = {} context['product_id'] = obj.product_id.id self.write(cr, uid, [obj.id], self.default_get(cr, uid, towrite, context=context)) return newid diff --git a/addons/product_margin/wizard/product_margin.py b/addons/product_margin/wizard/product_margin.py index d5b502d0545..c1430566abe 100644 --- a/addons/product_margin/wizard/product_margin.py +++ b/addons/product_margin/wizard/product_margin.py @@ -49,11 +49,9 @@ class product_margin(osv.osv_memory): @return: """ - if context is None: - context = {} mod_obj = self.pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'product', 'product_search_form_view') - id = mod_obj.read(cr, uid, result, ['res_id']) + id = mod_obj.read(cr, uid, result, ['res_id'], context=context) cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.graph', 'graph')) view_res3 = cr.fetchone()[0] cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.form.inherit', 'form')) diff --git a/addons/project/project.py b/addons/project/project.py index d2382d75053..1df4b0dca96 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -104,16 +104,12 @@ class project(osv.osv): return res def _get_project_task(self, cr, uid, ids, context=None): - if context is None: - context = {} result = {} for task in self.pool.get('project.task').browse(cr, uid, ids, context=context): if task.project_id: result[task.project_id.id] = True return result.keys() def _get_project_work(self, cr, uid, ids, context=None): - if context is None: - context = {} result = {} for work in self.pool.get('project.task.work').browse(cr, uid, ids, context=context): if work.task_id and work.task_id.project_id: result[work.task_id.project_id.id] = True @@ -382,8 +378,6 @@ class task(osv.osv): return res def _get_task(self, cr, uid, ids, context=None): - if context is None: - context = {} result = {} for work in self.pool.get('project.task.work').browse(cr, uid, ids, context=context): if work.task_id: result[work.task_id.id] = True @@ -537,8 +531,6 @@ class task(osv.osv): """ Close Task """ - if context is None: - context = {} request = self.pool.get('res.request') for task in self.browse(cr, uid, ids, context=context): project = task.project_id @@ -569,8 +561,6 @@ class task(osv.osv): return True def do_reopen(self, cr, uid, ids, context=None): - if context is None: - context = {} request = self.pool.get('res.request') for task in self.browse(cr, uid, ids, context=context): @@ -629,8 +619,6 @@ class task(osv.osv): """ Delegate Task to another users. """ - if context is None: - context = {} task = self.browse(cr, uid, task_id, context=context) new_task_id = self.copy(cr, uid, task.id, { 'name': delegate_data['name'], diff --git a/addons/project/wizard/project_task_delegate.py b/addons/project/wizard/project_task_delegate.py index 61fec536e50..72b32f7db68 100644 --- a/addons/project/wizard/project_task_delegate.py +++ b/addons/project/wizard/project_task_delegate.py @@ -79,7 +79,7 @@ class project_task_delegate(osv.osv_memory): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task_delegate, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu=submenu) users_pool = self.pool.get('res.users') - obj_tm = users_pool.browse(cr, uid, uid, context).company_id.project_time_mode_id + obj_tm = users_pool.browse(cr, uid, uid, context=context).company_id.project_time_mode_id tm = obj_tm and obj_tm.name or 'Hours' if tm in ['Hours','Hour']: return res diff --git a/addons/project_gtd/wizard/project_gtd_fill.py b/addons/project_gtd/wizard/project_gtd_fill.py index 332a7f072a8..db0d7187500 100644 --- a/addons/project_gtd/wizard/project_gtd_fill.py +++ b/addons/project_gtd/wizard/project_gtd_fill.py @@ -32,8 +32,6 @@ class project_timebox_fill(osv.osv_memory): } def _get_from_tb(self, cr, uid, context=None): - if context is None: - context = {} ids = self.pool.get('project.gtd.timebox').search(cr, uid, [], context=context) return ids and ids[0] or False @@ -50,11 +48,9 @@ class project_timebox_fill(osv.osv_memory): } def process(self, cr, uid, ids, context=None): - if context is None: - context = {} if not ids: return {} - data = self.read(cr, uid, ids, []) + data = self.read(cr, uid, ids, [], context=context) if not data[0]['task_ids']: return {} self.pool.get('project.task').write(cr, uid, data[0]['task_ids'], {'timebox_id':data[0]['timebox_to_id']}) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 9e8c5aa7863..dc272404688 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -78,8 +78,6 @@ class project_issue(crm.crm_case, osv.osv): return res def _compute_day(self, cr, uid, ids, fields, args, context=None): - if context is None: - context = {} """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @@ -143,8 +141,6 @@ class project_issue(crm.crm_case, osv.osv): return res def _get_issue_task(self, cr, uid, ids, context=None): - if context is None: - context = {} issues = [] issue_pool = self.pool.get('project.issue') for task in self.pool.get('project.task').browse(cr, uid, ids, context=context): @@ -152,8 +148,6 @@ class project_issue(crm.crm_case, osv.osv): return issues def _get_issue_work(self, cr, uid, ids, context=None): - if context is None: - context = {} issues = [] issue_pool = self.pool.get('project.issue') for work in self.pool.get('project.task.work').browse(cr, uid, ids, context=context): @@ -339,8 +333,6 @@ class project_issue(crm.crm_case, osv.osv): def onchange_task_id(self, cr, uid, ids, task_id, context=None): - if context is None: - context = {} result = {} if not task_id: return {'value':{}} @@ -378,7 +370,8 @@ class project_issue(crm.crm_case, osv.osv): @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks """ - if context is None: context = {} + if context is None: + context = {} mailgate_pool = self.pool.get('email.server.tools') subject = msg.get('subject') or _('No Title') @@ -418,8 +411,6 @@ class project_issue(crm.crm_case, osv.osv): return res def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context=None): - if context is None: - context = {} """ @param self: The object pointer @param cr: the current row, from the database cursor, diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index 7094eb80512..4640ea8fa48 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -153,8 +153,6 @@ class project_phase(osv.osv): return {'value': result} def _check_date_start(self, cr, uid, phase, date_end, context=None): - if context is None: - context = {} """ Check And Compute date_end of phase if change in date_start < older time. """ @@ -175,8 +173,6 @@ class project_phase(osv.osv): self.write(cr, uid, [phase.id], {'date_start': dt_start, 'date_end': date_end.strftime('%Y-%m-%d')}, context=context) def _check_date_end(self, cr, uid, phase, date_start, context=None): - if context is None: - context = {} """ Check And Compute date_end of phase if change in date_end > older time. """ @@ -277,8 +273,6 @@ class project_phase(osv.osv): Return a list of Resource Class objects for the resources allocated to the phase. """ res = {} - if context is None: - context = {} resource_pool = self.pool.get('resource.resource') for phase in self.browse(cr, uid, ids, context=context): user_ids = map(lambda x:x.resource_id.user_id.id, phase.resource_ids) @@ -299,8 +293,6 @@ class project_phase(osv.osv): resource_pool = self.pool.get('resource.resource') resource_allocation_pool = self.pool.get('project.resource.allocation') uom_pool = self.pool.get('product.uom') - if context is None: - context = {} default_uom_id = self._get_default_uom_id(cr, uid) for phase in self.browse(cr, uid, ids, context=context): if not phase.responsible_id: @@ -366,8 +358,6 @@ class project_phase(osv.osv): """ task_pool = self.pool.get('project.task') resource_pool = self.pool.get('resource.resource') - if context is None: - context = {} resources_list = self.generate_resources(cr, uid, ids, context=context) return_msg = {} for phase in self.browse(cr, uid, ids, context=context): @@ -431,8 +421,6 @@ class project(osv.osv): """ res = {} resource_pool = self.pool.get('resource.resource') - if context is None: - context = {} for project in self.browse(cr, uid, ids, context=context): user_ids = map(lambda x:x.id, project.members) calendar_id = project.resource_calendar_id and project.resource_calendar_id.id or False @@ -444,8 +432,6 @@ class project(osv.osv): """ Schedule the phases. """ - if context is None: - context = {} if type(ids) in (long, int,): ids = [ids] phase_pool = self.pool.get('project.phase') @@ -471,9 +457,6 @@ class project(osv.osv): user_pool = self.pool.get('res.users') task_pool = self.pool.get('project.task') resource_pool = self.pool.get('resource.resource') - if context is None: - context = {} - resources_list = self.generate_members(cr, uid, ids, context=context) return_msg = {} for project in self.browse(cr, uid, ids, context=context): diff --git a/addons/project_long_term/wizard/project_compute_phases.py b/addons/project_long_term/wizard/project_compute_phases.py index ade1da5c9d9..351297384fd 100644 --- a/addons/project_long_term/wizard/project_compute_phases.py +++ b/addons/project_long_term/wizard/project_compute_phases.py @@ -44,8 +44,6 @@ class project_compute_phases(osv.osv_memory): """ Compute the phases for scheduling. """ - if context is None: - context = {} project_pool = self.pool.get('project.project') data = self.read(cr, uid, ids, [], context=context)[0] if not data['project_id'] and data['target_project'] == 'one': diff --git a/addons/project_long_term/wizard/project_schedule_tasks.py b/addons/project_long_term/wizard/project_schedule_tasks.py index 48039112e86..1a9081b1f5d 100644 --- a/addons/project_long_term/wizard/project_schedule_tasks.py +++ b/addons/project_long_term/wizard/project_schedule_tasks.py @@ -32,8 +32,6 @@ class project_schedule_task(osv.osv_memory): } def default_get(self, cr, uid, fields_list, context=None): - if context is None: - context = {} res = super(project_schedule_task, self).default_get(cr, uid, fields_list, context) self.compute_date(cr, uid, context=context) return res diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py index cb2b2f8d6a0..7e7978eda59 100644 --- a/addons/project_mrp/project_procurement.py +++ b/addons/project_mrp/project_procurement.py @@ -33,8 +33,6 @@ class procurement_order(osv.osv): return True def action_produce_assign_service(self, cr, uid, ids, context=None): - if context is None: - context = {} for procurement in self.browse(cr, uid, ids, context=context): self.write(cr, uid, [procurement.id], {'state': 'running'}) planned_hours = procurement.product_qty diff --git a/addons/project_planning/project_planning.py b/addons/project_planning/project_planning.py index aefceedd64b..dc89bcd4d31 100644 --- a/addons/project_planning/project_planning.py +++ b/addons/project_planning/project_planning.py @@ -50,8 +50,6 @@ class report_account_analytic_planning(osv.osv): _description = "Planning" def _child_compute(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} obj_dept = self.pool.get('hr.department') obj_user = self.pool.get('res.users') result = {} @@ -100,8 +98,6 @@ class report_account_analytic_planning(osv.osv): return result def _check_planning_responsible(self, cr, uid, ids, context=None): - if context is None: - context = {} for obj_plan in self.browse(cr, uid, ids, context=context): cr.execute(""" SELECT id FROM report_account_analytic_planning plan @@ -149,26 +145,18 @@ class report_account_analytic_planning(osv.osv): ] def action_open(self, cr, uid, id, context=None): - if context is None: - context = {} self.write(cr, uid, id, {'state' : 'open'}, context=context) return True def action_cancel(self, cr, uid, id, context=None): - if context is None: - context = {} self.write(cr, uid, id, {'state' : 'cancel'}, context=context) return True def action_draft(self, cr, uid, id, context=None): - if context is None: - context = {} self.write(cr, uid, id, {'state' : 'draft'}, context=context) return True def action_done(self, cr, uid, id, context=None): - if context is None: - context = {} self.write(cr, uid, id, {'state' : 'done'}, context=context) return True @@ -180,8 +168,6 @@ class report_account_analytic_planning_line(osv.osv): _rec_name = 'user_id' def name_get(self, cr, uid, ids, context=None): - if context is None: - context = {} if not len(ids): return [] reads = self.read(cr, uid, ids, ['user_id', 'planning_id', 'note'], context=context) @@ -198,8 +184,6 @@ class report_account_analytic_planning_line(osv.osv): return res def _amount_base_uom(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context=context).company_id.planning_time_mode_id @@ -262,8 +246,6 @@ class report_account_analytic_planning_user(osv.osv): _auto = False def _get_tasks(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context=context).company_id.project_time_mode_id @@ -288,8 +270,6 @@ class report_account_analytic_planning_user(osv.osv): return result def _get_free(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} result = {} for line in self.browse(cr, uid, ids, context=context): if line.user_id: @@ -299,8 +279,6 @@ class report_account_analytic_planning_user(osv.osv): return result def _get_timesheets(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context=context).company_id.planning_time_mode_id @@ -410,8 +388,6 @@ class report_account_analytic_planning_account(osv.osv): _auto = False def _get_tasks(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context=context).company_id.project_time_mode_id @@ -437,8 +413,6 @@ class report_account_analytic_planning_account(osv.osv): return result def _get_timesheets(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context=context).company_id.planning_time_mode_id @@ -511,8 +485,6 @@ class report_account_analytic_planning_stat(osv.osv): _order = 'planning_id,user_id' def _sum_amount_real(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} users_obj = self.pool.get('res.users') result = {} tm2 = users_obj.browse(cr, uid, uid, context=context).company_id.planning_time_mode_id @@ -534,8 +506,6 @@ WHERE user_id=%s and account_id=%s and date>=%s and date<=%s''', (line.user_id.i return result def _sum_amount_tasks(self, cr, uid, ids, name, args, context=None): - if context is None: - context = {} users_obj = self.pool.get('res.users') result = {} tm = users_obj.browse(cr, uid, uid, context=context).company_id.project_time_mode_id diff --git a/addons/project_scrum/project_scrum.py b/addons/project_scrum/project_scrum.py index 95baff34f95..7d1d071a7c3 100644 --- a/addons/project_scrum/project_scrum.py +++ b/addons/project_scrum/project_scrum.py @@ -70,20 +70,14 @@ class project_scrum_sprint(osv.osv): return res def button_cancel(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'cancel'}, context=context) return True def button_draft(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'draft'}, context=context) return True def button_open(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'open'}, context=context) for (id, name) in self.name_get(cr, uid, ids): message = _("The sprint '%s' has been opened.") % (name,) @@ -91,8 +85,6 @@ class project_scrum_sprint(osv.osv): return True def button_close(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'done'}, context=context) for (id, name) in self.name_get(cr, uid, ids): message = _("The sprint '%s' has been closed.") % (name,) @@ -100,8 +92,6 @@ class project_scrum_sprint(osv.osv): return True def button_pending(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'pending'}, context=context) return True @@ -134,8 +124,6 @@ class project_scrum_sprint(osv.osv): @param ids: List of case’s IDs @param context: A standard dictionary for contextual values """ - if context is None: - context = {} if default is None: default = {} default.update({'backlog_ids': [], 'meeting_ids': []}) @@ -171,8 +159,6 @@ class project_scrum_product_backlog(osv.osv): progress = {} if not ids: return res - if context is None: - context = {} for backlog in self.browse(cr, uid, ids, context=context): tot = 0.0 prog = 0.0 @@ -195,28 +181,20 @@ class project_scrum_product_backlog(osv.osv): def button_cancel(self, cr, uid, ids, context=None): obj_project_task = self.pool.get('project.task') - if context is None: - context = {} self.write(cr, uid, ids, {'state':'cancel'}, context=context) for backlog in self.browse(cr, uid, ids, context=context): obj_project_task.write(cr, uid, [i.id for i in backlog.tasks_id], {'state': 'cancelled'}) return True def button_draft(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'draft'}, context=context) return True def button_open(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'open'}, context=context) return True def button_close(self, cr, uid, ids, context=None): - if context is None: - context = {} obj_project_task = self.pool.get('project.task') self.write(cr, uid, ids, {'state':'done'}, context=context) for backlog in self.browse(cr, uid, ids, context=context): @@ -224,14 +202,10 @@ class project_scrum_product_backlog(osv.osv): return True def button_pending(self, cr, uid, ids, context=None): - if context is None: - context = {} self.write(cr, uid, ids, {'state':'pending'}, context=context) return True def button_postpone(self, cr, uid, ids, context=None): - if context is None: - context = {} for product in self.browse(cr, uid, ids, context=context): tasks_id = [] for task in product.tasks_id: @@ -276,8 +250,6 @@ class project_scrum_task(osv.osv): def _get_task(self, cr, uid, ids, context=None): result = {} - if context is None: - context = {} for line in self.pool.get('project.scrum.product.backlog').browse(cr, uid, ids, context=context): for task in line.tasks_id: result[task.id] = True @@ -322,8 +294,6 @@ class project_scrum_meeting(osv.osv): } def button_send_to_master(self, cr, uid, ids, context=None): - if context is None: - context = {} meeting_id = self.browse(cr, uid, ids, context=context)[0] if meeting_id and meeting_id.sprint_id.scrum_master_id.user_email: res = self.email_send(cr, uid, ids, meeting_id.sprint_id.scrum_master_id.user_email) @@ -347,8 +317,6 @@ class project_scrum_meeting(osv.osv): return True def email_send(self, cr, uid, ids, email, context=None): - if context is None: - context = {} email_from = tools.config.get('email_from', False) meeting_id = self.browse(cr, uid, ids, context=context)[0] user = self.pool.get('res.users').browse(cr, uid, uid, context=context) diff --git a/addons/project_scrum/wizard/project_scrum_backlog_create_task.py b/addons/project_scrum/wizard/project_scrum_backlog_create_task.py index 827c88b0630..afa4f40a5f8 100644 --- a/addons/project_scrum/wizard/project_scrum_backlog_create_task.py +++ b/addons/project_scrum/wizard/project_scrum_backlog_create_task.py @@ -34,8 +34,6 @@ class backlog_create_task(osv.osv_memory): document_pool = self.pool.get('ir.attachment') ids_task = [] - if context is None: - context = {} data = self.read(cr, uid, ids, [], context=context)[0] backlogs = backlog_id.browse(cr, uid, context['active_ids'], context=context) result = mod_obj._get_id(cr, uid, 'project', 'view_task_search_form') diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 7a7dcc64860..79bc59759ae 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -223,7 +223,7 @@ class purchase_order(osv.osv): _order = "name desc" def unlink(self, cr, uid, ids, context=None): - purchase_orders = self.read(cr, uid, ids, ['state']) + purchase_orders = self.read(cr, uid, ids, ['state'], context=context) unlink_ids = [] for s in purchase_orders: if s['state'] in ['draft','cancel']: diff --git a/addons/report_webkit/wizard/report_webkit_actions.py b/addons/report_webkit/wizard/report_webkit_actions.py index 249dd0222d7..a287fd24906 100644 --- a/addons/report_webkit/wizard/report_webkit_actions.py +++ b/addons/report_webkit/wizard/report_webkit_actions.py @@ -85,7 +85,7 @@ class report_webkit_actions(osv.osv_memory): return res - def do_action(self, cr, uid, ids, context): + def do_action(self, cr, uid, ids, context=None): """ This Function Open added Action. @param self: The object pointer. @param cr: A database cursor @@ -93,9 +93,11 @@ class report_webkit_actions(osv.osv_memory): @param ids: List of report.webkit.actions's ID @param context: A standard dictionary @return: Dictionary of ir.values form. - """ + """ + if context is None: + context = {} report_obj = self.pool.get('ir.actions.report.xml') - for current in self.browse(cr, uid, ids): + for current in self.browse(cr, uid, ids, context=context): report = report_obj.browse( cr, uid, diff --git a/addons/resource/resource.py b/addons/resource/resource.py index c304fab26d5..d77b2505f20 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -250,8 +250,6 @@ class resource_resource(osv.osv): """ Return a list of Resource Class objects for the resources allocated to the phase. """ - if context is None: - context = {} resource_objs = [] user_pool = self.pool.get('res.users') for user in user_pool.browse(cr, uid, user_ids, context=context): @@ -281,8 +279,6 @@ class resource_resource(osv.osv): @param resource_id : resource working on phase/task @param resource_calendar : working calendar of the resource """ - if context is None: - context = {} resource_calendar_leaves_pool = self.pool.get('resource.calendar.leaves') leave_list = [] if resource_id: @@ -308,8 +304,6 @@ class resource_resource(osv.osv): Change the format of working calendar from 'Openerp' format to bring it into 'Faces' format. @param calendar_id : working calendar of the project """ - if context is None: - context = {} resource_attendance_pool = self.pool.get('resource.calendar.attendance') time_range = "8:00-8:00" non_working = "" diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 66d7c1ac56a..8dd4370f75f 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -50,8 +50,6 @@ class sale_order(osv.osv): _description = "Sale Order" def copy(self, cr, uid, id, default=None, context=None): - if context is None: - context = {} if not default: default = {} default.update({ @@ -65,8 +63,6 @@ class sale_order(osv.osv): return super(sale_order, self).copy(cr, uid, id, default, context=context) def _amount_line_tax(self, cr, uid, line, context=None): - if context is None: - context = {} val = 0.0 for c in self.pool.get('account.tax').compute_all(cr, uid, line.tax_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id)['taxes']: val += c.get('amount', 0.0) @@ -74,8 +70,6 @@ class sale_order(osv.osv): def _amount_all(self, cr, uid, ids, field_name, arg, context=None): cur_obj = self.pool.get('res.currency') - if context is None: - context = {} res = {} for order in self.browse(cr, uid, ids, context=context): res[order.id] = { @@ -95,8 +89,6 @@ class sale_order(osv.osv): # This is False def _picked_rate(self, cr, uid, ids, name, arg, context=None): - if context is None: - context = {} if not ids: return {} res = {} @@ -131,8 +123,6 @@ class sale_order(osv.osv): return res def _invoiced_rate(self, cursor, user, ids, name, arg, context=None): - if context is None: - context = {} res = {} for sale in self.browse(cursor, user, ids, context=context): if sale.invoiced: @@ -149,8 +139,6 @@ class sale_order(osv.osv): return res def _invoiced(self, cursor, user, ids, name, arg, context=None): - if context is None: - context = {} res = {} for sale in self.browse(cursor, user, ids, context=context): res[sale.id] = True @@ -163,8 +151,6 @@ class sale_order(osv.osv): return res def _invoiced_search(self, cursor, user, obj, name, args, context=None): - if context is None: - context = {} if not len(args): return [] clause = '' @@ -195,8 +181,6 @@ class sale_order(osv.osv): return [('id', 'in', [x[0] for x in res])] def _get_order(self, cr, uid, ids, context=None): - if context is None: - context = {} result = {} for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context): result[line.order_id.id] = True @@ -294,8 +278,6 @@ class sale_order(osv.osv): # Form filling def unlink(self, cr, uid, ids, context=None): - if context is None: - context = {} sale_orders = self.read(cr, uid, ids, ['state'], context=context) unlink_ids = [] for s in sale_orders: @@ -355,8 +337,6 @@ class sale_order(osv.osv): return {'value': val} def shipping_policy_change(self, cr, uid, ids, policy, context=None): - if context is None: - context = {} if not policy: return {} inv_qty = 'order' @@ -367,8 +347,6 @@ class sale_order(osv.osv): return {'value': {'invoice_quantity': inv_qty}} def write(self, cr, uid, ids, vals, context=None): - if context is None: - context = {} if vals.get('order_policy', False): if vals['order_policy'] == 'prepaid': vals.update({'invoice_quantity': 'order'}) @@ -377,8 +355,6 @@ class sale_order(osv.osv): return super(sale_order, self).write(cr, uid, ids, vals, context=context) def create(self, cr, uid, vals, context=None): - if context is None: - context = {} if vals.get('order_policy', False): if vals['order_policy'] == 'prepaid': vals.update({'invoice_quantity': 'order'}) @@ -387,8 +363,6 @@ class sale_order(osv.osv): return super(sale_order, self).create(cr, uid, vals, context=context) def button_dummy(self, cr, uid, ids, context=None): - if context is None: - context = {} return True #FIXME: the method should return the list of invoices created (invoice_ids) @@ -396,8 +370,6 @@ class sale_order(osv.osv): # cannot change it directly since the method is called by the sale order # workflow and I suppose it expects a single id... def _inv_get(self, cr, uid, order, context=None): - if context is None: - context = {} return {} def _make_invoice(self, cr, uid, order, lines, context=None): @@ -495,7 +467,7 @@ class sale_order(osv.osv): # last day of the last month as invoice date if date_inv: context['date_inv'] = date_inv - for o in self.browse(cr, uid, ids): + for o in self.browse(cr, uid, ids, context=context): lines = [] for line in o.order_line: if line.invoiced: @@ -506,7 +478,7 @@ class sale_order(osv.osv): if created_lines: invoices.setdefault(o.partner_id.id, []).append((o, created_lines)) if not invoices: - for o in self.browse(cr, uid, ids): + for o in self.browse(cr, uid, ids, context=context): for i in o.invoice_ids: if i.state == 'draft': return i.id @@ -534,7 +506,7 @@ class sale_order(osv.osv): def action_invoice_cancel(self, cr, uid, ids, context=None): if context is None: context = {} - for sale in self.browse(cr, uid, ids): + for sale in self.browse(cr, uid, ids, context=context): for line in sale.order_line: # # Check if the line is invoiced (has asociated invoice @@ -762,8 +734,6 @@ class sale_order(osv.osv): return True def action_ship_end(self, cr, uid, ids, context=None): - if context is None: - context = {} for order in self.browse(cr, uid, ids, context=context): val = {'shipped': True} if order.state == 'shipping_except': @@ -823,7 +793,8 @@ class sale_order_line(osv.osv): tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') res = {} - context = context or {} + if context is None: + context = {} for line in self.browse(cr, uid, ids, context=context): price = line.price_unit * (1 - (line.discount or 0.0) / 100.0) taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id) @@ -832,8 +803,6 @@ class sale_order_line(osv.osv): return res def _number_packages(self, cr, uid, ids, field_name, arg, context=None): - if context is None: - context = {} res = {} for line in self.browse(cr, uid, ids, context=context): try: @@ -967,8 +936,6 @@ class sale_order_line(osv.osv): return create_ids def button_cancel(self, cr, uid, ids, context=None): - if context is None: - context = {} for line in self.browse(cr, uid, ids, context=context): if line.invoiced: raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sale order line that has already been invoiced !')) @@ -980,13 +947,9 @@ class sale_order_line(osv.osv): return self.write(cr, uid, ids, {'state': 'cancel'}) def button_confirm(self, cr, uid, ids, context=None): - if context is None: - context = {} return self.write(cr, uid, ids, {'state': 'confirmed'}) def button_done(self, cr, uid, ids, context=None): - if context is None: - context = {} wf_service = netsvc.LocalService("workflow") res = self.write(cr, uid, ids, {'state': 'done'}) for line in self.browse(cr, uid, ids, context=context): @@ -1014,8 +977,6 @@ class sale_order_line(osv.osv): return {'value': value} def copy_data(self, cr, uid, id, default=None, context=None): - if context is None: - context = {} if not default: default = {} default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []}) @@ -1171,8 +1132,6 @@ class sale_order_line(osv.osv): return res def unlink(self, cr, uid, ids, context=None): - if context is None: - context = {} """Allows to delete sale order lines in draft,cancel states""" for rec in self.browse(cr, uid, ids, context=context): if rec.state not in ['draft', 'cancel']: @@ -1212,8 +1171,6 @@ class sale_config_picking_policy(osv.osv_memory): } def execute(self, cr, uid, ids, context=None): - if context is None: - context = {} for o in self.browse(cr, uid, ids, context=context): ir_values_obj = self.pool.get('ir.values') ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], o.picking_policy) diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 029ce5feeab..42208e1cfd9 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -117,8 +117,6 @@ class stock_picking(osv.osv): invoice_obj = self.pool.get('account.invoice') picking_obj = self.pool.get('stock.picking') invoice_line_obj = self.pool.get('account.invoice.line') - if context is None: - context = {} result = super(stock_picking, self).action_invoice_create(cursor, user, ids, journal_id=journal_id, group=group, type=type, diff --git a/addons/sale_analytic_plans/sale_analytic_plans.py b/addons/sale_analytic_plans/sale_analytic_plans.py index cc006f3afc0..b8ccc44079d 100644 --- a/addons/sale_analytic_plans/sale_analytic_plans.py +++ b/addons/sale_analytic_plans/sale_analytic_plans.py @@ -32,7 +32,7 @@ class sale_order_line(osv.osv): line_obj = self.pool.get('account.invoice.line') create_ids = super(sale_order_line, self).invoice_line_create(cr, uid, ids, context=context) i = 0 - for line in self.browse(cr, uid, ids, context): + for line in self.browse(cr, uid, ids, context=context): line_obj.write(cr, uid, [create_ids[i]], {'analytics_id': line.analytics_id.id}) i = i + 1 return create_ids diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py index 7ee996dfd75..506177d08f4 100644 --- a/addons/sale_crm/wizard/crm_make_sale.py +++ b/addons/sale_crm/wizard/crm_make_sale.py @@ -51,8 +51,6 @@ class crm_make_sale(osv.osv_memory): return lead['partner_id'] def view_init(self, cr, uid, fields_list, context=None): - if context is None: - context = {} return super(crm_make_sale, self).view_init(cr, uid, fields_list, context=context) def makeOrder(self, cr, uid, ids, context=None): @@ -138,8 +136,6 @@ class crm_make_sale(osv.osv_memory): return value def _get_shop_id(self, cr, uid, ids, context=None): - if context is None: - context = {} cmpny_id = self.pool.get('res.users')._get_company(cr, uid, context=context) shop = self.pool.get('sale.shop').search(cr, uid, [('company_id', '=', cmpny_id)]) return shop and shop[0] or False diff --git a/addons/sale_layout/sale_layout.py b/addons/sale_layout/sale_layout.py index cd396fc785b..f5b036d143f 100755 --- a/addons/sale_layout/sale_layout.py +++ b/addons/sale_layout/sale_layout.py @@ -27,7 +27,6 @@ class sale_order_line(osv.osv): def _amount_line(self, cr, uid, ids, field_name, arg, context=None): res = {} - context = context or {} for line in self.browse(cr, uid, ids, context=context): if line.layout_type == 'article': return super(sale_order_line, self)._amount_line(cr, uid, ids, field_name, arg, context) diff --git a/addons/sale_mrp/sale_mrp.py b/addons/sale_mrp/sale_mrp.py index 2ae230ae4a8..cea62f19fa0 100644 --- a/addons/sale_mrp/sale_mrp.py +++ b/addons/sale_mrp/sale_mrp.py @@ -32,8 +32,6 @@ class mrp_production(osv.osv): @return: Dictionary of values. """ res = {} - if context is None: - context = {} if not field_names: field_names = [] for id in ids: diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index a7789e52431..2ad2784b323 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -92,7 +92,7 @@ class share_create(osv.osv_memory): def _create_new_share_users(self, cr, uid, wizard_data, group_id, context=None): user_obj = self.pool.get('res.users') - current_user = user_obj.browse(cr, uid, uid) + current_user = user_obj.browse(cr, uid, uid, context=context) user_ids = [] if wizard_data.user_type == 'new': for new_user in wizard_data.new_users.split('\n'): diff --git a/addons/stock/stock.py b/addons/stock/stock.py index df24fa88dba..7637615727b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -260,7 +260,7 @@ class stock_location(osv.osv): context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype - context['currency_id'] = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id + context['currency_id'] = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id # To be able to offer recursive or non-recursive reports we need to prevent recursive quantities by default context['compute_child'] = False @@ -839,7 +839,7 @@ class stock_picking(osv.osv): """ Changes move state to assigned. @return: True """ - for pick in self.browse(cr, uid, ids): + for pick in self.browse(cr, uid, ids, context=context): todo = [] for move in pick.move_lines: if move.state == 'assigned': @@ -1451,11 +1451,11 @@ class stock_move(osv.osv): res.append((line.id, (line.product_id.code or '/')+': '+line.location_id.name+' > '+line.location_dest_id.name)) return res - def _check_tracking(self, cr, uid, ids): + def _check_tracking(self, cr, uid, ids, context=None): """ Checks if production lot is assigned to stock move or not. @return: True or False """ - for move in self.browse(cr, uid, ids): + for move in self.browse(cr, uid, ids, context=context): if not move.prodlot_id and \ (move.state == 'done' and \ ( \ @@ -1467,11 +1467,11 @@ class stock_move(osv.osv): return False return True - def _check_product_lot(self, cr, uid, ids): + def _check_product_lot(self, cr, uid, ids, context=None): """ Checks whether move is done or not and production lot is assigned to that move. @return: True or False """ - for move in self.browse(cr, uid, ids): + for move in self.browse(cr, uid, ids, context=context): if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id): return False return True @@ -1876,7 +1876,7 @@ class stock_move(osv.osv): def setlast_tracking(self, cr, uid, ids, context=None): tracking_obj = self.pool.get('stock.tracking') - picking = self.browse(cr, uid, ids)[0].picking_id + picking = self.browse(cr, uid, ids, context=context)[0].picking_id if picking: last_track = [line.tracking_id.id for line in picking.move_lines if line.tracking_id] if not last_track: @@ -1899,7 +1899,7 @@ class stock_move(osv.osv): if context is None: context = {} pickings = {} - for move in self.browse(cr, uid, ids): + for move in self.browse(cr, uid, ids, context=context): if move.state in ('confirmed', 'waiting', 'assigned', 'draft'): if move.picking_id: pickings[move.picking_id.id] = True @@ -2027,7 +2027,7 @@ class stock_move(osv.osv): partial_obj=self.pool.get('stock.partial.picking') partial_id=partial_obj.search(cr,uid,[]) if partial_id: - partial_datas=partial_obj.read(cr,uid,partial_id)[0] + partial_datas = partial_obj.read(cr, uid, partial_id, context=context)[0] if context is None: context = {} @@ -2189,7 +2189,7 @@ class stock_move(osv.osv): res = [] - for move in self.browse(cr, uid, ids): + for move in self.browse(cr, uid, ids, context=context): if split_by_qty <= 0 or quantity == 0: return res @@ -2232,7 +2232,7 @@ class stock_move(osv.osv): self.write(cr, uid, [current_move], update_val) return res - def action_consume(self, cr, uid, ids, quantity, location_id=False, context=None): + def action_consume(self, cr, uid, ids, quantity, location_id=False, context=None): """ Consumed product with specific quatity from specific source location @param cr: the database cursor @param uid: the user id @@ -2316,7 +2316,7 @@ class stock_move(osv.osv): uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") - if context is None: + if context is None: context = {} complete, too_many, too_few = [], [], [] diff --git a/addons/stock_planning/stock_planning.py b/addons/stock_planning/stock_planning.py index d9a6eb6e84c..9fdd94c909d 100644 --- a/addons/stock_planning/stock_planning.py +++ b/addons/stock_planning/stock_planning.py @@ -231,7 +231,7 @@ class stock_sale_forecast(osv.osv): def calculate_sales_history(self, cr, uid, ids, context, *args): sales = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],] - for obj in self.browse(cr, uid, ids): + for obj in self.browse(cr, uid, ids, context=context): periods = obj.analyzed_period1_id, obj.analyzed_period2_id, obj.analyzed_period3_id, obj.analyzed_period4_id, obj.analyzed_period5_id so_obj = self.pool.get('sale.order') so_line_obj = self.pool.get('sale.order.line') @@ -616,11 +616,11 @@ class stock_planning(osv.osv): return uom_qty, uom, uos_qty, uos def procure_incomming_left(self, cr, uid, ids, context, *args): - for obj in self.browse(cr, uid, ids): + for obj in self.browse(cr, uid, ids, context=context): if obj.incoming_left <= 0: raise osv.except_osv(_('Error !'), _('Incoming Left must be greater than 0 !')) uom_qty, uom, uos_qty, uos = self._qty_to_standard(cr, uid, obj, context) - user = self.pool.get('res.users').browse(cr, uid, uid, context) + user = self.pool.get('res.users').browse(cr, uid, uid, context=context) proc_id = self.pool.get('procurement.order').create(cr, uid, { 'company_id' : obj.company_id.id, 'name': _('Manual planning for ') + obj.period_id.name, @@ -658,7 +658,7 @@ class stock_planning(osv.osv): return True def internal_supply(self, cr, uid, ids, context, *args): - for obj in self.browse(cr, uid, ids): + for obj in self.browse(cr, uid, ids, context=context): if obj.incoming_left <= 0: raise osv.except_osv(_('Error !'), _('Incoming Left must be greater than 0 !')) if not obj.supply_warehouse_id: diff --git a/addons/subscription/subscription.py b/addons/subscription/subscription.py index 255c6ccf8c1..4f40ea25c35 100644 --- a/addons/subscription/subscription.py +++ b/addons/subscription/subscription.py @@ -58,7 +58,7 @@ class subscription_document_fields(osv.osv): _defaults = {} subscription_document_fields() -def _get_document_types(self, cr, uid, context={}): +def _get_document_types(self, cr, uid, context=None): cr.execute('select m.model, s.name from subscription_document s, ir_model m WHERE s.model = m.id order by s.name') return cr.fetchall() @@ -92,7 +92,7 @@ class subscription_subscription(osv.osv): } def set_process(self, cr, uid, ids, context=None): - for row in self.read(cr, uid, ids): + for row in self.read(cr, uid, ids, context=context): mapping = {'name':'name','interval_number':'interval_number','interval_type':'interval_type','exec_init':'numbercall','date_init':'nextcall'} res = {'model':'subscription.subscription', 'args': repr([[row['id']]]), 'function':'model_copy', 'priority':6, 'user_id':row['user_id'] and row['user_id'][0]} for key,value in mapping.items(): @@ -102,7 +102,7 @@ class subscription_subscription(osv.osv): return True def model_copy(self, cr, uid, ids, context=None): - for row in self.read(cr, uid, ids): + for row in self.read(cr, uid, ids, context=context): if not row.get('cron_id',False): continue cron_ids = [row['cron_id'][0]] diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 10c98e61e25..903629f76d8 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -623,7 +623,7 @@ class survey_response(osv.osv): def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] - reads = self.read(cr, uid, ids, ['user_id','date_create'], context) + reads = self.read(cr, uid, ids, ['user_id','date_create'], context=context) res = [] for record in reads: name = (record['user_id'] and record['user_id'][1] or '' )+ ' (' + record['date_create'].split('.')[0] + ')'