=== modified file 'account/account.py' --- account/account.py 2010-03-06 20:52:19 +0000 +++ account/account.py 2010-03-10 10:58:58 +0000 @@ -47,7 +47,7 @@ } _order = "name" - def compute(self, cr, uid, id, value, date_ref=False, context={}): + def compute(self, cr, uid, id, value, date_ref=False, context=None): if not date_ref: date_ref = datetime.now().strftime('%Y-%m-%d') pt = self.browse(cr, uid, id, context) @@ -99,7 +99,7 @@ } _order = "sequence" - def _check_percent(self, cr, uid, ids, context={}): + def _check_percent(self, cr, uid, ids, context=None): obj = self.browse(cr, uid, ids[0]) if obj.value == 'procent' and ( obj.value_amount < 0.0 or obj.value_amount > 1.0): return False @@ -131,7 +131,7 @@ _order = "sequence" account_account_type() -def _code_get(self, cr, uid, context={}): +def _code_get(self, cr, uid, context=None): acc_type_obj = self.pool.get('account.account.type') ids = acc_type_obj.search(cr, uid, []) res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context) @@ -186,7 +186,7 @@ return super(account_account, self).search(cr, uid, args, offset, limit, order, context=context, count=count) - def _get_children_and_consol(self, cr, uid, ids, context={}): + def _get_children_and_consol(self, cr, uid, ids, context=None): #this function search for all the children and all consolidated children (recursively) of the given account ids ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context) ids3 = [] @@ -197,7 +197,7 @@ ids3 = self._get_children_and_consol(cr, uid, ids3, context) return ids2 + ids3 - def __compute(self, cr, uid, ids, field_names, arg, context={}, query=''): + def __compute(self, cr, uid, ids, field_names, arg, context=None, query=''): #compute the balance/debit/credit accordingly to the value of field_name for the given account ids mapping = { 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance ", @@ -255,13 +255,13 @@ res[id] = sums[id] return res - def _get_company_currency(self, cr, uid, ids, field_name, arg, context={}): + def _get_company_currency(self, cr, uid, ids, field_name, arg, context=None): result = {} for rec in self.browse(cr, uid, ids, context): result[rec.id] = (rec.company_id.currency_id.id,rec.company_id.currency_id.code) return result - def _get_child_ids(self, cr, uid, ids, field_name, arg, context={}): + def _get_child_ids(self, cr, uid, ids, field_name, arg, context=None): result = {} for record in self.browse(cr, uid, ids, context): if record.child_parent_ids: @@ -324,7 +324,7 @@ "otherwise it will only print its balance."), } - def _default_company(self, cr, uid, context={}): + def _default_company(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id @@ -394,7 +394,7 @@ ids = self.search(cr, user, args, context=context, limit=limit) return self.name_get(cr, user, ids, context=context) - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name', 'code'], context) @@ -406,7 +406,11 @@ res.append((record['id'], name)) return res - def copy(self, cr, uid, id, default={}, context={}, done_list=[], local=False): + def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False): + if default is None: + default = {} + if done_list is None: + done_list = [] account = self.browse(cr, uid, id, context=context) new_child_ids = [] if not default: @@ -445,7 +449,7 @@ self._check_moves(cr, uid, ids, "write", context) return super(account_account, self).write(cr, uid, ids, vals, context=context) - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): self._check_moves(cr, uid, ids, "unlink", context) return super(account_account, self).unlink(cr, uid, ids, context) @@ -463,7 +467,7 @@ class account_journal_column(osv.osv): - def _col_get(self, cr, user, context={}): + def _col_get(self, cr, user, context=None): result = [] cols = self.pool.get('account.move.line')._columns for col in cols: @@ -522,7 +526,7 @@ 'user_id': lambda self,cr,uid,context: uid, 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, } - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): journal_id = super(account_journal, self).create(cr, uid, vals, context) # journal_name = self.browse(cr, uid, [journal_id])[0].code # periods = self.pool.get('account.period') @@ -569,7 +573,7 @@ } _order = "date_start" - def _check_duration(self,cr,uid,ids): + def _check_duration(self, cr, uid, ids): obj_fy=self.browse(cr,uid,ids[0]) if obj_fy.date_stop < obj_fy.date_start: return False @@ -579,10 +583,10 @@ (_check_duration, 'Error ! The duration of the Fiscal Year is invalid. ', ['date_stop']) ] - def create_period3(self,cr, uid, ids, context={}): + def create_period3(self, cr, uid, ids, context=None): return self.create_period(cr, uid, ids, context, 3) - def create_period(self,cr, uid, ids, context={}, interval=1): + def create_period(self, cr, uid, ids, context=None, interval=1): for fy in self.browse(cr, uid, ids, context): ds = datetime.strptime(fy.date_start, '%Y-%m-%d') while ds.strftime('%Y-%m-%d')=', dt)]) @@ -634,13 +638,13 @@ } _order = "date_start" - def _check_duration(self,cr,uid,ids,context={}): + def _check_duration(self, cr, uid, ids, context=None): obj_period=self.browse(cr,uid,ids[0]) if obj_period.date_stop < obj_period.date_start: return False return True - def _check_year_limit(self,cr,uid,ids,context={}): + def _check_year_limit(self, cr, uid, ids, context=None): for obj_period in self.browse(cr,uid,ids): if obj_period.special: continue @@ -662,13 +666,13 @@ (_check_year_limit, 'Invalid period ! Some periods overlap or the date period is not in the scope of the fiscal year. ', ['date_stop']) ] - def next(self, cr, uid, period, step, context={}): + def next(self, cr, uid, period, step, context=None): ids = self.search(cr, uid, [('date_start','>',period.date_start)]) if len(ids)>=step: return ids[step-1] return False - def find(self, cr, uid, dt=None, context={}): + def find(self, cr, uid, dt=None, context=None): if not dt: dt = time.strftime('%Y-%m-%d') #CHECKME: shouldn't we check the state of the period? @@ -693,7 +697,7 @@ _name = "account.journal.period" _description = "Journal - Period" - def _icon_get(self, cr, uid, ids, field_name, arg=None, context={}): + def _icon_get(self, cr, uid, ids, field_name, arg=None, context=None): result = {}.fromkeys(ids, 'STOCK_NEW') for r in self.read(cr, uid, ids, ['state']): result[r['id']] = { @@ -715,7 +719,7 @@ 'company_id' : fields.many2one('res.company', 'Company') } - def _check(self, cr, uid, ids, context={}): + def _check(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context): cr.execute('select * from account_move_line where journal_id=%s and period_id=%s limit 1', (obj.journal_id.id, obj.period_id.id)) res = cr.fetchall() @@ -723,18 +727,18 @@ raise osv.except_osv(_('Error !'), _('You can not modify/delete a journal with entries for this period !')) return True - def write(self, cr, uid, ids, vals, context={}): + def write(self, cr, uid, ids, vals, context=None): self._check(cr, uid, ids, context) return super(account_journal_period, self).write(cr, uid, ids, vals, context) - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): period_id=vals.get('period_id',False) if period_id: period = self.pool.get('account.period').browse(cr, uid,period_id) vals['state']=period.state return super(account_journal_period, self).create(cr, uid, vals, context) - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): self._check(cr, uid, ids, context) return super(account_journal_period, self).unlink(cr, uid, ids, context) @@ -784,7 +788,7 @@ else: return False - def _amount_compute(self, cr, uid, ids, name, args, context, where =''): + def _amount_compute(self, cr, uid, ids, name, args, context, where=''): if not ids: return {} cr.execute('select move_id,sum(debit) from account_move_line where move_id =ANY(%s) group by move_id',(ids,)) result = dict(cr.fetchall()) @@ -893,7 +897,7 @@ def button_validate(self, cursor, user, ids, context=None): return self.post(cursor, user, ids, context=context) - def button_cancel(self, cr, uid, ids, context={}): + def button_cancel(self, cr, uid, ids, context=None): for line in self.browse(cr, uid, ids, context): if not line.journal_id.update_posted: raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.')) @@ -901,7 +905,9 @@ cr.execute('update account_move set state=%s where id =ANY(%s)',('draft',ids,)) return True - def write(self, cr, uid, ids, vals, context={}): + def write(self, cr, uid, ids, vals, context=None): + if context is None: + context = {} c = context.copy() c['novalidate'] = True result = super(osv.osv, self).write(cr, uid, ids, vals, c) @@ -911,7 +917,9 @@ # # TODO: Check if period is closed ! # - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): + if context is None: + context = {} if 'line_id' in vals: if 'journal_id' in vals: for l in vals['line_id']: @@ -947,7 +955,9 @@ default.update({'state':'draft', 'name':'/',}) return super(account_move, self).copy(cr, uid, id, default, context) - def unlink(self, cr, uid, ids, context={}, check=True): + def unlink(self, cr, uid, ids, context=None, check=True): + if context is None: + context = {} toremove = [] for move in self.browse(cr, uid, ids, context): if move['state'] != 'draft': @@ -963,7 +973,7 @@ result = super(account_move, self).unlink(cr, uid, toremove, context) return result - def _compute_balance(self, cr, uid, id, context={}): + def _compute_balance(self, cr, uid, id, context=None): move = self.browse(cr, uid, [id])[0] amount = 0 for line in move.line_id: @@ -1026,7 +1036,9 @@ # # Validate a balanced move. If it is a centralised journal, create a move. # - def validate(self, cr, uid, ids, context={}): + def validate(self, cr, uid, ids, context=None): + if context is None: + context = {} if context and ('__last_update' in context): del context['__last_update'] ok = True @@ -1125,7 +1137,7 @@ _defaults = { 'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/', } - def reconcile_partial_check(self, cr, uid, ids, type='auto', context={}): + def reconcile_partial_check(self, cr, uid, ids, type='auto', context=None): total = 0.0 for rec in self.browse(cr, uid, ids, context): for line in rec.line_partial_ids: @@ -1166,7 +1178,7 @@ This code is used for some tax declarations. """ - def _sum(self, cr, uid, ids, name, args, context, where =''): + def _sum(self, cr, uid, ids, name, args, context, where=''): ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if context.get('based_on', 'invoices') == 'payments': cr.execute('SELECT line.tax_code_id, sum(line.tax_amount) \ @@ -1245,7 +1257,7 @@ return [(x['id'], (x['code'] and x['code'] + ' - ' or '') + x['name']) \ for x in reads] - def _default_company(self, cr, uid, context={}): + def _default_company(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id @@ -1335,7 +1347,7 @@ args.append(('type_tax_use','in',['purchase','all'])) return super(account_tax, self).search(cr, uid, args, offset, limit, order, context, count) - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] res = [] @@ -1344,7 +1356,7 @@ res.append((record['id'],name )) return res - def _default_company(self, cr, uid, context={}): + def _default_company(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id @@ -1585,7 +1597,9 @@ _defaults = { 'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s : To Specify Year \n%(month)s : To Specify Month \n%(date)s : Current Date\n\ne.g. My model on %(date)s'), } - def generate(self, cr, uid, ids, datas={}, context={}): + def generate(self, cr, uid, ids, datas=None, context=None): + if context is None: + context = {} move_ids = [] for model in self.browse(cr, uid, ids, context): context.update({'date':datas['date']}) @@ -1685,11 +1699,11 @@ 'period_nbr': lambda *a: 1, 'state': lambda *a: 'draft', } - def state_draft(self, cr, uid, ids, context={}): + def state_draft(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'draft'}) return False - def check(self, cr, uid, ids, context={}): + def check(self, cr, uid, ids, context=None): todone = [] for sub in self.browse(cr, uid, ids, context): ok = True @@ -1703,7 +1717,7 @@ self.write(cr, uid, todone, {'state':'done'}) return False - def remove_line(self, cr, uid, ids, context={}): + def remove_line(self, cr, uid, ids, context=None): toremove = [] for sub in self.browse(cr, uid, ids, context): for line in sub.lines_id: @@ -1714,7 +1728,7 @@ self.write(cr, uid, ids, {'state':'draft'}) return False - def compute(self, cr, uid, ids, context={}): + def compute(self, cr, uid, ids, context=None): for sub in self.browse(cr, uid, ids, context): ds = sub.date_start for i in range(sub.period_total): @@ -1742,7 +1756,7 @@ } _defaults = { } - def move_create(self, cr, uid, ids, context={}): + def move_create(self, cr, uid, ids, context=None): tocheck = {} for line in self.browse(cr, uid, ids, context): datas = { @@ -1864,7 +1878,7 @@ ] - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name','code'], context) @@ -1907,7 +1921,7 @@ 'cparent_id': _get_def_cparent, } - def action_create(self,cr,uid,ids,context=None): + def action_create(self, cr, uid, ids, context=None): acc_obj=self.pool.get('account.account') tmpl_obj=self.pool.get('account.account.template') data= self.read(cr,uid,ids) @@ -1934,7 +1948,7 @@ new_account = acc_obj.create(cr,uid,vals) return {'type':'state', 'state': 'end' } - def action_cancel(self,cr,uid,ids,context=None): + def action_cancel(self, cr, uid, ids, context=None): return { 'type': 'state', 'state': 'end' } account_add_tmpl_wizard() @@ -2047,7 +2061,7 @@ 'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Use In', required=True,) } - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] res = [] @@ -2056,7 +2070,7 @@ res.append((record['id'],name )) return res - def _default_company(self, cr, uid, context={}): + def _default_company(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id @@ -2148,7 +2162,7 @@ 'seq_journal':fields.boolean('Separated Journal Sequences',help="Check this box if you want to use a different sequence for each created journal. Otherwise, all will use the same sequence."), } - def _get_chart(self, cr, uid, context={}): + def _get_chart(self, cr, uid, context=None): ids = self.pool.get('account.chart.template').search(cr, uid, [], context=context) if ids: return ids[0] === modified file 'account/account_analytic_line.py' --- account/account_analytic_line.py 2010-03-06 20:52:19 +0000 +++ account/account_analytic_line.py 2010-03-10 10:58:56 +0000 @@ -32,7 +32,9 @@ _name = 'account.analytic.line' _description = 'Analytic lines' - def _amount_currency(self, cr, uid, ids, field_name, arg, context={}): + def _amount_currency(self, cr, uid, ids, field_name, arg, context=None): + if context is None: + context = {} result = {} for rec in self.browse(cr, uid, ids, context): cmp_cur_id=rec.company_id.currency_id.id @@ -57,7 +59,7 @@ result[rec.id] = (rec.account_id.currency_id.id,rec.account_id.currency_id.code) return result - def _get_account_line(self, cr, uid, ids, context={}): + def _get_account_line(self, cr, uid, ids, context=None): aac_ids = {} for acc in self.pool.get('account.analytic.account').browse(cr, uid, ids): aac_ids[acc.id] = True === modified file 'account/account_bank_statement.py' --- account/account_bank_statement.py 2010-03-01 04:54:48 +0000 +++ account/account_bank_statement.py 2010-03-10 10:58:58 +0000 @@ -27,12 +27,14 @@ from tools.translate import _ class account_bank_statement(osv.osv): - def _default_journal_id(self, cr, uid, context={}): + def _default_journal_id(self, cr, uid, context=None): + if context is None: + context = {} if context.get('journal_id', False): return context['journal_id'] return False - def _default_balance_start(self, cr, uid, context={}): + def _default_balance_start(self, cr, uid, context=None): cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,)) res = cr.fetchone() if res: @@ -72,7 +74,7 @@ res[r] = round(res[r], 2) return res - def _get_period(self, cr, uid, context={}): + def _get_period(self, cr, uid, context=None): periods = self.pool.get('account.period').find(cr, uid) if periods: return periods[0] @@ -139,7 +141,7 @@ 'period_id': _get_period, } - def button_confirm(self, cr, uid, ids, context={}): + def button_confirm(self, cr, uid, ids, context=None): done = [] res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') @@ -305,7 +307,7 @@ self.write(cr, uid, done, {'state':'confirm'}, context=context) return True - def button_cancel(self, cr, uid, ids, context={}): + def button_cancel(self, cr, uid, ids, context=None): done = [] for st in self.browse(cr, uid, ids, context): if st.state=='draft': === modified file 'account/account_move_line.py' --- account/account_move_line.py 2010-03-06 20:52:19 +0000 +++ account/account_move_line.py 2010-03-10 10:58:56 +0000 @@ -32,7 +32,9 @@ _name = "account.move.line" _description = "Entry lines" - def _query_get(self, cr, uid, obj='l', context={}): + def _query_get(self, cr, uid, obj='l', context=None): + if context is None: + context = {} fiscalyear_obj = self.pool.get('account.fiscalyear') fiscalperiod_obj = self.pool.get('account.period') fiscalyear_ids = [] @@ -100,14 +102,14 @@ return query - def default_get(self, cr, uid, fields, context={}): + def default_get(self, cr, uid, fields, context=None): data = self._default_get(cr, uid, fields, context) for f in data.keys(): if f not in fields: del data[f] return data - def create_analytic_lines(self, cr, uid, ids, context={}): + def create_analytic_lines(self, cr, uid, ids, context=None): for obj_line in self.browse(cr, uid, ids, context): if obj_line.analytic_account_id: if not obj_line.journal_id.analytic_journal_id: @@ -137,7 +139,9 @@ del(data['account_tax_id']) return data - def _default_get(self, cr, uid, fields, context={}): + def _default_get(self, cr, uid, fields, context=None): + if context is None: + context = {} # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form @@ -278,7 +282,7 @@ data['amount_currency'] = v return data - def _on_create_write(self, cr, uid, id, context={}): + def _on_create_write(self, cr, uid, id, context=None): ml = self.browse(cr, uid, id, context) return map(lambda x: x.id, ml.move_id.line_id) @@ -314,7 +318,7 @@ res[line_id] = (invoice_id, invoice_names[invoice_id]) return res - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] result = [] @@ -385,7 +389,7 @@ return [('id', '=', '0')] return [('id', 'in', [x[0] for x in res])] - def _get_move_lines(self, cr, uid, ids, context={}): + def _get_move_lines(self, cr, uid, ids, context=None): result = [] for move in self.pool.get('account.move').browse(cr, uid, ids, context=context): for line in move.line_id: @@ -477,7 +481,7 @@ ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in accounting entry !'), ] - def _auto_init(self, cr, context={}): + def _auto_init(self, cr, context=None): super(account_move_line, self)._auto_init(cr, context) cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'') if not cr.fetchone(): @@ -570,7 +574,7 @@ # writeoff; entry generated for the difference between the lines # - def reconcile_partial(self, cr, uid, ids, type='auto', context={}): + def reconcile_partial(self, cr, uid, ids, type='auto', context=None): merges = [] unmerge = [] total = 0.0 @@ -597,7 +601,9 @@ self.pool.get('account.move.reconcile').reconcile_partial_check(cr, uid, [r_id] + merges_rec, context=context) return True - def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context={}): + def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context=None): + if context is None: + context = {} lines = self.browse(cr, uid, ids, context=context) unrec_lines = filter(lambda x: not x['reconcile_id'], lines) credit = debit = 0.0 @@ -719,7 +725,9 @@ return j+(p and (':'+p) or '') return False - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + if context is None: + context = {} result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) if view_type=='tree' and 'journal_id' in context: title = self.view_header_get(cr, uid, view_id, view_type, context) @@ -774,7 +782,9 @@ result['fields'] = self.fields_get(cr, uid, fields, context) return result - def unlink(self, cr, uid, ids, context={}, check=True): + def unlink(self, cr, uid, ids, context=None, check=True): + if context is None: + context = {} self._update_check(cr, uid, ids, context) result = False for line in self.browse(cr, uid, ids, context): @@ -814,7 +824,7 @@ self.pool.get('account.move').write(cr, uid, [line.move_id.id], {'date': todo_date}, context=context) return result - def _update_journal_check(self, cr, uid, journal_id, period_id, context={}): + def _update_journal_check(self, cr, uid, journal_id, period_id, context=None): cr.execute('select state from account_journal_period where journal_id=%s and period_id=%s', (journal_id, period_id)) result = cr.fetchall() for (state,) in result: @@ -830,7 +840,7 @@ }) return True - def _update_check(self, cr, uid, ids, context={}): + def _update_check(self, cr, uid, ids, context=None): done = {} for line in self.browse(cr, uid, ids, context): if line.move_id.state<>'draft': === modified file 'account/invoice.py' --- account/invoice.py 2010-03-06 20:52:19 +0000 +++ account/invoice.py 2010-03-10 10:58:56 +0000 @@ -187,7 +187,7 @@ result[invoice.id] = lines return result - def _get_invoice_from_line(self, cr, uid, ids, context={}): + def _get_invoice_from_line(self, cr, uid, ids, context=None): move = {} for line in self.pool.get('account.move.line').browse(cr, uid, ids): if line.reconcile_partial_id: @@ -201,7 +201,7 @@ invoice_ids = self.pool.get('account.invoice').search(cr, uid, [('move_id','in',move.keys())], context=context) return invoice_ids - def _get_invoice_from_reconcile(self, cr, uid, ids, context={}): + def _get_invoice_from_reconcile(self, cr, uid, ids, context=None): move = {} for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids): for line in r.line_partial_ids: @@ -1089,7 +1089,7 @@ account_invoice() class account_invoice_line(osv.osv): - def _amount_line(self, cr, uid, ids, prop, unknow_none,unknow_dict): + def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict): res = {} cur_obj=self.pool.get('res.currency') for line in self.browse(cr, uid, ids): @@ -1369,7 +1369,7 @@ 'company_id': fields.related('account_id','company_id',type='many2one',relation='res.company',string='Company',store=True), } - def base_change(self, cr, uid, ids, base,currency_id=False,company_id=False,date_invoice=False): + def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency=False @@ -1379,7 +1379,7 @@ base = cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False) return {'value': {'base_amount':base}} - def amount_change(self, cr, uid, ids, amount,currency_id=False,company_id=False,date_invoice=False): + def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False): cur_obj = self.pool.get('res.currency') company_obj = self.pool.get('res.company') company_currency=False @@ -1395,7 +1395,7 @@ 'base_amount': lambda *a: 0.0, 'tax_amount': lambda *a: 0.0, } - def compute(self, cr, uid, invoice_id, context={}): + def compute(self, cr, uid, invoice_id, context=None): tax_grouped = {} tax_obj = self.pool.get('account.tax') cur_obj = self.pool.get('res.currency') === modified file 'account/partner.py' --- account/partner.py 2010-02-24 10:55:29 +0000 +++ account/partner.py 2010-03-10 10:58:56 +0000 @@ -33,7 +33,7 @@ 'note': fields.text('Notes', translate=True), } - def map_tax(self, cr, uid, fposition_id, taxes, context={}): + def map_tax(self, cr, uid, fposition_id, taxes, context=None): if not taxes: return [] if not fposition_id: @@ -50,7 +50,7 @@ result.append(t.id) return result - def map_account(self, cr, uid, fposition_id, account_id, context={}): + def map_account(self, cr, uid, fposition_id, account_id, context=None): if not fposition_id : return account_id for pos in fposition_id.account_ids: === modified file 'account/project/wizard/wizard_account_analytic_line.py' --- account/project/wizard/wizard_account_analytic_line.py 2010-02-24 10:55:29 +0000 +++ account/project/wizard/wizard_account_analytic_line.py 2010-03-10 10:58:56 +0000 @@ -24,7 +24,7 @@ import time from tools.translate import _ -def _action_open_window(self, cr, uid, data, context): +def _action_open_window(self, cr, uid, data, context): domain = [] from_date = data['form']['from_date'] to_date = data['form']['to_date'] === modified file 'account/report/account_balance.py' --- account/report/account_balance.py 2010-02-24 10:55:29 +0000 +++ account/report/account_balance.py 2010-03-10 10:58:55 +0000 @@ -79,7 +79,9 @@ return str(result and result[:-1]) or '' - def lines(self, form, ids={}, done=None, level=1): + def lines(self, form, ids=None, done=None, level=1): + if ids is None: + ids = {} if not ids: ids = self.ids if not ids: === modified file 'account/report/account_balance_landscape.py' (properties changed: +x to -x) --- account/report/account_balance_landscape.py 2010-03-05 10:36:09 +0000 +++ account/report/account_balance_landscape.py 2010-03-10 10:58:55 +0000 @@ -320,7 +320,7 @@ # i+=1 # return super(account_balance_landscape,self).repeatIn(lst, name, nodes_parent=False) #end - def linesForYear(self,form): + def linesForYear(self, form): temp=0 years={} @@ -382,7 +382,9 @@ return [years] - def linesForTotal(self,form,ids={},doneAccount={},level=1): + def linesForTotal(self, form, ids=None, doneAccount=None, level=1): + if ids is None: + ids = {} if self.done_total==1: self.done_total==1 else: @@ -447,7 +449,9 @@ return [self.result_total] - def lines(self, form, ids={}, done={}, level=1): + def lines(self, form, ids=None, done=None, level=1): + if ids is None: + ids = {} accounts=[] if not ids: ids = self.ids @@ -598,7 +602,7 @@ return result - def get_years(self,form): + def get_years(self, form): result =[] res={} for temp in range(0,len(form['fiscalyear'][0][2])): @@ -611,7 +615,7 @@ self.linesForYear(form) return result - def get_lines(self,year_dict,form): + def get_lines(self, year_dict, form): final_result = [] line_l =[] res = {} @@ -643,7 +647,7 @@ final_result.append(res) return final_result - def cal_total(self,year_dict): + def cal_total(self, year_dict): total_l = self.result_total if total_l: for k,v in total_l.items(): === modified file 'account/report/aged_trial_balance.py' --- account/report/aged_trial_balance.py 2010-02-24 10:55:29 +0000 +++ account/report/aged_trial_balance.py 2010-03-10 10:58:55 +0000 @@ -200,15 +200,15 @@ totals[str(i)] += float(r[str(i)] or 0.0) return res - def _get_total(self,pos): - period = self.total_account[int(pos)] - return period - - def _get_direction(self,pos): - period = self.total_account[int(pos)] - return period - - def _get_for_period(self,pos): + def _get_total(self, pos): + period = self.total_account[int(pos)] + return period + + def _get_direction(self, pos): + period = self.total_account[int(pos)] + return period + + def _get_for_period(self, pos): period = self.total_account[int(pos)] return period === modified file 'account/report/compare_account_balance.py' (properties changed: +x to -x) --- account/report/compare_account_balance.py 2010-03-05 10:36:09 +0000 +++ account/report/compare_account_balance.py 2010-03-10 10:58:55 +0000 @@ -320,7 +320,7 @@ # return super(account_balance,self).repeatIn(lst, name, nodes_parent=False) #end - def linesForYear(self,form): + def linesForYear(self, form): temp=0 years={} @@ -382,7 +382,9 @@ return [years] - def linesForTotal(self,form,ids={},doneAccount={},level=1): + def linesForTotal(self, form, ids=None, doneAccount=None, level=1): + if ids is None: + ids = {} if self.done_total==1: self.done_total==1 else: @@ -444,7 +446,9 @@ return [self.result_total] - def lines(self, form, ids={}, done={}, level=1): + def lines(self, form, ids=None, done=None, level=1): + if ids is None: + ids = {} accounts=[] if not ids: ids = self.ids @@ -594,7 +598,7 @@ return result - def get_years(self,form): + def get_years(self, form): result =[] res={} for temp in range(0,len(form['fiscalyear'][0][2])): @@ -607,7 +611,7 @@ self.linesForYear(form) return result - def get_lines(self,year_dict,form): + def get_lines(self, year_dict, form): final_result = [] line_l =[] res = {} @@ -639,7 +643,7 @@ final_result.append(res) return final_result - def cal_total(self,year_dict): + def cal_total(self, year_dict): total_l = self.result_total if total_l: for k,v in total_l.items(): === modified file 'account/report/general_journal.py' --- account/report/general_journal.py 2010-02-24 10:55:29 +0000 +++ account/report/general_journal.py 2010-03-10 10:58:55 +0000 @@ -39,7 +39,7 @@ 'sum_credit': self._sum_credit }) - def set_context(self, objects, data, ids, report_type = None): + def set_context(self, objects, data, ids, report_type=None): super(journal_print, self).set_context(objects, data, ids, report_type) self.cr.execute('select period_id, journal_id from account_journal_period where id =ANY(%s)',(ids,)) res = self.cr.fetchall() @@ -58,7 +58,9 @@ filtered_objs = filter(filter_unique, journal_period_objs) return map(lambda x: x.period_id, filtered_objs) - def lines(self, period_id, journal_id=[]): + def lines(self, period_id, journal_id=None): + if journal_id is None: + journal_id = [] if type(period_id)==type([]): ids_final = [] for journal in journal_id: @@ -86,7 +88,7 @@ res = self.cr.dictfetchall() return res - def _sum_debit_period(self, period_id,journal_id=None): + def _sum_debit_period(self, period_id, journal_id=None): if type(journal_id)==type([]): self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id =ANY(%s) and state<>\'draft\'', (period_id,journal_id,)) return self.cr.fetchone()[0] or 0.0 @@ -96,7 +98,7 @@ return self.cr.fetchone()[0] or 0.0 - def _sum_credit_period(self, period_id,journal_id=None): + def _sum_credit_period(self, period_id, journal_id=None): if type(journal_id)==type([]): self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id =ANY(%s) and state<>\'draft\'', (period_id,journal_id,)) return self.cr.fetchone()[0] or 0.0 @@ -105,7 +107,7 @@ self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id =ANY(%s) and state<>\'draft\'', (period_id,self.journal_ids,)) return self.cr.fetchone()[0] or 0.0 - def _sum_debit(self,period_id=None,journal_id=None): + def _sum_debit(self, period_id=None, journal_id=None): if type(period_id)==type([]): self.cr.execute('select sum(debit) from account_move_line where period_id =ANY(%s) and journal_id =ANY(%s) and state<>\'draft\'',(period_id,journal_id,)) return self.cr.fetchone()[0] or 0.0 @@ -114,7 +116,7 @@ self.cr.execute('select sum(debit) from account_move_line where period_id =ANY(%s) and journal_id =ANY(%s) and state<>\'draft\'',(self.period_ids,self.journal_ids,)) return self.cr.fetchone()[0] or 0.0 - def _sum_credit(self,period_id=None,journal_id=None): + def _sum_credit(self, period_id=None, journal_id=None): if type(period_id)==type([]): self.cr.execute('select sum(credit) from account_move_line where period_id =ANY(%s) and journal_id =ANY(%s) and state<>\'draft\'',(period_id,journal_id,)) return self.cr.fetchone()[0] or 0.0 === modified file 'account/report/general_ledger.py' --- account/report/general_ledger.py 2010-03-01 04:00:47 +0000 +++ account/report/general_ledger.py 2010-03-10 10:58:55 +0000 @@ -35,7 +35,7 @@ - def set_context(self, objects, data, ids, report_type = None): + def set_context(self, objects, data, ids, report_type=None): ## self.borne_date = self.get_min_date(data['form']) ## @@ -104,7 +104,7 @@ rup_id+=1 return result - def get_min_date(self,form): + def get_min_date(self, form): ## Get max born from account_fiscal year # === modified file 'account/report/general_ledger_landscape.py' --- account/report/general_ledger_landscape.py 2010-03-01 04:00:47 +0000 +++ account/report/general_ledger_landscape.py 2010-03-10 10:58:55 +0000 @@ -36,7 +36,7 @@ _name = 'report.account.general.ledger_landscape' - def set_context(self, objects, data, ids, report_type = None): + def set_context(self, objects, data, ids, report_type=None): ## self.borne_date = self.get_min_date(data['form']) ## @@ -105,7 +105,7 @@ rup_id+=1 return result - def get_min_date(self,form): + def get_min_date(self, form): ## Get max born from account_fiscal year # === modified file 'account/report/overdue.py' --- account/report/overdue.py 2010-02-24 10:55:29 +0000 +++ account/report/overdue.py 2010-03-10 10:58:55 +0000 @@ -58,7 +58,7 @@ res.append(result) return res - def _tel_get(self,partner): + def _tel_get(self, partner): if not partner: return False res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address') === modified file 'account/report/partner_balance.py' (properties changed: +x to -x) --- account/report/partner_balance.py 2010-02-24 10:55:29 +0000 +++ account/report/partner_balance.py 2010-03-10 10:58:55 +0000 @@ -49,7 +49,7 @@ # # Date Management # - def date_range(self,start,end): + def date_range(self, start, end): if not start or not end: return [] start = datetime.date.fromtimestamp(time.mktime(time.strptime(start,"%Y-%m-%d"))) @@ -63,7 +63,7 @@ full_str_date.append(str(date)) return full_str_date - def transform_period_into_date_array(self,data): + def transform_period_into_date_array(self, data): ## Get All Period Date # # If we have no period we will take all perdio in the FiscalYear. @@ -79,12 +79,12 @@ self.date_lst.sort() - def transform_date_into_date_array(self,data): + def transform_date_into_date_array(self, data): return_array = self.date_range(data['form']['date1'],data['form']['date2']) self.date_lst = return_array self.date_lst.sort() - def transform_both_into_date_array(self,data): + def transform_both_into_date_array(self, data): if not data['form']['periods'][0][2] : periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) else: @@ -115,7 +115,7 @@ self.date_lst = final_date_array self.date_lst.sort() - def transform_none_into_date_array(self,data): + def transform_none_into_date_array(self, data): sql = "SELECT min(date) as start_date from account_move_line" self.cr.execute(sql) @@ -132,7 +132,7 @@ self.date_lst.sort() - def comma_me(self,amount): + def comma_me(self, amount): if type(amount) is float : amount = str('%.2f'%amount) else : @@ -146,7 +146,7 @@ else: return self.comma_me(new) - def set_context(self, objects, data, ids, report_type = None): + def set_context(self, objects, data, ids, report_type=None): # Transformation des date # # @@ -189,7 +189,7 @@ super(partner_balance, self).set_context(objects, data, ids, report_type) - def lines(self,data): + def lines(self, data): account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') full_account = [] @@ -225,7 +225,7 @@ ## We will now compute Total return self._add_subtotal(full_account) - def _add_subtotal(self,cleanarray): + def _add_subtotal(self, cleanarray): i=0 completearray = [] tot_debit = 0.0 @@ -344,7 +344,7 @@ return completearray - def _sum_debit(self,data): + def _sum_debit(self, data): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -361,7 +361,7 @@ return result_tmp - def _sum_credit(self,data): + def _sum_credit(self, data): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -379,7 +379,7 @@ return result_tmp - def _sum_litige(self,data): + def _sum_litige(self, data): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -397,7 +397,7 @@ return result_tmp - def _sum_sdebit(self,data): + def _sum_sdebit(self, data): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -422,7 +422,7 @@ return result_tmp - def _sum_scredit(self,data): + def _sum_scredit(self, data): if not self.ids: return 0.0 @@ -450,11 +450,11 @@ return result_tmp - def _solde_balance_debit(self,data): + def _solde_balance_debit(self, data): debit, credit = self._sum_debit(data), self._sum_credit(data) return debit > credit and debit - credit - def _solde_balance_credit(self,data): + def _solde_balance_credit(self, data): debit, credit = self._sum_debit(data), self._sum_credit(data) return credit > debit and credit - debit === modified file 'account/report/rml_parse.py' --- account/report/rml_parse.py 2010-03-05 10:36:09 +0000 +++ account/report/rml_parse.py 2010-03-10 10:58:55 +0000 @@ -40,7 +40,7 @@ 'explode_name' : self._explode_name, }) - def comma_me(self,amount): + def comma_me(self, amount): #print "#" + str(amount) + "#" if not amount: amount = 0.0 @@ -65,13 +65,13 @@ def _strip_name(self, name, maxlen=50): return self._ellipsis(name, maxlen, '...') - def _get_and_change_date_format_for_swiss (self,date_to_format): + def _get_and_change_date_format_for_swiss (self, date_to_format): date_formatted='' if date_to_format: date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') return date_formatted - def _explode_name(self,chaine,length): + def _explode_name(self, chaine, length): # We will test if the size is less then account full_string = '' if (len(str(chaine)) <= length): @@ -91,7 +91,7 @@ return full_string - def makeAscii(self,str): + def makeAscii(self, str): try: Stringer = str.encode("utf-8") except UnicodeDecodeError: @@ -115,7 +115,7 @@ i = i + length chaine = str("".join(ast)) return chaine - def repair_string(self,chaine): + def repair_string(self, chaine): ast = list(chaine) UnicodeAst = [] _previouslyfound = False @@ -138,7 +138,7 @@ return "".join(UnicodeAst) - def ReencodeAscii(self,str): + def ReencodeAscii(self, str): print sys.stdin.encoding try: Stringer = str.decode("ascii") === modified file 'account/report/tax_report.py' --- account/report/tax_report.py 2010-02-24 10:55:29 +0000 +++ account/report/tax_report.py 2010-03-10 10:58:55 +0000 @@ -42,7 +42,7 @@ }) - def _get_lines(self, based_on,period_list,company_id=False, parent=False, level=0): + def _get_lines(self, based_on, period_list, company_id=False, parent=False, level=0): res = self._get_codes(based_on,company_id,parent,level,period_list) if period_list[0][2] : @@ -87,7 +87,7 @@ def _get_period(self, period_id): return self.pool.get('account.period').browse(self.cr, self.uid, period_id).name - def _get_general(self, tax_code_id,period_list ,company_id, based_on): + def _get_general(self, tax_code_id, period_list, company_id, based_on): res=[] if based_on == 'payments': self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \ @@ -141,7 +141,7 @@ i+=1 return res - def _get_codes(self,based_on, company_id, parent=False, level=0,period_list=[]): + def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=None): tc = self.pool.get('account.tax.code') ids = tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)]) @@ -152,7 +152,11 @@ res += self._get_codes(based_on, company_id, code.id, level+1) return res - def _add_codes(self,based_on, account_list=[],period_list=[]): + def _add_codes(self, based_on, account_list=None, period_list=None): + if account_list is None: + account_list = [] + if period_list is None: + period_list = [] res = [] for account in account_list: tc = self.pool.get('account.tax.code') @@ -174,7 +178,7 @@ def _get_currency(self, form): return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name - def sort_result(self,accounts): + def sort_result(self, accounts): # On boucle sur notre rapport result_accounts = [] ind=0 === modified file 'account/report/third_party_ledger.py' --- account/report/third_party_ledger.py 2010-02-24 10:55:29 +0000 +++ account/report/third_party_ledger.py 2010-03-10 10:58:55 +0000 @@ -57,7 +57,7 @@ return full_str_date # - def transform_period_into_date_array(self,data): + def transform_period_into_date_array(self, data): ## Get All Period Date if not data['form']['periods'][0][2] : periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) @@ -70,12 +70,12 @@ self.date_lst = date_array self.date_lst.sort() - def transform_date_into_date_array(self,data): + def transform_date_into_date_array(self, data): return_array = self.date_range(data['form']['date1'],data['form']['date2']) self.date_lst = return_array self.date_lst.sort() - def transform_both_into_date_array(self,data): + def transform_both_into_date_array(self, data): if not data['form']['periods'][0][2] : periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) @@ -105,7 +105,7 @@ self.date_lst = final_date_array self.date_lst.sort() - def transform_none_into_date_array(self,data): + def transform_none_into_date_array(self, data): sql = "SELECT min(date) as start_date from account_move_line" self.cr.execute(sql) start_date = self.cr.fetchone()[0] @@ -118,7 +118,7 @@ self.date_lst.sort() - def comma_me(self,amount): + def comma_me(self, amount): if type(amount) is float : amount = str('%.2f'%amount) else : @@ -137,7 +137,7 @@ string_map = date_string + ',' return string_map - def set_context(self, objects, data, ids, report_type = None): + def set_context(self, objects, data, ids, report_type=None): PARTNER_REQUEST = '' if (data['model'] == 'res.partner'): ## Si on imprime depuis les partenaires @@ -226,7 +226,7 @@ objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids) super(third_party_ledger, self).set_context(objects, data, new_ids, report_type) - def lines(self, partner,data): + def lines(self, partner, data): account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') full_account = [] if data['form']['reconcil'] : @@ -275,7 +275,7 @@ return full_account - def _sum_debit_partner(self, partner,data): + def _sum_debit_partner(self, partner, data): account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') result_tmp = 0.0 @@ -315,7 +315,7 @@ result_tmp = result_tmp + 0.0 return result_tmp - def _sum_credit_partner(self, partner,data): + def _sum_credit_partner(self, partner, data): account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') result_tmp = 0.0 if data['form']['reconcil'] : @@ -354,7 +354,7 @@ result_tmp = result_tmp + 0.0 return result_tmp - def _sum_debit(self,data): + def _sum_debit(self, data): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -395,7 +395,7 @@ return result_tmp - def _sum_credit(self,data): + def _sum_credit(self, data): if not self.ids: return 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') === modified file 'account/sequence.py' --- account/sequence.py 2010-02-24 10:55:29 +0000 +++ account/sequence.py 2010-03-10 10:58:56 +0000 @@ -42,7 +42,9 @@ _columns = { 'fiscal_ids' : fields.one2many('account.sequence.fiscalyear', 'sequence_main_id', 'Sequences') } - def get_id(self, cr, uid, sequence_id, test='id', context={}): + def get_id(self, cr, uid, sequence_id, test='id', context=None): + if context is None: + context = {} cr.execute('select id from ir_sequence where '+test+'=%s and active=%s', (sequence_id, True,)) res = cr.dictfetchone() if res: === modified file 'account/wizard/wizard_account_balance_report.py' --- account/wizard/wizard_account_balance_report.py 2010-02-24 10:55:29 +0000 +++ account/wizard/wizard_account_balance_report.py 2010-03-10 10:58:56 +0000 @@ -78,7 +78,7 @@ } class wizard_report(wizard.interface): - def _get_defaults(self, cr, uid, data, context={}): + def _get_defaults(self, cr, uid, data, context=None): user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) if user.company_id: company_id = user.company_id.id === modified file 'account/wizard/wizard_aged_trial_balance.py' (properties changed: +x to -x) === modified file 'account/wizard/wizard_automatic_reconcile.py' --- account/wizard/wizard_automatic_reconcile.py 2010-02-24 10:55:29 +0000 +++ account/wizard/wizard_automatic_reconcile.py 2010-03-10 10:58:57 +0000 @@ -137,7 +137,7 @@ #TODO: cleanup and comment this code... For now, it is awfulllll # (way too complex, and really slow)... -def do_reconcile(cr, uid, credits, debits, max_amount, power, writeoff_acc_id, period_id, journal_id, context={}): +def do_reconcile(cr, uid, credits, debits, max_amount, power, writeoff_acc_id, period_id, journal_id, context=None): # for one value of a credit, check all debits, and combination of them # depending on the power. It starts with a power of one and goes up # to the max power allowed === modified file 'account/wizard/wizard_compare_account_balance_report.py' (properties changed: +x to -x) --- account/wizard/wizard_compare_account_balance_report.py 2010-03-05 10:36:09 +0000 +++ account/wizard/wizard_compare_account_balance_report.py 2010-03-10 10:58:57 +0000 @@ -131,7 +131,9 @@ class wizard_report(wizard.interface): - def _get_defaults(self, cr, uid, data, context={}): + def _get_defaults(self, cr, uid, data, context=None): + if context is None: + context = {} data['form']['context'] = context fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') data['form']['fiscalyear']=[fiscalyear_obj.find(cr, uid)] === modified file 'account/wizard/wizard_general_ledger_report.py' --- account/wizard/wizard_general_ledger_report.py 2010-02-24 10:55:29 +0000 +++ account/wizard/wizard_general_ledger_report.py 2010-03-10 10:58:57 +0000 @@ -129,7 +129,7 @@ class wizard_report(wizard.interface): - def _get_defaults(self, cr, uid, data, context={}): + def _get_defaults(self, cr, uid, data, context=None): user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) if user.company_id: company_id = user.company_id.id === modified file 'account/wizard/wizard_journal.py' --- account/wizard/wizard_journal.py 2010-02-24 10:55:29 +0000 +++ account/wizard/wizard_journal.py 2010-03-10 10:58:57 +0000 @@ -31,7 +31,7 @@ ''' -def _period_get(self, cr, uid, datas, ctx={}): +def _period_get(self, cr, uid, datas, ctx=None): try: pool = pooler.get_pool(cr.dbname) ids = pool.get('account.period').find(cr, uid, context=ctx) === modified file 'account/wizard/wizard_partner_balance_report.py' --- account/wizard/wizard_partner_balance_report.py 2010-02-24 10:55:29 +0000 +++ account/wizard/wizard_partner_balance_report.py 2010-03-10 10:58:57 +0000 @@ -75,7 +75,7 @@ class wizard_report(wizard.interface): - def _get_defaults(self,cr,uid,data,context): + def _get_defaults(self, cr, uid, data, context): user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) if user.company_id: company_id = user.company_id.id === modified file 'account/wizard/wizard_pay_invoice.py' --- account/wizard/wizard_pay_invoice.py 2010-03-06 20:52:19 +0000 +++ account/wizard/wizard_pay_invoice.py 2010-03-10 10:58:57 +0000 @@ -144,10 +144,10 @@ 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'}, } -def _get_value_addendum(self, cr, uid, data, context={}): +def _get_value_addendum(self, cr, uid, data, context=None): return {'comment': _('Write-Off')} -def _get_period(self, cr, uid, data, context={}): +def _get_period(self, cr, uid, data, context=None): pool = pooler.get_pool(cr.dbname) ids = pool.get('account.period').find(cr, uid, context=context) period_id = False === modified file 'account/wizard/wizard_reconcile.py' --- account/wizard/wizard_reconcile.py 2010-02-24 10:55:29 +0000 +++ account/wizard/wizard_reconcile.py 2010-03-10 10:58:57 +0000 @@ -111,7 +111,7 @@ 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'}, } -def _trans_rec_addendum(self, cr, uid, data, context={}): +def _trans_rec_addendum(self, cr, uid, data, context=None): date_p = time.strftime('%Y-%m-%d') return {'date_p':date_p, 'comment': _('Write-Off')} === modified file 'account/wizard/wizard_subscription_generate.py' --- account/wizard/wizard_subscription_generate.py 2010-02-24 10:55:29 +0000 +++ account/wizard/wizard_subscription_generate.py 2010-03-10 10:58:57 +0000 @@ -38,7 +38,7 @@ } class wiz_subscription(wizard.interface): - def _action_generate(self, cr, uid, data, context={}): + def _action_generate(self, cr, uid, data, context=None): cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['form']['date'],)) ids = map(lambda x: x[0], cr.fetchall()) pooler.get_pool(cr.dbname).get('account.subscription.line').move_create(cr, uid, ids) === modified file 'account/wizard/wizard_third_party_ledger.py' (properties changed: +x to -x) === modified file 'account/wizard/wizard_validate_account_move.py' --- account/wizard/wizard_validate_account_move.py 2010-02-24 10:55:29 +0000 +++ account/wizard/wizard_validate_account_move.py 2010-03-10 10:58:57 +0000 @@ -39,7 +39,7 @@ 'period_id': {'string':'Period', 'type':'many2one', 'relation':'account.period', 'required':True, 'domain':"[('state','<>','done')]"}, } -def _validate_move(self, cr, uid, data, context={}): +def _validate_move(self, cr, uid, data, context=None): pool = pooler.get_pool(cr.dbname) move_obj = pool.get('account.move') ids_move = move_obj.search(cr,uid,[('state','=','draft'),('journal_id','=',data['form']['journal_id']),('period_id','=',data['form']['period_id'])]) @@ -61,7 +61,7 @@ } validate_account_move('account.move.validate') -def _validate_move_lines(self, cr, uid, data, context={}): +def _validate_move_lines(self, cr, uid, data, context=None): move_ids = [] pool = pooler.get_pool(cr.dbname) move_line_obj = pool.get('account.move.line') === modified file 'account/wizard/wizard_vat.py' (properties changed: +x to -x) === modified file 'account_analytic_analysis/account_analytic_analysis.py' --- account_analytic_analysis/account_analytic_analysis.py 2010-02-24 10:55:29 +0000 +++ account_analytic_analysis/account_analytic_analysis.py 2010-03-10 10:58:34 +0000 @@ -30,7 +30,7 @@ _name = "account.analytic.account" _inherit = "account.analytic.account" - def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context={}): + def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: @@ -47,7 +47,7 @@ return self._compute_currency_for_level_tree(cr, uid, ids, ids2, res, acc_set, context) - def _ca_to_invoice_calc(self, cr, uid, ids, name, arg, context={}): + def _ca_to_invoice_calc(self, cr, uid, ids, name, arg, context=None): res = {} res2 = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) @@ -94,7 +94,7 @@ res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2) return res - def _hours_qtt_non_invoiced_calc (self, cr, uid, ids, name, arg, context={}): + def _hours_qtt_non_invoiced_calc (self, cr, uid, ids, name, arg, context=None): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: @@ -119,7 +119,7 @@ res[id] = round(res.get(id, 0.0),2) return res - def _hours_quantity_calc(self, cr, uid, ids, name, arg, context={}): + def _hours_quantity_calc(self, cr, uid, ids, name, arg, context=None): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: @@ -143,7 +143,7 @@ res[id] = round(res.get(id, 0.0),2) return res - def _total_cost_calc(self, cr, uid, ids, name, arg, context={}): + def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: @@ -161,7 +161,7 @@ return self._compute_currency_for_level_tree(cr, uid, ids, ids2, res, acc_set, context) # TODO Take care of pricelist and purchase ! - def _ca_theorical_calc(self, cr, uid, ids, name, arg, context={}): + def _ca_theorical_calc(self, cr, uid, ids, name, arg, context=None): res = {} res2 = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) @@ -205,7 +205,7 @@ res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2) return res - def _last_worked_date_calc (self, cr, uid, ids, name, arg, context={}): + def _last_worked_date_calc (self, cr, uid, ids, name, arg, context=None): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: @@ -226,7 +226,7 @@ res[id] = res.get(id, '') return res - def _last_invoice_date_calc (self, cr, uid, ids, name, arg, context={}): + def _last_invoice_date_calc (self, cr, uid, ids, name, arg, context=None): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: @@ -250,7 +250,7 @@ res[id] = res.get(id, '') return res - def _last_worked_invoiced_date_calc (self, cr, uid, ids, name, arg, context={}): + def _last_worked_invoiced_date_calc (self, cr, uid, ids, name, arg, context=None): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: @@ -271,7 +271,7 @@ res[id] = res.get(id, '') return res - def _remaining_hours_calc(self, cr, uid, ids, name, arg, context={}): + def _remaining_hours_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids): if account.quantity_max != 0: @@ -282,7 +282,7 @@ res[id] = round(res.get(id, 0.0),2) return res - def _hours_qtt_invoiced_calc(self, cr, uid, ids, name, arg, context={}): + def _hours_qtt_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids): res[account.id] = account.hours_quantity - account.hours_qtt_non_invoiced @@ -292,7 +292,7 @@ res[id] = round(res.get(id, 0.0),2) return res - def _revenue_per_hour_calc(self, cr, uid, ids, name, arg, context={}): + def _revenue_per_hour_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids): if account.hours_qtt_invoiced == 0: @@ -303,7 +303,7 @@ res[id] = round(res.get(id, 0.0),2) return res - def _real_margin_rate_calc(self, cr, uid, ids, name, arg, context={}): + def _real_margin_rate_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids): if account.ca_invoiced == 0: @@ -316,7 +316,7 @@ res[id] = round(res.get(id, 0.0),2) return res - def _remaining_ca_calc(self, cr, uid, ids, name, arg, context={}): + def _remaining_ca_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids): if account.amount_max != 0: @@ -327,7 +327,7 @@ res[id] = round(res.get(id, 0.0),2) return res - def _real_margin_calc(self, cr, uid, ids, name, arg, context={}): + def _real_margin_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids): res[account.id] = account.ca_invoiced + account.total_cost @@ -335,7 +335,7 @@ res[id] = round(res.get(id, 0.0),2) return res - def _theorical_margin_calc(self, cr, uid, ids, name, arg, context={}): + def _theorical_margin_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids): res[account.id] = account.ca_theorical + account.total_cost === modified file 'account_analytic_default/account_analytic_default.py' --- account_analytic_default/account_analytic_default.py 2010-02-24 10:55:29 +0000 +++ account_analytic_default/account_analytic_default.py 2010-03-10 10:58:36 +0000 @@ -38,7 +38,7 @@ 'date_start': fields.date('Start Date'), 'date_stop': fields.date('End Date'), } - def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context={}): + def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context=None): domain = [] if product_id: domain += ['|',('product_id','=',product_id)] @@ -71,7 +71,7 @@ _inherit = 'account.invoice.line' _description = 'account invoice line' - def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, currency_id=False, context={}): + def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, currency_id=currency_id, context=context) rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context) if rec: @@ -101,7 +101,7 @@ _inherit = 'sale.order.line' # Method overridden to set the analytic account by default on criterion match - def invoice_line_create(self, cr, uid, ids, context={}): + def invoice_line_create(self, cr, uid, ids, context=None): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) sale_line_obj = self.browse(cr, uid, ids[0], context) pool_inv_line = self.pool.get('account.invoice.line') === modified file 'account_analytic_plans/account_analytic_plans.py' --- account_analytic_plans/account_analytic_plans.py 2010-02-24 10:55:29 +0000 +++ account_analytic_plans/account_analytic_plans.py 2010-03-10 10:58:35 +0000 @@ -102,7 +102,9 @@ 'account4_ids':False, 'account5_ids':False, 'account6_ids':False}) return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context) - def _default_journal(self, cr, uid, context={}): + def _default_journal(self, cr, uid, context=None): + if context is None: + context = {} if context.has_key('journal_id') and context['journal_id']: journal = self.pool.get('account.journal').browse(cr, uid, context['journal_id']) if journal.analytic_journal_id: @@ -113,7 +115,7 @@ 'plan_id': lambda *args: False, 'journal_id': _default_journal, } - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): res = [] for inst in self.browse(cr, uid, ids, context): name = inst.name or '/' @@ -193,7 +195,7 @@ return super(account_analytic_plan_instance, self).create(cr, uid, vals, context) - def write(self, cr, uid, ids, vals, context={}, check=True, update_check=True): + def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): this = self.browse(cr,uid,ids[0]) if this.plan_id and not vals.has_key('plan_id'): #this instance is a model, so we have to create a new plan instance instead of modifying it @@ -222,7 +224,7 @@ 'analytic_account_id':fields.many2one('account.analytic.account','Analytic Account', required=True), 'rate':fields.float('Rate (%)', required=True), } - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] reads = self.read(cr, uid, ids, ['analytic_account_id'], context) @@ -280,7 +282,7 @@ del(data['analytics_id']) return data - def create_analytic_lines(self, cr, uid, ids, context={}): + def create_analytic_lines(self, cr, uid, ids, context=None): super(account_move_line, self).create_analytic_lines(cr, uid, ids, context) for line in self.browse(cr, uid, ids, context): if line.analytics_id: @@ -312,7 +314,7 @@ _name = "account.invoice" _inherit="account.invoice" - def line_get_convert(self, cr, uid, x, part, date, context={}): + def line_get_convert(self, cr, uid, x, part, date, context=None): res=super(account_invoice,self).line_get_convert(cr, uid, x, part, date, context) res['analytics_id']=x.get('analytics_id',False) return res @@ -378,7 +380,7 @@ _inherit = 'sale.order.line' # Method overridden to set the analytic account by default on criterion match - def invoice_line_create(self, cr, uid, ids, context={}): + def invoice_line_create(self, cr, uid, ids, context=None): create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) if ids: sale_line_obj = self.browse(cr, uid, ids[0], context) === modified file 'account_analytic_plans/report/crossovered_analytic.py' --- account_analytic_plans/report/crossovered_analytic.py 2010-02-24 10:55:29 +0000 +++ account_analytic_plans/report/crossovered_analytic.py 2010-03-10 10:58:35 +0000 @@ -34,7 +34,7 @@ }) self.base_amount=0.00 - def find_children(self,ref_ids): + def find_children(self, ref_ids): to_return_ids = [] final_list = [] parent_list = [] @@ -52,7 +52,7 @@ final_list.extend(set_list) return final_list #to_return_ids[0] - def set_account(self,cats): + def set_account(self, cats): lst = [] category = self.pool.get('account.analytic.account').read(self.cr,self.uid,cats) for cat in category: @@ -61,7 +61,7 @@ lst.extend(self.set_account(cat['child_ids'])) return lst - def _ref_lines(self,form): + def _ref_lines(self, form): result = [] res = {} acc_id = [] @@ -110,7 +110,9 @@ result.append(res) return result - def _lines(self,form,ids={}): + def _lines(self, form, ids=None): + if ids is None: + ids = {} if not ids: ids = self.ids === modified file 'account_anglo_saxon/__init__.py' --- account_anglo_saxon/__init__.py 2010-02-24 10:55:29 +0000 +++ account_anglo_saxon/__init__.py 2010-03-10 10:58:51 +0000 @@ -22,4 +22,4 @@ import stock import purchase import invoice -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'account_anglo_saxon/__terp__.py' --- account_anglo_saxon/__terp__.py 2010-02-24 10:55:29 +0000 +++ account_anglo_saxon/__terp__.py 2010-03-10 10:58:51 +0000 @@ -37,4 +37,4 @@ "active": False, "installable": True } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'account_anglo_saxon/invoice.py' --- account_anglo_saxon/invoice.py 2010-02-24 10:55:29 +0000 +++ account_anglo_saxon/invoice.py 2010-03-10 10:58:51 +0000 @@ -173,4 +173,4 @@ return res account_invoice() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'account_anglo_saxon/purchase.py' --- account_anglo_saxon/purchase.py 2010-02-24 10:55:29 +0000 +++ account_anglo_saxon/purchase.py 2010-03-10 10:58:51 +0000 @@ -38,4 +38,4 @@ line[2].update({'account_id': a}) return line purchase_order() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'account_budget/crossovered_budget.py' --- account_budget/crossovered_budget.py 2010-02-24 10:55:29 +0000 +++ account_budget/crossovered_budget.py 2010-03-10 10:58:47 +0000 @@ -68,7 +68,7 @@ account_budget_post() class account_budget_post_dotation(osv.osv): - def _tot_planned(self, cr, uid, ids,name,args,context): + def _tot_planned(self, cr, uid, ids, name, args, context): res={} for line in self.browse(cr, uid, ids): if line.period_id: @@ -164,7 +164,7 @@ class crossovered_budget_lines(osv.osv): - def _prac_amt(self, cr, uid, ids,context={}): + def _prac_amt(self, cr, uid, ids, context=None): res = {} for line in self.browse(cr, uid, ids): acc_ids = [x.id for x in line.general_budget_id.account_ids] @@ -186,14 +186,16 @@ res[line.id] = result return res - def _prac(self, cr, uid, ids,name,args,context): + def _prac(self, cr, uid, ids, name, args, context): res={} for line in self.browse(cr, uid, ids): res[line.id]=self._prac_amt(cr,uid,[line.id],context=context)[line.id] return res - def _theo_amt(self, cr, uid, ids,context={}): + def _theo_amt(self, cr, uid, ids, context=None): + if context is None: + context = {} res = {} for line in self.browse(cr, uid, ids): today=datetime.datetime.today() @@ -223,14 +225,14 @@ res[line.id]=theo_amt return res - def _theo(self, cr, uid, ids,name,args,context): + def _theo(self, cr, uid, ids, name, args, context): res={} for line in self.browse(cr, uid, ids): res[line.id]=self._theo_amt(cr,uid,[line.id],context=context)[line.id] return res - def _perc(self, cr, uid, ids,name,args,context): + def _perc(self, cr, uid, ids, name, args, context): res = {} for line in self.browse(cr, uid, ids): if line.theoritical_amount<>0.00: === modified file 'account_budget/report/analytic_account_budget_report.py' --- account_budget/report/analytic_account_budget_report.py 2010-02-24 10:55:29 +0000 +++ account_budget/report/analytic_account_budget_report.py 2010-03-10 10:58:47 +0000 @@ -35,7 +35,7 @@ self.context=context - def funct(self,object,form,ids={}, done=None, level=1): + def funct(self, object, form, ids=None, done=None, level=1): if not ids: ids = self.ids @@ -170,7 +170,7 @@ return result - def funct_total(self,form): + def funct_total(self, form): result=[] res={} res={ === modified file 'account_budget/report/crossovered_budget_report.py' --- account_budget/report/crossovered_budget_report.py 2010-02-24 10:55:29 +0000 +++ account_budget/report/crossovered_budget_report.py 2010-03-10 10:58:47 +0000 @@ -36,7 +36,7 @@ }) self.context=context - def funct(self,object,form,ids={}, done=None, level=1): + def funct(self, object, form, ids=None, done=None, level=1): if not ids: ids = self.ids @@ -194,7 +194,7 @@ tot['perc']=float(tot['prac'] /tot['theo'])*100 return result - def funct_total(self,form): + def funct_total(self, form): result=[] res={} === modified file 'account_followup/followup_report.py' --- account_followup/followup_report.py 2010-01-12 09:18:39 +0000 +++ account_followup/followup_report.py 2010-03-10 10:58:41 +0000 @@ -21,7 +21,7 @@ from osv import fields, osv -def _code_get(self, cr, uid, context={}): +def _code_get(self, cr, uid, context=None): acc_type_obj = self.pool.get('account.account.type') ids = acc_type_obj.search(cr, uid, []) res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context) === modified file 'account_followup/report/report_followup_print.py' --- account_followup/report/report_followup_print.py 2010-02-24 10:55:29 +0000 +++ account_followup/report/report_followup_print.py 2010-03-10 10:58:41 +0000 @@ -61,7 +61,9 @@ movelines = moveline_obj.read(self.cr, self.uid, movelines) return movelines - def _get_text(self, partner, followup_id, context={}): + def _get_text(self, partner, followup_id, context=None): + if context is None: + context = {} fp_obj = pooler.get_pool(self.cr.dbname).get('account_followup.followup') fp_line = fp_obj.browse(self.cr, self.uid, followup_id).followup_line li_delay = [] === modified file 'account_followup/wizard/wizard_followup_print.py' --- account_followup/wizard/wizard_followup_print.py 2010-02-24 10:55:29 +0000 +++ account_followup/wizard/wizard_followup_print.py 2010-03-10 10:58:41 +0000 @@ -134,7 +134,7 @@ data['form']['date'], int(id),)) return {} - def _sendmail(self ,cr, uid, data, context): + def _sendmail(self, cr, uid, data, context): if data['form']['email_conf']: mail_notsent = '' msg_sent = '' === modified file 'account_invoice_layout/account_invoice_layout.py' --- account_invoice_layout/account_invoice_layout.py 2010-02-24 10:55:29 +0000 +++ account_invoice_layout/account_invoice_layout.py 2010-03-10 10:59:02 +0000 @@ -34,7 +34,7 @@ class account_invoice_line(osv.osv): - def move_line_get_item(self, cr, uid, line, context={}): + def move_line_get_item(self, cr, uid, line, context=None): if line.state != 'article': return None return super(account_invoice_line, self).move_line_get_item(cr, uid, line, context) @@ -70,7 +70,7 @@ res[field]['states'][key] = value return res - def _onchange_invoice_line_view(self, cr, uid, id, type, context={}, *args): + def _onchange_invoice_line_view(self, cr, uid, id, type, context=None, *args): if (not type): return {} === modified file 'account_invoice_layout/report/report_account_invoice_layout.py' --- account_invoice_layout/report/report_account_invoice_layout.py 2010-02-24 10:55:29 +0000 +++ account_invoice_layout/report/report_account_invoice_layout.py 2010-03-10 10:59:02 +0000 @@ -33,7 +33,7 @@ self.context = context self._node = None - def invoice_lines(self,invoice): + def invoice_lines(self, invoice): result =[] sub_total={} info=[] === modified file 'account_invoice_layout/report/special_message_invoice.py' --- account_invoice_layout/report/special_message_invoice.py 2010-02-24 10:55:29 +0000 +++ account_invoice_layout/report/special_message_invoice.py 2010-03-10 10:59:02 +0000 @@ -40,7 +40,7 @@ return msg - def invoice_lines(self,invoice): + def invoice_lines(self, invoice): result =[] sub_total={} info=[] === modified file 'account_payment/account_move_line.py' --- account_payment/account_move_line.py 2010-02-24 10:55:29 +0000 +++ account_payment/account_move_line.py 2010-03-10 10:58:45 +0000 @@ -25,7 +25,7 @@ class account_move_line(osv.osv): _inherit = "account.move.line" - def amount_to_pay(self, cr, uid, ids, name, arg={}, context={}): + def amount_to_pay(self, cr, uid, ids, name, arg=None, context=None): """ Return the amount still to pay regarding all the payemnt orders (excepting cancelled orders)""" if not ids: === modified file 'account_payment/payment.py' --- account_payment/payment.py 2010-02-24 10:55:29 +0000 +++ account_payment/payment.py 2010-03-10 10:58:45 +0000 @@ -53,7 +53,7 @@ 'type': fields.many2one('payment.type','Payment type',required=True,help='Select the Payment Type for the Payment Mode.'), } - def suitable_bank_types(self,cr,uid,payment_code=None,context={}): + def suitable_bank_types(self, cr, uid, payment_code=None, context=None): """Return the codes of the bank type that are suitable for the given payment type code""" if not payment_code: @@ -75,7 +75,7 @@ _description = 'Payment Order' _rec_name = 'reference' - def get_wizard(self,type): + def get_wizard(self, type): logger = netsvc.Logger() logger.notifyChannel("warning", netsvc.LOG_WARNING, "No wizard found for the payment type '%s'." % type) @@ -422,7 +422,7 @@ ('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'), ] - def onchange_move_line(self,cr,uid,ids,move_line_id,payment_type,date_prefered,date_planned,currency=False,company_currency=False,context=None): + def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_planned, currency=False, company_currency=False, context=None): data={} data['amount_currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False @@ -470,7 +470,7 @@ res['amount'] = company_amount return {'value': res} - def onchange_partner(self,cr,uid,ids,partner_id,payment_type,context=None): + def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None): data={} data['info_partner']=data['bank_id']=False === modified file 'account_report/account.py' --- account_report/account.py 2010-02-24 10:55:29 +0000 +++ account_report/account.py 2010-03-10 10:59:04 +0000 @@ -53,11 +53,11 @@ # ('6', 'Small'), # ] - def _amount_get(self, cr, uid, ids, field_name, arg, context={}): + def _amount_get(self, cr, uid, ids, field_name, arg, context=None): obj_fy=self.pool.get('account.fiscalyear') obj_period=self.pool.get('account.period') - def _calc_context(key,obj): + def _calc_context(key, obj): if key==0: return obj.find(cr, uid, exception=False) else: @@ -69,7 +69,7 @@ return False return key_ids[key] - def _calc_credit(code,year=0): + def _calc_credit(code, year=0): context['fiscalyear']=_calc_context(year,obj_fy) if not context['fiscalyear']: del context['fiscalyear'] @@ -77,7 +77,7 @@ acc_id = acc.search(cr, uid, [('code','in',code)]) return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0.0) - def _calc_debit(code,year=0): + def _calc_debit(code, year=0): context['fiscalyear']=_calc_context(year,obj_fy) if not context['fiscalyear']: del context['fiscalyear'] @@ -85,7 +85,7 @@ acc_id = acc.search(cr, uid, [('code','in',code)]) return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0.0) - def _calc_balance(code,year=0): + def _calc_balance(code, year=0): context['fiscalyear']=_calc_context(year,obj_fy) if not context['fiscalyear']: del context['fiscalyear'] @@ -101,7 +101,7 @@ acc_id = acc.search(cr, uid, [('code','in',code)]) return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0.0) - def _calc_tax_code(code,period=0): + def _calc_tax_code(code, period=0): context['period_id']=_calc_context(period,obj_period) if not context['period_id']: return 0.00 @@ -239,7 +239,7 @@ def init(self, cr): cr.execute('''create or replace view account_report as (select ar.id as tmp,((pr.id*100000)+ar.id) as id,ar.id as name,pr.id as period_id,pr.fiscalyear_id as fiscalyear_id from account_report_report as ar cross join account_period as pr group by ar.id,pr.id,pr.fiscalyear_id)''') - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): raise osv.except_osv(_('Error !'), _('You cannot delete an indicator history record. You may have to delete the concerned Indicator!')) account_report_history() === modified file 'account_report/report/accounting_report.py' --- account_report/report/accounting_report.py 2010-02-24 10:55:29 +0000 +++ account_report/report/accounting_report.py 2010-03-10 10:59:04 +0000 @@ -34,7 +34,7 @@ 'childs':self.process }) - def process(self,id,level=0): + def process(self, id, level=0): res = pooler.get_pool(self.cr.dbname).get('account.report.report').read(self.cr,self.uid,[id]) ret_dict={ 'name':res[0]['name'], === modified file 'account_report/report/print_indicator.py' --- account_report/report/print_indicator.py 2010-02-24 10:55:29 +0000 +++ account_report/report/print_indicator.py 2010-03-10 10:59:04 +0000 @@ -64,7 +64,7 @@ # - def lines(self,data): + def lines(self, data): res={} result=[] ind_ids=self.pool.get('account.report.report').search(self.cr,self.uid,[]) @@ -103,7 +103,7 @@ result.append(res) return result - def getarray_head(self,data,object,array_header=''): + def getarray_head(self, data, object, array_header=''): self.getgraph(data,object,intercall=True) self.header_val=[str(x) for x in self.header_val] if data['select_base'] == 'year': @@ -116,7 +116,7 @@ print "head_dict",head_dict return [head_dict] - def getarray(self,data,object,array_header=''): + def getarray(self, data, object, array_header=''): res={} result=[] self.getgraph(data,object,intercall=True) @@ -133,7 +133,7 @@ result.append(res) return result - def gettree(self,data,object): + def gettree(self, data, object): pool_history=self.pool.get('account.report.report') obj_history=pool_history.browse(self.cr,self.uid,object['id']) result=[] @@ -154,7 +154,7 @@ self.level=0 self.child_dist=0 - def draw_tree(obj_history,base_x,base_y,level=0,i=0): + def draw_tree(obj_history, base_x, base_y, level=0, i=0): self.line_y=base_y if obj_history.child_ids: if self.child_dist: @@ -211,7 +211,7 @@ return path+str(self.treecount)+'.png' - def getgraph(self,data,object,intercall=False): + def getgraph(self, data, object, intercall=False): obj_history=self.pool.get('account.report.history') if data['select_base']=='year': === modified file 'account_report/wizard/wizard_print_indicators_with_pdf.py' --- account_report/wizard/wizard_print_indicators_with_pdf.py 2010-02-24 10:55:29 +0000 +++ account_report/wizard/wizard_print_indicators_with_pdf.py 2010-03-10 10:59:04 +0000 @@ -54,7 +54,7 @@ class report_custom(report_int): - def create(self, cr, uid, ids, data, context={}): + def create(self, cr, uid, ids, data, context=None): pool = pooler.get_pool(cr.dbname) obj_indicator = pool.get('account.report.report') === modified file 'account_reporting/report/account_report_bs.py' --- account_reporting/report/account_report_bs.py 2010-02-24 10:55:29 +0000 +++ account_reporting/report/account_report_bs.py 2010-03-10 10:58:51 +0000 @@ -43,7 +43,7 @@ self.context = context - def line_total(self,line_id,ctx): + def line_total(self, line_id, ctx): _total = 0 bsline= self.pool.get('account.report.bs').browse(self.cr,self.uid,[line_id])[0] bsline_accids = bsline.account_id @@ -57,7 +57,9 @@ _total +=self.line_total(report,ctx) return _total - def lines(self, form, ids={}, done=None, level=1, object=False): + def lines(self, form, ids=None, done=None, level=1, object=False): + if ids is None: + ids = {} if object: ids = [object.id] elif not ids: === modified file 'account_voucher/__init__.py' (properties changed: +x to -x) === modified file 'account_voucher/__terp__.py' (properties changed: +x to -x) === modified file 'account_voucher/account.py' --- account_voucher/account.py 2010-02-24 10:55:29 +0000 +++ account_voucher/account.py 2010-03-10 10:58:38 +0000 @@ -31,7 +31,7 @@ class account_account(osv.osv): _inherit = "account.account" - def _get_level(self, cr, uid, ids, field_name, arg, context={}): + def _get_level(self, cr, uid, ids, field_name, arg, context=None): res={} acc_obj=self.browse(cr,uid,ids) for aobj in acc_obj: @@ -42,7 +42,7 @@ res[aobj.id] = level return res - def _get_children_and_consol(self, cr, uid, ids, context={}): + def _get_children_and_consol(self, cr, uid, ids, context=None): ids2=[] temp=[] read_data= self.read(cr, uid, ids,['id','child_id'], context) @@ -62,7 +62,7 @@ 'type1':fields.selection([('dr','Debit'),('cr','Credit'),('none','None')], 'Dr/Cr',store=True), } - def compute_total(self, cr, uid, ids, yr_st_date, yr_end_date, st_date, end_date, field_names, context={}): + def compute_total(self, cr, uid, ids, yr_st_date, yr_end_date, st_date, end_date, field_names, context=None): if not (st_date >= yr_st_date and end_date <= yr_end_date): return {} query = "l.date >= '%s' AND l.date <= '%s'" (st_date, end_date) @@ -172,7 +172,7 @@ self.pool.get('account.move.line').create(cr,uid,move_line_data) return True - def onchange_type(self, cr, uid, ids,user_type,type1): + def onchange_type(self, cr, uid, ids, user_type, type1): if not user_type: return {'value' : {}} type_obj=self.pool.get('account.account.type').browse(cr,uid,user_type) === modified file 'account_voucher/report/__init__.py' (properties changed: +x to -x) === modified file 'account_voucher/report/report_voucher.py' (properties changed: +x to -x) --- account_voucher/report/report_voucher.py 2010-02-24 10:55:29 +0000 +++ account_voucher/report/report_voucher.py 2010-03-10 10:58:38 +0000 @@ -35,7 +35,7 @@ 'get_ref' : self._get_ref }) - def convert(self,amount, cur): + def convert(self, amount, cur): amt_en = amount_to_text_en.amount_to_text(amount,'en',cur); return amt_en === modified file 'account_voucher/report/report_voucher_amount.py' (properties changed: +x to -x) --- account_voucher/report/report_voucher_amount.py 2010-02-24 10:55:29 +0000 +++ account_voucher/report/report_voucher_amount.py 2010-03-10 10:58:38 +0000 @@ -32,7 +32,7 @@ 'convert':self.convert }) - def convert(self,amount, cur): + def convert(self, amount, cur): amt_en = amount_to_text_en.amount_to_text(amount,'en',cur); return amt_en @@ -42,4 +42,4 @@ 'account.voucher', 'addons/account_voucher/report/report_voucher_amount.rml', parser=report_voucher_amount,header=False -) \ No newline at end of file +) === modified file 'account_voucher/report/rml_parse.py' (properties changed: +x to -x) --- account_voucher/report/rml_parse.py 2010-02-24 10:55:29 +0000 +++ account_voucher/report/rml_parse.py 2010-03-10 10:58:38 +0000 @@ -40,7 +40,7 @@ 'explode_name' : self._explode_name, }) - def comma_me(self,amount): + def comma_me(self, amount): #print "#" + str(amount) + "#" if not amount: amount = 0.0 @@ -67,13 +67,13 @@ def _strip_name(self, name, maxlen=50): return self._ellipsis(name, maxlen, '...') - def _get_and_change_date_format_for_swiss (self,date_to_format): + def _get_and_change_date_format_for_swiss (self, date_to_format): date_formatted='' if date_to_format: date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') return date_formatted - def _explode_name(self,chaine,length): + def _explode_name(self, chaine, length): # We will test if the size is less then account full_string = '' if (len(str(chaine)) <= length): @@ -93,7 +93,7 @@ return full_string - def makeAscii(self,str): + def makeAscii(self, str): try: Stringer = str.encode("utf-8") except UnicodeDecodeError: @@ -108,7 +108,7 @@ return Stringer return Stringer - def explode_this(self,chaine,length): + def explode_this(self, chaine, length): #chaine = self.repair_string(chaine) chaine = rstrip(chaine) ast = list(chaine) @@ -119,7 +119,7 @@ chaine = str("".join(ast)) return chaine - def repair_string(self,chaine): + def repair_string(self, chaine): ast = list(chaine) UnicodeAst = [] _previouslyfound = False @@ -140,7 +140,7 @@ i += i + 1 return "".join(UnicodeAst) - def ReencodeAscii(self,str): + def ReencodeAscii(self, str): print sys.stdin.encoding try: Stringer = str.decode("ascii") @@ -162,4 +162,4 @@ rml_head = rml_head.replace('',''' [[company.logo]] ''') return True -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'account_voucher/voucher.py' (properties changed: +x to -x) --- account_voucher/voucher.py 2010-02-24 10:55:29 +0000 +++ account_voucher/voucher.py 2010-03-10 10:58:38 +0000 @@ -44,7 +44,9 @@ else: return False - def _get_type(self, cr, uid, context={}): + def _get_type(self, cr, uid, context=None): + if context is None: + context = {} type = context.get('type', 'rec_voucher') return type @@ -166,7 +168,7 @@ account_id = journal.browse(cr, uid, journal_id).default_credit_account_id return {'value':{'account_id':account_id.id}} - def open_voucher(self, cr, uid, ids, context={}): + def open_voucher(self, cr, uid, ids, context=None): obj=self.pool.get('account.voucher').browse(cr,uid,ids) total=0 for i in obj[0].payment_ids: @@ -178,13 +180,13 @@ raise osv.except_osv('Invalid action !', 'You can not post to Pro-Forma a voucher with Total amount = 0') return True - def proforma_voucher(self, cr, uid, ids, context={}): + def proforma_voucher(self, cr, uid, ids, context=None): self.action_number(cr, uid, ids) self.action_move_line_create(cr, uid, ids) self.write(cr, uid, ids, {'state':'posted'}) return True - def cancel_voucher(self,cr,uid,ids,context={}): + def cancel_voucher(self, cr, uid, ids, context=None): self.action_cancel(cr, uid, ids) self.write(cr, uid, ids, {'state':'cancel'}) return True @@ -193,7 +195,7 @@ self.write(cr, uid, ids, {'state':'draft'}) return True - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): vouchers = self.read(cr, uid, ids, ['state']) unlink_ids = [] for t in vouchers: @@ -385,7 +387,7 @@ return True - def line_get_convert(self, cr, uid, x, date, context={}): + def line_get_convert(self, cr, uid, x, date, context=None): return { 'date':date, @@ -430,7 +432,7 @@ (ref, move_id)) return True - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] types = { @@ -498,7 +500,7 @@ 'type': lambda *a: 'cr' } - def move_line_get(self, cr, uid, voucher_id, context={}): + def move_line_get(self, cr, uid, voucher_id, context=None): res = [] cur_obj = self.pool.get('res.currency') @@ -510,7 +512,7 @@ res.append(self.move_line_get_item(cr, uid, line, context)) return res - def onchange_partner(self, cr, uid, ids, partner_id, ttype ,type1): + def onchange_partner(self, cr, uid, ids, partner_id, ttype, type1): if not partner_id: return {'value' : {'account_id' : False, 'type' : False ,'amount':False}} obj = self.pool.get('res.partner') @@ -536,7 +538,7 @@ 'value' : {'account_id' : account_id.id, 'type' : ttype, 'amount':balance} } - def onchange_amount(self, cr, uid, ids,partner_id,amount, type,type1): + def onchange_amount(self, cr, uid, ids, partner_id, amount, type, type1): if not amount: return {'value' : {}} if partner_id: @@ -610,7 +612,7 @@ 'value' : { 'type' : type , 'amount':amount} } - def onchange_type(self, cr, uid, ids,partner_id,amount,type,type1): + def onchange_type(self, cr, uid, ids, partner_id, amount, type, type1): if partner_id: obj = self.pool.get('res.partner') @@ -683,7 +685,7 @@ 'value' : {'type' : type , 'amount':total} } - def move_line_get_item(self, cr, uid, line, context={}): + def move_line_get_item(self, cr, uid, line, context=None): return { 'type':'src', 'name': line.name[:64], === modified file 'analytic/project.py' --- analytic/project.py 2010-02-24 10:55:29 +0000 +++ analytic/project.py 2010-03-10 10:58:50 +0000 @@ -33,7 +33,7 @@ _name = 'account.analytic.account' _description = 'Analytic Accounts' - def _compute_currency_for_level_tree(self, cr, uid, ids, ids2, res, acc_set, context={}): + def _compute_currency_for_level_tree(self, cr, uid, ids, ids2, res, acc_set, context=None): # Handle multi-currency on each level of analytic account # This is a refactoring of _balance_calc computation cr.execute("SELECT a.id, r.currency_id FROM account_analytic_account a INNER JOIN res_company r ON (a.company_id = r.id) where a.id in (%s)" % acc_set) @@ -59,7 +59,9 @@ return dict([(i, res[i]) for i in ids ]) - def _credit_calc(self, cr, uid, ids, name, arg, context={}): + def _credit_calc(self, cr, uid, ids, name, arg, context=None): + if context is None: + context = {} res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) acc_set = ",".join(map(str, ids2)) @@ -99,7 +101,9 @@ r= dict(cr.fetchall()) return self._compute_currency_for_level_tree(cr, uid, ids, ids2, r, acc_set, context) - def _balance_calc(self, cr, uid, ids, name, arg, context={}): + def _balance_calc(self, cr, uid, ids, name, arg, context=None): + if context is None: + context = {} res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) acc_set = ",".join(map(str, ids2)) @@ -122,7 +126,9 @@ return self._compute_currency_for_level_tree(cr, uid, ids, ids2, res, acc_set, context) - def _quantity_calc(self, cr, uid, ids, name, arg, context={}): + def _quantity_calc(self, cr, uid, ids, name, arg, context=None): + if context is None: + context = {} #XXX must convert into one uom res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) @@ -157,7 +163,7 @@ res[id] += res.get(child, 0.0) return dict([(i, res[i]) for i in ids]) - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name','parent_id'], context) @@ -173,13 +179,13 @@ res = self.name_get(cr, uid, ids) return dict(res) - def _get_company_currency(self, cr, uid, ids, field_name, arg, context={}): + def _get_company_currency(self, cr, uid, ids, field_name, arg, context=None): result = {} for rec in self.browse(cr, uid, ids, context): result[rec.id] = (rec.company_id.currency_id.id,rec.company_id.currency_id.code) or False return result - def _get_account_currency(self, cr, uid, ids, field_name, arg, context={}): + def _get_account_currency(self, cr, uid, ids, field_name, arg, context=None): result=self._get_company_currency(cr, uid, ids, field_name, arg, context={}) return result @@ -214,7 +220,7 @@ 'currency_id': fields.function(_get_account_currency, method=True, type='many2one', relation='res.currency', string='Account currency', store=True), } - def _default_company(self, cr, uid, context={}): + def _default_company(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id @@ -243,7 +249,7 @@ vals['code'] = self.pool.get('ir.sequence').get(cr, uid, 'account.analytic.account') return super(account_analytic_account, self).create(cr, uid, vals, context=context) - def copy(self, cr, uid, id, default=None, context={}): + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} default['code'] = False === modified file 'analytic_journal_billing_rate/analytic_journal_billing_rate.py' --- analytic_journal_billing_rate/analytic_journal_billing_rate.py 2010-02-24 10:55:29 +0000 +++ analytic_journal_billing_rate/analytic_journal_billing_rate.py 2010-03-10 10:59:04 +0000 @@ -74,7 +74,7 @@ return res - def on_change_journal_id(self, cr, uid, ids,journal_id, account_id): + def on_change_journal_id(self, cr, uid, ids, journal_id, account_id): res = {} if not (journal_id and account_id): return res === modified file 'analytic_user_function/analytic_user_function.py' --- analytic_user_function/analytic_user_function.py 2010-02-24 10:55:29 +0000 +++ analytic_user_function/analytic_user_function.py 2010-03-10 10:58:42 +0000 @@ -53,7 +53,7 @@ # Look in account, if no value for the user => look in parent until there is no more parent to look # Take the first found... if nothing found => return False - def _get_related_user_account_recursiv(self,cr,uid,user_id,account_id): + def _get_related_user_account_recursiv(self, cr, uid, user_id, account_id): temp=self.pool.get('analytic_user_funct_grid').search(cr, uid, [('user_id', '=', user_id),('account_id', '=', account_id) ]) account=self.pool.get('account.analytic.account').browse(cr,uid,account_id) @@ -108,7 +108,7 @@ res ['value']['general_account_id']= a return res - def on_change_user_id(self, cr, uid, ids,user_id, account_id, unit_amount=0): + def on_change_user_id(self, cr, uid, ids, user_id, account_id, unit_amount=0): res = {} if not (user_id): #avoid a useless call to super === modified file 'auction/auction.py' --- auction/auction.py 2010-03-08 17:20:16 +0000 +++ auction/auction.py 2010-03-10 10:58:54 +0000 @@ -45,7 +45,7 @@ class auction_dates(osv.osv): _name = "auction.dates" - def _adjudication_get(self, cr, uid, ids, prop, unknow_none,unknow_dict): + def _adjudication_get(self, cr, uid, ids, prop, unknow_none, unknow_dict): tmp={} for id in ids: tmp[id]=0.0 @@ -55,7 +55,7 @@ tmp[id]=sum[0] return tmp - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name', 'auction1'], context) @@ -221,7 +221,7 @@ } auction_lot_category() -def _type_get(self, cr, uid,ids): +def _type_get(self, cr, uid, ids): cr.execute('select name, name from auction_lot_category order by name') return cr.fetchall() @@ -241,18 +241,18 @@ _order = "obj_num,lot_num,id" _description="Object" - def button_not_bought(self,cr,uid,ids,*a): + def button_not_bought(self, cr, uid, ids, *a): return self.write(cr,uid,ids, {'state':'unsold'}) def button_taken_away(self,cr,uid,ids,*a): return self.write(cr,uid,ids, {'state':'taken_away'}) - def button_unpaid(self,cr,uid,ids,*a): - return self.write(cr,uid,ids, {'state':'draft'}) - - def button_draft(self,cr,uid,ids,*a): - return self.write(cr,uid,ids, {'state':'draft'}) - - def button_bought(self,cr,uid,ids,*a): + def button_unpaid(self, cr, uid, ids, *a): + return self.write(cr,uid,ids, {'state':'draft'}) + + def button_draft(self, cr, uid, ids, *a): + return self.write(cr,uid,ids, {'state':'draft'}) + + def button_bought(self, cr, uid, ids, *a): return self.write(cr,uid,ids, {'state':'sold'}) def _buyerprice(self, cr, uid, ids, name, args, context): @@ -278,7 +278,7 @@ return res - def _sellerprice(self, cr, uid, ids,*a): + def _sellerprice(self, cr, uid, ids, *a): res={} lots=self.pool.get('auction.lots').browse(cr,uid,ids) pt_tax=self.pool.get('account.tax') @@ -334,7 +334,7 @@ return {'value': {'obj_price': 0}} return {} - def _costs(self,cr,uid,ids,context,*a): + def _costs(self, cr, uid, ids, context, *a): """ costs: Total credit of analytic account / # objects sold during this auction @@ -389,7 +389,7 @@ res[auction_data['id']] = total_tax return res - def _is_paid_vnd(self,cr,uid,ids,*a): + def _is_paid_vnd(self, cr, uid, ids, *a): res = {} lots=self.browse(cr,uid,ids) for lot in lots: @@ -472,13 +472,13 @@ ] - def name_get(self, cr, user, ids, context={}): + def name_get(self, cr, user, ids, context=None): if not len(ids): return [] result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name','obj_num'])] return result - def name_search(self, cr, user, name, args=[], operator='ilike', context={}): + def name_search(self, cr, user, name, args=None, operator='ilike', context=None): try: ids = self.search(cr, user, [('obj_num','=',int(name))]+ args) except: @@ -607,7 +607,7 @@ return self._sum_taxes_by_type_and_id(costs) # sum remise limite net and ristourne - def compute_seller_costs_summed(self, cr, uid, ids): #ach_pay_id + def compute_seller_costs_summed(self, cr, uid, ids): taxes = self.compute_seller_costs(cr, uid, ids) taxes_summed = {} for tax in taxes: @@ -628,7 +628,7 @@ taxes_summed[key] = tax return taxes_summed.values() - def buyer_proforma(self,cr,uid,ids,context): + def buyer_proforma(self, cr, uid, ids, context): invoices = {} inv_ref=self.pool.get('account.invoice') # acc_receiv=self.pool.get('account.account').search([cr,uid,[('code','=','4010')]]) @@ -687,7 +687,7 @@ # creates the transactions between the auction company and the seller # this is done by creating a new in_invoice for each - def seller_trans_create(self,cr, uid,ids,context): + def seller_trans_create(self, cr, uid, ids, context): """ Create a seller invoice for each bord_vnd_id, for selected ids. """ @@ -744,7 +744,7 @@ wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_open', cr) return invoices.values() - def lots_invoice(self, cr, uid, ids, context,invoice_number=False): + def lots_invoice(self, cr, uid, ids, context, invoice_number=False): """(buyer invoice Create an invoice for selected lots (IDS) to BUYER_ID. Set created invoice to the ACTION state. === modified file 'auction/barcode/code39.py' --- auction/barcode/code39.py 2010-02-24 10:55:29 +0000 +++ auction/barcode/code39.py 2010-03-10 10:58:54 +0000 @@ -114,7 +114,7 @@ class _Code39Base(Barcode): - def __init__(self, value = "", **args): + def __init__(self, value="", **args): self.xdim = inch * 0.0075 self.lquiet = None self.rquiet = None === modified file 'auction/barcode/common.py' --- auction/barcode/common.py 2010-02-24 10:55:29 +0000 +++ auction/barcode/common.py 2010-03-10 10:58:54 +0000 @@ -39,7 +39,7 @@ """Abstract Base for barcodes. Includes implementations of some methods suitable for the more primitive barcode types""" - def __init__(self, value = ''): + def __init__(self, value=''): self.value = value if not hasattr(self, 'gap'): === modified file 'auction/report/artists_lots.py' --- auction/report/artists_lots.py 2010-02-24 10:55:29 +0000 +++ auction/report/artists_lots.py 2010-03-10 10:58:53 +0000 @@ -26,7 +26,7 @@ def __init__(self, name): report_int.__init__(self, name) - def create(self,cr, uid, ids, datas, context): + def create(self, cr, uid, ids, datas, context): service = netsvc.LocalService("object_proxy") lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['artist_id']) artists = [] === modified file 'auction/report/auction_invoice.py' --- auction/report/auction_invoice.py 2010-02-24 10:55:29 +0000 +++ auction/report/auction_invoice.py 2010-03-10 10:58:53 +0000 @@ -26,7 +26,7 @@ def __init__(self, name): report_int.__init__(self, name) - def create(self,cr, uid, ids, datas, context): + def create(self, cr, uid, ids, datas, context): service = netsvc.LocalService("object_proxy") lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['ach_inv_id']) === modified file 'auction/report/auction_total_rml.py' --- auction/report/auction_total_rml.py 2010-02-24 10:55:29 +0000 +++ auction/report/auction_total_rml.py 2010-03-10 10:58:53 +0000 @@ -63,7 +63,7 @@ return auct_dat - def sum_taxes(self,auction_id): + def sum_taxes(self, auction_id): self.cr.execute("select count(1) from auction_lots where id =ANY(%s) and auction_id=%s group by auction_id ", (self.total_obj,auction_id,)) res = self.cr.fetchone() return res[0] @@ -103,17 +103,17 @@ res = self.cr.fetchone() return str(res[0]) or 0.0 - def sum_credit(self,auction_id): + def sum_credit(self, auction_id): self.cr.execute("select sum(buyer_price) from auction_lots where id =ANY(%s) and auction_id=%s", (self.total_obj,auction_id,)) res = self.cr.fetchone() return str(res[0]) - def sum_debit_buyer(self,auction_id): + def sum_debit_buyer(self, auction_id): self.cr.execute("select sum(buyer_price) from auction_lots where id =ANY(%s) and auction_id=%s", (self.total_obj,auction_id,)) res = self.cr.fetchone() return str(res[0] or 0) - def sum_debit(self,object_id): + def sum_debit(self, object_id): self.cr.execute("select sum(seller_price) from auction_lots where auction_id=%s", (object_id,)) res = self.cr.fetchone() return str(res[0] or 0) === modified file 'auction/report/buyer_form_report.py' --- auction/report/buyer_form_report.py 2010-02-24 10:55:29 +0000 +++ auction/report/buyer_form_report.py 2010-03-10 10:58:53 +0000 @@ -64,7 +64,7 @@ return ret_dict.values() - def grand_buyer_total(self,o): + def grand_buyer_total(self, o): grand_total = 0 for oo in o: grand_total =grand_total + oo['obj_price'] +self.sum_taxes(oo) === modified file 'auction/report/buyer_list.py' --- auction/report/buyer_list.py 2010-02-24 10:55:29 +0000 +++ auction/report/buyer_list.py 2010-03-10 10:58:53 +0000 @@ -43,7 +43,7 @@ 'sum_lots':self.sum_lots }) - def lines_lots_from_auction(self,objects): + def lines_lots_from_auction(self, objects): auc_lot_ids = [] for lot_id in objects: @@ -64,7 +64,7 @@ auct_dat.append(auc_dates_fields) return auct_dat - def lines_lots_auct_lot(self,obj): + def lines_lots_auct_lot(self, obj): auc_lot_ids = [] auc_date_ids = self.pool.get('auction.dates').search(self.cr,self.uid,([('name','like',obj['name'])])) === modified file 'auction/report/catalog2.py' --- auction/report/catalog2.py 2010-02-24 10:55:29 +0000 +++ auction/report/catalog2.py 2010-03-10 10:58:53 +0000 @@ -69,7 +69,7 @@ temp=self.post_process_xml_data(cr, uid, xml, context) return temp - def catalog_xml(self,cr,uid,ids,data,context,cwid="0"): + def catalog_xml(self, cr, uid, ids, data, context, cwid="0"): impl = minidom.getDOMImplementation() doc = impl.createDocument(None, "report", None) === modified file 'auction/report/huissier.py' --- auction/report/huissier.py 2010-02-24 10:55:29 +0000 +++ auction/report/huissier.py 2010-03-10 10:58:53 +0000 @@ -31,7 +31,7 @@ def __init__(self, name, table, tmpl, xsl): report_rml.__init__(self, name, table, tmpl, xsl) - def create_xml(self,cr, uid, ids, datas, context={}): + def create_xml(self, cr, uid, ids, datas, context=None): pool= pooler.get_pool(cr.dbname) lots = pool.get('auction.lots').browse(cr, uid, ids) auction = lots[0].auction_id === modified file 'auction/report/photo_shadow.py' --- auction/report/photo_shadow.py 2010-02-24 10:55:29 +0000 +++ auction/report/photo_shadow.py 2010-03-10 10:58:53 +0000 @@ -19,7 +19,7 @@ # ############################################################################## -def convert_catalog(from_file, to_file, size=220) : +def convert_catalog(from_file, to_file, size=220): return __convert(from_file, to_file, size) def convert(from_file, to_file): === modified file 'auction/report/seller_address.py' --- auction/report/seller_address.py 2010-02-24 10:55:29 +0000 +++ auction/report/seller_address.py 2010-03-10 10:58:53 +0000 @@ -26,7 +26,7 @@ def __init__(self, name): report_int.__init__(self, name) - def create(self,cr, uid, ids, datas, context): + def create(self, cr, uid, ids, datas, context): service = netsvc.LocalService("object_proxy") lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['bord_vnd_id']) === modified file 'auction/report/seller_form_report.py' --- auction/report/seller_form_report.py 2010-02-24 10:55:29 +0000 +++ auction/report/seller_form_report.py 2010-03-10 10:58:53 +0000 @@ -71,7 +71,7 @@ lots.append(object) # buyer_ids=self.pool.get(auction.lots).read(cr,uid,lot) return ret_dict.values() - def grand_seller_total(self,o): + def grand_seller_total(self, o): grand_total = 0 for oo in o: grand_total =grand_total + oo['obj_price']+ self.sum_taxes(oo) === modified file 'auction/report/total.py' --- auction/report/total.py 2010-02-24 10:55:29 +0000 +++ auction/report/total.py 2010-03-10 10:58:53 +0000 @@ -35,7 +35,7 @@ def __init__(self, name, table, tmpl, xsl): report_rml.__init__(self, name, table, tmpl, xsl) - def create_xml(self,cr, uid, ids, datas, context={}): + def create_xml(self, cr, uid, ids, datas, context=None): service = netsvc.LocalService("object_proxy") # start_time = time.clock() === modified file 'auction/wizard/auction_wizard_able_taken.py' --- auction/wizard/auction_wizard_able_taken.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/auction_wizard_able_taken.py 2010-03-10 10:58:54 +0000 @@ -33,7 +33,7 @@ # 'confirm_en': {'string':'Catalog Number', 'type':'integer'}, } -def _confirm_able(self,cr,uid,data,context={}): +def _confirm_able(self, cr, uid, data, context=None): res={} pool = pooler.get_pool(cr.dbname) pool.get('auction.lots').write(cr,uid,data['ids'],{'ach_emp':True}) === modified file 'auction/wizard/auction_wizard_enable_taken.py' --- auction/wizard/auction_wizard_enable_taken.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/auction_wizard_enable_taken.py 2010-03-10 10:58:54 +0000 @@ -35,7 +35,7 @@ 'confirm_en': {'string':'Catalog Number', 'type':'integer'}, } -def _confirm_enable(self,cr,uid,data,context={}): +def _confirm_enable(self, cr, uid, data, context=None): pool = pooler.get_pool(cr.dbname) pool.get('auction.lots').write(cr,uid,data['ids'],{'ach_emp':False}) return {} === modified file 'auction/wizard/wizard_aie_send.py' --- auction/wizard/wizard_aie_send.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_aie_send.py 2010-03-10 10:58:54 +0000 @@ -140,7 +140,7 @@ return post_multipart('auction-in-europe.com', "/bin/photo.cgi", (('uname',uname),('ref',ref),('passwd',passwd),('did',did)),(('file',photo_name,photo_data),)) -def _photos_send(cr,uid, uname, passwd, did, ids): +def _photos_send(cr, uid, uname, passwd, did, ids): for (ref,id) in ids: service = netsvc.LocalService("object_proxy") # ids_attach = service.execute(db_name,uid, 'ir.attachment', 'search', [('res_model','=','auction.lots'), ('res_id', '=',id)]) @@ -150,7 +150,7 @@ fname = datas[0]['name'] _photo_bin_send(uname, passwd, ref, did, fname, bin) -def _get_dates(self,cr,uid, datas,context={}): +def _get_dates(self, cr, uid, datas, context=None): global send_fields import httplib conn = httplib.HTTPConnection('www.auction-in-europe.com') @@ -164,7 +164,7 @@ raise wizard.except_wizard(_('Error'), _("Connection to WWW.Auction-in-Europe.com failed !")) return {'objects':len(datas['ids'])} -def _send(self,db_name,uid, datas,context={}): +def _send(self, db_name, uid, datas, context=None): import pickle, thread, sql_db #cr = pooler.get_db(cr.dbname).cursor() === modified file 'auction/wizard/wizard_aie_send_result.py' --- auction/wizard/wizard_aie_send_result.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_aie_send_result.py 2010-03-10 10:58:54 +0000 @@ -92,7 +92,7 @@ return val 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, datas, context): +def _get_dates(self, cr, uid, datas, context): global send_fields import httplib conn = httplib.HTTPConnection('www.auction-in-europe.com') @@ -107,7 +107,7 @@ _("Connection to WWW.Auction-in-Europe.com failed !")) return {'objects':len(datas['ids'])} -def _send(self,cr,uid, datas, context): +def _send(self, cr, uid, datas, context): import pickle service = netsvc.LocalService("object_proxy") lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', datas['ids'], ['obj_num','obj_price']) === modified file 'auction/wizard/wizard_auction_invoice_buyer.py' --- auction/wizard/wizard_auction_invoice_buyer.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_auction_invoice_buyer.py 2010-03-10 10:58:54 +0000 @@ -41,7 +41,7 @@ } -def _values(self,cr,uid, datas,context={}): +def _values(self, cr, uid, datas, context=None): pool = pooler.get_pool(cr.dbname) lots= pool.get('auction.lots').browse(cr,uid,datas['ids']) # price = 0.0 === modified file 'auction/wizard/wizard_auction_journal.py' --- auction/wizard/wizard_auction_journal.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_auction_journal.py 2010-03-10 10:58:54 +0000 @@ -38,7 +38,7 @@ 'number': {'string':'Invoice Number', 'type':'integer'}, } -def _values(self,cr,uid, datas,context={}): +def _values(self, cr, uid, datas, context=None): lots= pooler.get_pool(cr.dbname).get('auction.lots').browse(cr,uid,datas['ids']) # service = netsvc.LocalService("object_proxy") # lots = service.execute(cr,uid, 'auction.lots', 'read', datas['ids']) === modified file 'auction/wizard/wizard_lot_date_move.py' --- auction/wizard/wizard_lot_date_move.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_lot_date_move.py 2010-03-10 10:58:54 +0000 @@ -45,7 +45,7 @@ # cr.commit() # cr.close() # return {} -def _top(self,cr,uid,datas,context={}): +def _top(self, cr, uid, datas, context=None): refs = pooler.get_pool(cr.dbname).get('auction.lots') rec_ids = refs.browse(cr,uid,datas['ids']) for rec in rec_ids: === modified file 'auction/wizard/wizard_lots_buyer_map.py' --- auction/wizard/wizard_lots_buyer_map.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_lots_buyer_map.py 2010-03-10 10:58:54 +0000 @@ -52,7 +52,7 @@ return 'check' return 'done' -def _start(self,cr,uid,datas,context): +def _start(self, cr, uid, datas, context): pool = pooler.get_pool(cr.dbname) for rec in pool.get('auction.lots').browse(cr,uid,datas['ids'],context): if (len(datas['ids'])==1) and (not rec.ach_uid and not rec.ach_login): @@ -65,7 +65,7 @@ return {'ach_login': rec.ach_login} return {} -def _buyer_map_set(self,cr, uid, datas,context): +def _buyer_map_set(self, cr, uid, datas, context): pool = pooler.get_pool(cr.dbname) recs=pool.get('auction.lots').browse(cr,uid,datas['ids'],context) for rec in recs: === modified file 'auction/wizard/wizard_lots_cancel.py' --- auction/wizard/wizard_lots_cancel.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_lots_cancel.py 2010-03-10 10:58:54 +0000 @@ -64,7 +64,7 @@ # return {} # -def _cancel(self,cr,uid,data,context): +def _cancel(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) lot = pool.get('auction.lots').browse(cr,uid,data['id'],context) if lot.ach_inv_id: === modified file 'auction/wizard/wizard_lots_invoice.py' --- auction/wizard/wizard_lots_invoice.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_lots_invoice.py 2010-03-10 10:58:54 +0000 @@ -45,7 +45,7 @@ #'tax_applied':{'string':'Tax Applied', 'type':'float', 'readonly':True}, } -def _get_value(self,cr,uid, datas,context={}): +def _get_value(self, cr, uid, datas, context=None): service = netsvc.LocalService("object_proxy") lots = service.execute(cr,uid, 'auction.lots', 'read', datas['ids']) auction = service.execute(cr,uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0] === modified file 'auction/wizard/wizard_lots_numerotate.py' --- auction/wizard/wizard_lots_numerotate.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_lots_numerotate.py 2010-03-10 10:58:54 +0000 @@ -77,7 +77,7 @@ 'obj_num': {'string':'Catalog Number', 'type':'integer', 'required':True} } -def _read_record(self,cr,uid,datas,context={}): +def _read_record(self, cr, uid, datas, context=None): form = datas['form'] res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))]) found = [r for r in res if r in datas['ids']] @@ -86,7 +86,7 @@ datas = pooler.get_pool(cr.dbname).get('auction.lots').read(cr,uid,found,['obj_num', 'name', 'lot_est1', 'lot_est2', 'obj_desc']) return datas[0] -def _test_exist(self,cr,uid,datas,context={}): +def _test_exist(self, cr, uid, datas, context=None): form = datas['form'] res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))]) found = [r for r in res if r in datas['ids']] @@ -94,7 +94,7 @@ return 'not_exist' return 'search' -def _numerotate(self,cr,uid,datas,context={}): +def _numerotate(self, cr, uid, datas, context=None): form = datas['form'] res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))]) found = [r for r in res if r in datas['ids']] @@ -103,7 +103,7 @@ pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,found,{'obj_num':int(form['obj_num'])} ) return {'lot_inv':'', 'lot_num':''} -def _numerotate_cont(self,cr,uid,datas,context={}): +def _numerotate_cont(self, cr, uid, datas, context=None): nbr = int(datas['form']['number']) refs = pooler.get_pool(cr.dbname).get('auction.lots') rec_ids = refs.browse(cr,uid,datas['ids']) === modified file 'auction/wizard/wizard_pay.py' --- auction/wizard/wizard_pay.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_pay.py 2010-03-10 10:58:54 +0000 @@ -38,7 +38,7 @@ ''' -def _start(self,cr,uid,data,context): +def _start(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) rec=pool.get('auction.lots').browse(cr,uid,data['ids'],context) amount1=0.0 === modified file 'auction/wizard/wizard_transfer_unsold_object.py' --- auction/wizard/wizard_transfer_unsold_object.py 2010-02-24 10:55:29 +0000 +++ auction/wizard/wizard_transfer_unsold_object.py 2010-03-10 10:58:54 +0000 @@ -43,7 +43,7 @@ 'auction_id_to': {'string':'To Auction Date', 'type':'many2one', 'required':True, 'relation':'auction.dates'}, } -def _start(self,cr,uid,data,context): +def _start(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) rec=pool.get('auction.lots').browse(cr,uid,data['id'],context) auction_from= rec and rec.auction_id.id or False === modified file 'audittrail/audittrail.py' --- audittrail/audittrail.py 2010-02-24 10:55:29 +0000 +++ audittrail/audittrail.py 2010-03-10 10:58:46 +0000 @@ -132,7 +132,7 @@ audittrail_log_line() class audittrail_objects_proxy(osv_pool): - def get_value_text(self, cr, uid, field_name, values, object, context={}): + def get_value_text(self, cr, uid, field_name, values, object, context=None): pool = pooler.get_pool(cr.dbname) obj=pool.get(object.model) obj_ids= pool.get('ir.model').search(cr, uid, [('model', '=', object.model)]) @@ -169,7 +169,9 @@ return value return values - def create_log_line(self, cr, uid, id, object, lines=[]): + def create_log_line(self, cr, uid, id, object, lines=None): + if lines is None: + lines = [] pool = pooler.get_pool(cr.dbname) obj=pool.get(object.model) obj_ids= pool.get('ir.model').search(cr, uid, [('model', '=', object.model)]) === modified file 'base_action_rule/base_action_rule.py' --- base_action_rule/base_action_rule.py 2010-03-03 05:57:06 +0000 +++ base_action_rule/base_action_rule.py 2010-03-10 10:58:38 +0000 @@ -63,7 +63,7 @@ } return self.format_body(body % data) - def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from',False), context={}): + def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from',False), context=None): body = self.format_mail(obj, body) if not emailfrom: if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.address_id and obj.user_id.address_id.email: @@ -78,7 +78,9 @@ return tools.email_send(emailfrom, emails, name, body, reply_to=reply_to, openobject_id=str(obj.id)) - def do_check(self, cr, uid, action, obj, context={}): + def do_check(self, cr, uid, action, obj, context=None): + if context is None: + context = {} ok = True if hasattr(obj, 'user_id'): ok = ok and (not action.trg_user_id.id or action.trg_user_id.id==obj.user_id.id) @@ -112,7 +114,9 @@ ok = ok and regex_n return ok - def do_action(self, cr, uid, action, model_obj, obj, context={}): + def do_action(self, cr, uid, action, model_obj, obj, context=None): + if context is None: + context = {} if action.server_action_id: context.update({'active_id':obj.id,'active_ids':[obj.id]}) self.pool.get('ir.actions.server').run(cr, uid, [action.server_action_id.id], context) @@ -157,7 +161,7 @@ self.email_send(cr, uid, obj, emails, action.act_mail_body) return True - def _action(self, cr, uid, ids, objects, scrit=None, context={}): + def _action(self, cr, uid, ids, objects, scrit=None, context=None): if not scrit: scrit = [] rule_line_obj = self.pool.get('base.action.rule.line') @@ -221,12 +225,12 @@ _name = 'base.action.rule.line' _description = 'Action Rule Lines' - def _state_get(self, cr, uid, context={}): + def _state_get(self, cr, uid, context=None): return self.state_get(cr, uid, context=context) def _priority_get(self, cr, uid, context={}): return self.priority_get(cr, uid, context=context) - def state_get(self, cr, uid, context={}): + def state_get(self, cr, uid, context=None): return [('','')] def priority_get(self, cr, uid, context={}): return [('','')] === modified file 'base_calendar/base_calendar.py' --- base_calendar/base_calendar.py 2010-03-08 07:05:23 +0000 +++ base_calendar/base_calendar.py 2010-03-10 10:59:01 +0000 @@ -72,7 +72,7 @@ return real_id -def _links_get(self, cr, uid, context={}): +def _links_get(self, cr, uid, context=None): obj = self.pool.get('res.request.link') ids = obj.search(cr, uid, []) res = obj.read(cr, uid, ids, ['object', 'name'], context) @@ -206,7 +206,9 @@ 'type': lambda *x: 'internal' } - def do_invite(self, cr, uid, ids, context={}): + def do_invite(self, cr, uid, ids, context=None): + if context is None: + context = {} for att_id in ids: datas = self.read(cr, uid, att_id) model = False @@ -353,13 +355,13 @@ result[id][name] = lang.replace('_', '-') return result - def _links_get(self, cr, uid, context={}): + def _links_get(self, cr, uid, context=None): obj = self.pool.get('res.request.link') ids = obj.search(cr, uid, []) res = obj.read(cr, uid, ids, ['object', 'name'], context) return [(r['object'], r['name']) for r in res] - def _lang_get(self, cr, uid, context={}): + def _lang_get(self, cr, uid, context=None): obj = self.pool.get('res.lang') ids = obj.search(cr, uid, []) res = obj.read(cr, uid, ids, ['code', 'name'], context) @@ -414,7 +416,7 @@ response_re = re.compile("Are you coming\?.*\n*.*(YES|NO|MAYBE).*", re.UNICODE) - def msg_new(self, cr, uid, msg): + def msg_new(self, cr, uid, msg): return False def msg_act_get(self, msg): @@ -426,7 +428,7 @@ actions['state'] = res[0] return actions - def msg_update(self, cr, uid, ids, msg, data={}, default_act='None'): + def msg_update(self, cr, uid, ids, msg, data=None, default_act='None'): msg_actions = self.msg_act_get(msg) if msg_actions.get('state'): if msg_actions['state'] in ['YES', 'NO', 'MAYBE']: @@ -436,7 +438,7 @@ self.write(cr, uid, ids, {'state': status}) return True - def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context={}): + def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None): company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name for att in self.browse(cr, uid, ids, context=context): sign = att.sent_by_uid and att.sent_by_uid.signature or '' @@ -502,7 +504,7 @@ def do_decline(self, cr, uid, ids, context=None, *args): self.write(cr, uid, ids, {'state': 'declined'}, context) - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): if not vals.get("email") and vals.get("cn"): cnval = vals.get("cn").split(':') email = filter(lambda x:x.__contains__('@'), cnval) @@ -540,7 +542,9 @@ 'active': lambda *x: 1, } - def do_alarm_create(self, cr, uid, ids, model, date, context={}): + def do_alarm_create(self, cr, uid, ids, model, date, context=None): + if context is None: + context = {} alarm_obj = self.pool.get('calendar.alarm') ir_obj = self.pool.get('ir.model') model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0] @@ -577,7 +581,7 @@ cr.commit() return True - def do_alarm_unlink(self, cr, uid, ids, model, context={}): + def do_alarm_unlink(self, cr, uid, ids, model, context=None): alarm_obj = self.pool.get('calendar.alarm') ir_obj = self.pool.get('ir.model') model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0] @@ -631,7 +635,7 @@ 'state': lambda *x: 'run', } - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): event_date = vals.get('event_date', False) if event_date: dtstart = datetime.strptime(vals['event_date'], "%Y-%m-%d %H:%M:%S") @@ -712,11 +716,11 @@ _description = "Calendar Event" __attribute__ = {} - def _tz_get(self, cr, uid, context={}): + def _tz_get(self, cr, uid, context=None): return [(x.lower(), x) for x in pytz.all_timezones] - def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, context={}): + def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, context=None): if not start_date: return {} start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S") @@ -1011,7 +1015,9 @@ context=context) return res - def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}): + def browse(self, cr, uid, ids, context=None, list_class=None, fields_process=None): + if fields_process is None: + fields_process = {} if isinstance(ids, (str, int, long)): select = [ids] else: @@ -1023,7 +1029,7 @@ return res and res[0] or False return res - def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'): + def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): if isinstance(ids, (str, int, long)): select = [ids] else: @@ -1046,7 +1052,7 @@ return result and result[0] or False return result - def copy(self, cr, uid, id, default=None, context={}): + def copy(self, cr, uid, id, default=None, context=None): res = super(calendar_event, self).copy(cr, uid, base_calendar_id2real_id(id), default, context) alarm_obj = self.pool.get('res.alarm') alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date') @@ -1077,7 +1083,7 @@ alarm_obj.do_alarm_unlink(cr, uid, ids, self._name) return res - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): res = super(calendar_event, self).create(cr, uid, vals, context) alarm_obj = self.pool.get('res.alarm') alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date') === modified file 'base_contact/base_contact.py' --- base_contact/base_contact.py 2010-02-24 10:55:29 +0000 +++ base_contact/base_contact.py 2010-03-10 10:58:47 +0000 @@ -32,7 +32,7 @@ # for address in address_obj.browse(cr, 1, address_ids): # contact_id = self.create(cr, 1, {'name': address.name or 't'}) - def _title_get(self,cr, user, context={}): + def _title_get(self, cr, user, context=None): obj = self.pool.get('res.partner.title') ids = obj.search(cr, user, []) res = obj.read(cr, user, ids, ['shortcut', 'name','domain'], context) @@ -71,7 +71,7 @@ _order = "name,first_name" - def name_get(self, cr, user, ids, context={}): + def name_get(self, cr, user, ids, context=None): #will return name and first_name....... if not len(ids): return [] @@ -95,7 +95,9 @@ return super(res_partner_address, self).search(cr, user, args, offset, limit, order, context, count) #overriding of the name_get defined in base in order to remove the old contact name - def name_get(self, cr, user, ids, context={}): + def name_get(self, cr, user, ids, context=None): + if context is None: + context = {} if not len(ids): return [] res = [] @@ -128,7 +130,7 @@ # contact_id = contact_id[0] # self.create(cr, 1, {'address_id': address.id, 'contact_id': contact_id}) - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] res = [] === modified file 'base_iban/base_iban.py' --- base_iban/base_iban.py 2010-02-24 10:55:29 +0000 +++ base_iban/base_iban.py 2010-03-10 10:59:01 +0000 @@ -35,13 +35,13 @@ class res_partner_bank(osv.osv): _inherit = "res.partner.bank" - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): #overwrite to format the iban number correctly if 'iban' in vals and vals['iban']: vals['iban'] = _format_iban(vals['iban']) return super(res_partner_bank, self).create(cr, uid, vals, context) - def write(self, cr, uid, ids, vals, context={}): + def write(self, cr, uid, ids, vals, context=None): #overwrite to format the iban number correctly if 'iban' in vals and vals['iban']: vals['iban'] = _format_iban(vals['iban']) === modified file 'base_module_quality/__init__.py' --- base_module_quality/__init__.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/__init__.py 2010-03-10 10:58:49 +0000 @@ -22,4 +22,4 @@ import base_module_quality import wizard -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/base_module_quality.py' --- base_module_quality/base_module_quality.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/base_module_quality.py 2010-03-10 10:58:49 +0000 @@ -117,7 +117,9 @@ obj_list.append(str(mod.model)) return obj_list - def get_model_ids(self, cr, uid, models=[]): + def get_model_ids(self, cr, uid, models=None): + if models is None: + models = [] # This function returns all ids of the given objects.. if not models: return [] @@ -134,7 +136,11 @@ result_ids[obj] = ids return result_ids - def format_table(self, header=[], data_list={}): #This function can work forwidget="text_wiki" + def format_table(self, header=None, data_list=None): + if header is None: + header = [] + if data_list is None: + data_list = {} detail = "" detail += (header[0]) % tuple(header[1]) frow = '\n|-' @@ -145,7 +151,11 @@ detail = detail + '\n|}' return detail - def format_html_table(self, header=[], data_list=[]): #This function can work for widget="html_tag" + def format_html_table(self, header=None, data_list=None): + if header is None: + header = [] + if data_list is None: + data_list = [] # function create html table.... detail = "" detail += (header[0]) % tuple(header[1]) @@ -289,4 +299,4 @@ module_quality_detail() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/method_test/method_test.py' --- base_module_quality/method_test/method_test.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/method_test/method_test.py 2010-03-10 10:58:49 +0000 @@ -84,4 +84,4 @@ detail += self.format_table(header, dict_method) return detail -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/object_test/object_test.py' --- base_module_quality/object_test/object_test.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/object_test/object_test.py 2010-03-10 10:58:49 +0000 @@ -208,4 +208,4 @@ return res return "" -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/pep8_test/pep8_test.py' --- base_module_quality/pep8_test/pep8_test.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/pep8_test/pep8_test.py 2010-03-10 10:58:49 +0000 @@ -278,4 +278,4 @@ return res return "" -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/pylint_test/pylint_test.py' --- base_module_quality/pylint_test/pylint_test.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/pylint_test/pylint_test.py 2010-03-10 10:58:49 +0000 @@ -112,4 +112,4 @@ return self.format_table(header, data_list=dict_py) return "" -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/structure_test/structure_test.py' --- base_module_quality/structure_test/structure_test.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/structure_test/structure_test.py 2010-03-10 10:58:49 +0000 @@ -178,4 +178,4 @@ return res return "" -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/terp_test/terp_test.py' --- base_module_quality/terp_test/terp_test.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/terp_test/terp_test.py 2010-03-10 10:58:49 +0000 @@ -144,4 +144,4 @@ return res return "" -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/unit_test/unit_test.py' --- base_module_quality/unit_test/unit_test.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/unit_test/unit_test.py 2010-03-10 10:58:49 +0000 @@ -111,4 +111,4 @@ return detail + html +'' return '' -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/wizard/module_quality_check.py' --- base_module_quality/wizard/module_quality_check.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/wizard/module_quality_check.py 2010-03-10 10:58:49 +0000 @@ -28,7 +28,7 @@ class quality_check(wizard.interface): - def _create_quality_check(self, cr, uid, data, context={}): + def _create_quality_check(self, cr, uid, data, context=None): pool = pooler.get_pool(cr.dbname) obj_quality = pool.get('module.quality.check') objs = [] @@ -59,4 +59,4 @@ quality_check("create_quality_check_wiz") -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/wizard/quality_save_report.py' --- base_module_quality/wizard/quality_save_report.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/wizard/quality_save_report.py 2010-03-10 10:58:49 +0000 @@ -40,7 +40,7 @@ 'module_file': {'string': 'Save report', 'type': 'binary', 'required': True}, } -def get_detail(self, cr, uid, datas, context={}): +def get_detail(self, cr, uid, datas, context=None): data = pooler.get_pool(cr.dbname).get('module.quality.detail').browse(cr, uid, datas['id']) if not data.detail: raise wizard.except_wizard(_('Warning'), _('No report to save!')) @@ -58,4 +58,4 @@ } save_report('quality_detail_save') -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_quality/workflow_test/workflow_test.py' --- base_module_quality/workflow_test/workflow_test.py 2010-02-24 10:55:29 +0000 +++ base_module_quality/workflow_test/workflow_test.py 2010-03-10 10:58:49 +0000 @@ -150,4 +150,4 @@ count = self.count_button(node, count) return count -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'base_module_record/wizard/base_module_record_objects.py' --- base_module_record/wizard/base_module_record_objects.py 2010-02-24 10:55:29 +0000 +++ base_module_record/wizard/base_module_record_objects.py 2010-03-10 10:59:04 +0000 @@ -91,7 +91,7 @@ mod.recording_data.append(('query',args, {}, s_id)) return {} -def inter_call(self,cr,uid,data,context): +def inter_call(self, cr, uid, data, context): res=base_module_save._create_module(self,cr, uid, data, context) return res === modified file 'base_report_creator/base_report_creator.py' --- base_report_creator/base_report_creator.py 2010-02-24 10:55:29 +0000 +++ base_report_creator/base_report_creator.py 2010-03-10 10:59:00 +0000 @@ -226,7 +226,9 @@ result = cr.fetchall() return map(lambda x: x[0], result) - def _path_get(self,cr, uid, models, filter_ids=[]): + def _path_get(self, cr, uid, models, filter_ids=None): +if filter_ids is None: + filter_ids = [] # ret_str = """ sale_order_line # left join sale_order on (sale_order_line.order_id=sale_order.id) # left join res_partner on (res_partner.id=sale_order.partner_id)""" === modified file 'base_report_creator/wizard/wiz_set_filter_fields.py' --- base_report_creator/wizard/wiz_set_filter_fields.py 2010-02-24 10:55:29 +0000 +++ base_report_creator/wizard/wiz_set_filter_fields.py 2010-03-10 10:59:00 +0000 @@ -58,14 +58,14 @@ 'value':{'type':'char','string':'Values','size':256}, 'condition' : {'type':'selection','string':'Condition', 'selection':[('and','AND'),('or','OR')]} } -def _set_field_domain(self,cr,uid,data,context): +def _set_field_domain(self, cr, uid, data, context): this_model = data.get('model') this_pooler = pooler.get_pool(cr.dbname).get(this_model) this_data = this_pooler.read(cr,uid,data.get('ids'),['model_ids'],context)[0] select_field_fields['field_id']['domain'] = [('model_id','in',this_data.get('model_ids')),('ttype','<>','many2many'),('ttype','<>','one2many')] return {'field_id':False} -def set_field_operator(self,field_name,field_type,search_operator,search_value): +def set_field_operator(self, field_name, field_type, search_operator, search_value): field_search = [field_name,search_operator,search_value] if search_operator == '=': if field_type=='many2one': === modified file 'base_report_designer/base_report_designer.py' --- base_report_designer/base_report_designer.py 2010-02-24 10:55:29 +0000 +++ base_report_designer/base_report_designer.py 2010-03-10 10:58:41 +0000 @@ -30,7 +30,7 @@ class report_xml(osv.osv): _inherit = 'ir.actions.report.xml' - def sxwtorml(self,cr, uid, file_sxw,file_type): + def sxwtorml(self, cr, uid, file_sxw, file_type): ''' The use of this function is to get rml file from sxw file. ''' @@ -44,7 +44,7 @@ return {'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read()))} - def upload_report(self, cr, uid, report_id, file_sxw,file_type, context): + def upload_report(self, cr, uid, report_id, file_sxw, file_type, context): ''' Untested function ''' === modified file 'base_report_designer/wizard/tiny_sxw2rml/tiny_sxw2rml.py' --- base_report_designer/wizard/tiny_sxw2rml/tiny_sxw2rml.py 2010-02-24 10:55:29 +0000 +++ base_report_designer/wizard/tiny_sxw2rml/tiny_sxw2rml.py 2010-03-10 10:58:41 +0000 @@ -47,11 +47,11 @@ class DomApiGeneral: """General DOM API utilities.""" - def __init__(self,content_string="",file=""): + def __init__(self, content_string="", file=""): self.content_string = content_string self.re_digits = re.compile(r"(.*?\d)(pt|cm|mm|inch|in)") - def _unitTuple(self,string): + def _unitTuple(self, string): """Split values and units to a tuple.""" temp = self.re_digits.findall(string) if not temp: @@ -59,13 +59,15 @@ else: return (temp[0]) - def stringPercentToFloat(self,string): + def stringPercentToFloat(self, string): temp = string.replace("""%""","") return float(temp)/100 - def findChildrenByName(self,parent,name,attr_dict={}): + def findChildrenByName(self, parent, name, attr_dict=None): """Helper functions. Does not work recursively. Optional: also test for certain attribute/value pairs.""" + if attr_dict is None: + attr_dict = {} children = [] for c in parent.childNodes: if c.nodeType == c.ELEMENT_NODE and c.nodeName == name: @@ -75,7 +77,7 @@ else: return self._selectForAttributes(nodelist=children,attr_dict=attr_dict) - def _selectForAttributes(self,nodelist,attr_dict): + def _selectForAttributes(self, nodelist, attr_dict): "Helper function.""" selected_nodes = [] for n in nodelist: @@ -88,7 +90,7 @@ selected_nodes.append(n) return selected_nodes - def _stringToTuple(self,s): + def _stringToTuple(self, s): """Helper function.""" try: temp = string.split(s,",") @@ -96,13 +98,13 @@ except: return None - def _tupleToString(self,t): + def _tupleToString(self, t): try: return self.openOfficeStringUtf8("%s,%s" % (t[0],t[1])) except: return None - def _lengthToFloat(self,value): + def _lengthToFloat(self, value): v = value if not self.re_digits.search(v): return v @@ -118,7 +120,7 @@ except: return v - def openOfficeStringUtf8(self,string): + def openOfficeStringUtf8(self, string): if type(string) == unicode: return string.encode("utf-8") tempstring = unicode(string,"cp1252").encode("utf-8") @@ -126,7 +128,7 @@ class DomApi(DomApiGeneral): """This class provides a DOM-API for XML-Files from an SXW-Archive.""" - def __init__(self,xml_content,xml_styles): + def __init__(self, xml_content, xml_styles): DomApiGeneral.__init__(self) self.content_dom = xml.dom.minidom.parseString(xml_content) self.styles_dom = xml.dom.minidom.parseString(xml_styles) @@ -150,7 +152,7 @@ for s in self.style_dict.keys(): self.style_properties_dict[s] = self.getStylePropertiesDict(s) - def updateWithPercents(self,dict,updatedict): + def updateWithPercents(self, dict, updatedict): """Sometimes you find values like "115%" in the style hierarchy.""" if not updatedict: # no style hierarchies for this style? => @@ -249,7 +251,7 @@ def toxml(self): return self.content_dom.toxml(encoding="utf-8") - def getStylePropertiesDict(self,style_name): + def getStylePropertiesDict(self, style_name): res = {} if self.style_dict[style_name].hasAttribute("style:parent-style-name"): @@ -270,7 +272,7 @@ self.save_pict = save_pict self.images = {} - def oo_read(self,fname): + def oo_read(self, fname): z = zipfile.ZipFile(fname,"r") content = z.read('content.xml') style = z.read('styles.xml') @@ -286,7 +288,7 @@ z.close() return content,style - def oo_replace(self,content): + def oo_replace(self, content): regex = [ (r"]*/>", ""), #(r"(.*?)", "$1"), @@ -297,7 +299,7 @@ content = re.sub(key, val, content) return content - def unpackNormalize(self,sourcefile): + def unpackNormalize(self, sourcefile): c,s = self.oo_read(sourcefile) c = self.oo_replace(c) dom = DomApi(c,s) === modified file 'base_vat/partner.py' --- base_vat/partner.py 2010-02-24 10:55:29 +0000 +++ base_vat/partner.py 2010-03-10 10:58:45 +0000 @@ -61,7 +61,7 @@ return partial(default_vat_check, self, attr[10:]) - def vat_change(self, cr, uid, ids, value, context={}): + def vat_change(self, cr, uid, ids, value, context=None): return {'value': {'vat_subjected': bool(value)}} _columns = { === modified file 'board/board.py' --- board/board.py 2010-02-24 10:55:29 +0000 +++ board/board.py 2010-03-10 10:58:50 +0000 @@ -55,7 +55,7 @@ return arch - def write(self, cr, uid, ids, vals, context={}): + def write(self, cr, uid, ids, vals, context=None): result = super(board_board, self).write(cr, uid, ids, vals, context) cr.commit() @@ -134,7 +134,7 @@ } board_note_type() -def _type_get(self, cr, uid, context={}): +def _type_get(self, cr, uid, context=None): obj = self.pool.get('board.note.type') ids = obj.search(cr, uid, []) res = obj.read(cr, uid, ids, ['name'], context) === modified file 'caldav/DAV/BufferingHTTPServer.py' --- caldav/DAV/BufferingHTTPServer.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/BufferingHTTPServer.py 2010-03-10 10:58:40 +0000 @@ -50,7 +50,7 @@ self.__buffer="" self.__outfp=os.tmpfile() - def _append(self,s): + def _append(self, s): """ append a string to the buffer """ self.__buffer=self.__buffer+s === modified file 'caldav/DAV/WebDAVServer.py' --- caldav/DAV/WebDAVServer.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/WebDAVServer.py 2010-03-10 10:58:40 +0000 @@ -74,11 +74,11 @@ def _log(self, message): pass - def _append(self,s): + def _append(self, s): """ write the string to wfile """ self.wfile.write(s) - def send_body(self,DATA,code,msg,desc,ctype='application/octet-stream',headers=None): + def send_body(self, DATA, code, msg, desc, ctype='application/octet-stream', headers=None): """ send a body in one part """ if not headers: @@ -100,7 +100,7 @@ if DATA: self._append(DATA) - def send_body_chunks(self,DATA,code,msg,desc,ctype='text/xml; encoding="utf-8"'): + def send_body_chunks(self, DATA, code, msg, desc, ctype='text/xml; encoding="utf-8"'): """ send a body in chunks """ self.responses[207]=(msg,desc) @@ -301,7 +301,7 @@ except DAV_Error, (ec,dd): self.send_status(ec) - def copymove(self,CLASS): + def copymove(self, CLASS): """ common method for copying or moving objects """ dc=self.IFACE_CLASS @@ -357,7 +357,7 @@ else: self.send_status(result_code) - def get_userinfo(self,user,pw): + def get_userinfo(self, user, pw): """ Dummy method which lets all users in """ return 1 @@ -368,7 +368,7 @@ if not msg: msg=STATUS_CODES[code] self.send_body(body,code,STATUS_CODES[code],msg,mediatype) - def send_notFound(self,descr,uri): + def send_notFound(self, descr, uri): body = """ %s === modified file 'caldav/DAV/davcmd.py' --- caldav/DAV/davcmd.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/davcmd.py 2010-03-10 10:58:40 +0000 @@ -14,7 +14,7 @@ from utils import create_treelist, is_prefix from errors import * -def deltree(dc,uri,exclude={}): +def deltree(dc, uri, exclude=None): """ delete a tree of resources dc -- dataclass to use @@ -66,7 +66,7 @@ return result -def delone(dc,uri): +def delone(dc, uri): """ delete a single object """ if dc.is_collection(uri): dc.rmcol(uri) # should be empty @@ -79,7 +79,7 @@ # helper function -def copy(dc,src,dst): +def copy(dc, src, dst): """ only copy the element This is just a helper method factored out from copy and @@ -101,7 +101,7 @@ # the main functions -def copyone(dc,src,dst,overwrite=None): +def copyone(dc, src, dst, overwrite=None): """ copy one resource to a new destination """ if overwrite and dc.exists(dst): @@ -117,7 +117,7 @@ except DAV_Error, (ec,dd): return ec -def copytree(dc,src,dst,overwrite=None): +def copytree(dc, src, dst, overwrite=None): """ copy a tree of resources to another location dc -- dataclass to use @@ -185,7 +185,7 @@ ### -def moveone(dc,src,dst,overwrite=None): +def moveone(dc, src, dst, overwrite=None): """ move a single resource This is done by first copying it and then deleting @@ -198,7 +198,7 @@ # then delete it dc.rm(src) -def movetree(dc,src,dst,overwrite=None): +def movetree(dc, src, dst, overwrite=None): """ move a collection This is done by first copying it and then deleting === modified file 'caldav/DAV/davcopy.py' (properties changed: +x to -x) --- caldav/DAV/davcopy.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/davcopy.py 2010-03-10 10:58:40 +0000 @@ -47,7 +47,7 @@ """ - def __init__(self,dataclass,src_uri,dst_uri,overwrite): + def __init__(self, dataclass, src_uri, dst_uri, overwrite): self.__dataclass=dataclass self.__src=src_uri self.__dst=dst_uri === modified file 'caldav/DAV/davmove.py' (properties changed: +x to -x) --- caldav/DAV/davmove.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/davmove.py 2010-03-10 10:58:40 +0000 @@ -47,7 +47,7 @@ """ - def __init__(self,dataclass,src_uri,dst_uri,overwrite): + def __init__(self, dataclass, src_uri, dst_uri, overwrite): self.__dataclass=dataclass self.__src=src_uri self.__dst=dst_uri === modified file 'caldav/DAV/delete.py' (properties changed: +x to -x) --- caldav/DAV/delete.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/delete.py 2010-03-10 10:58:40 +0000 @@ -32,7 +32,7 @@ class DELETE: - def __init__(self,uri,dataclass): + def __init__(self, uri, dataclass): self.__dataclass=dataclass self.__uri=uri === modified file 'caldav/DAV/errors.py' (properties changed: +x to -x) --- caldav/DAV/errors.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/errors.py 2010-03-10 10:58:40 +0000 @@ -12,7 +12,7 @@ 2. the error result element, e.g. a element """ - def __init__(self,*args): + def __init__(self, *args): if len(args)==1: self.args=(args[0],"") else: @@ -32,7 +32,7 @@ class DAV_NotFound(DAV_Error): """ a requested property was not found for a resource """ - def __init__(self,*args): + def __init__(self, *args): if len(args): if isinstance(args[0],list): stre = "Path %s not found!"%('/'.join(args[0])) @@ -47,7 +47,7 @@ class DAV_Forbidden(DAV_Error): """ a method on a resource is not allowed """ - def __init__(self,*args): + def __init__(self, *args): if len(args): DAV_Error.__init__(self,403,args[0]) else: === modified file 'caldav/DAV/iface.py' --- caldav/DAV/iface.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/iface.py 2010-03-10 10:58:40 +0000 @@ -39,7 +39,7 @@ M_NS={"DAV:" : "_get_dav", "NS2" : "ns2" } - def get_propnames(self,uri): + def get_propnames(self, uri): """ return the property names allowed for the given URI In this method we simply return the above defined properties @@ -50,14 +50,14 @@ """ return self.PROPS - def get_prop2(self,uri,ns,pname): + def get_prop2(self, uri, ns, pname): """ return the value of a property """ if lower(ns)=="dav:": return self.get_dav(uri,pname) raise DAV_NotFound - def get_prop(self,uri,ns,propname): + def get_prop(self, uri, ns, propname): """ return the value of a given property uri -- uri of the object to get the property of @@ -86,7 +86,7 @@ ### DATA methods (for GET and PUT) ### - def get_data(self,uri): + def get_data(self, uri): """ return the content of an object return data or raise an exception @@ -94,7 +94,7 @@ """ raise DAV_NotFound - def put(self,uri,data): + def put(self, uri, data): """ write an object to the repository return a result code or raise an exception @@ -106,7 +106,7 @@ ### Methods for DAV properties ### - def _get_dav_creationdate(self,uri): + def _get_dav_creationdate(self, uri): """ return the creationdate of a resource """ d=self.get_creationdate(uri) # format it @@ -114,7 +114,7 @@ d = time.localtimetime(d) return time.strftime("%Y-%m-%dT%H:%M:%S%Z",d) - def _get_dav_getlastmodified(self,uri): + def _get_dav_getlastmodified(self, uri): """ return the last modified date of a resource """ d=self.get_lastmodified(uri) if isinstance(d, int) or isinstance(d, float): @@ -127,11 +127,11 @@ ### OVERRIDE THESE! ### - def get_creationdate(self,uri): + def get_creationdate(self, uri): """ return the creationdate of the resource """ return time.time() - def get_lastmodified(self,uri): + def get_lastmodified(self, uri): """ return the last modification date of the resource """ return time.time() @@ -142,7 +142,7 @@ ### methods for deleting a resource - def rmcol(self,uri): + def rmcol(self, uri): """ delete a collection This should not delete any children! This is automatically done @@ -153,7 +153,7 @@ """ raise DAV_NotFound - def rm(self,uri): + def rm(self, uri): """ delete a single resource return a success code or raise an exception @@ -210,27 +210,27 @@ ### MOVE handlers - def moveone(self,src,dst,overwrite): + def moveone(self, src, dst, overwrite): """ move one resource with Depth=0 """ return moveone(self,src,dst,overwrite) - def movetree(self,src,dst,overwrite): + def movetree(self, src, dst, overwrite): """ move a collection with Depth=infinity """ return movetree(self,src,dst,overwrite) ### COPY handlers - def copyone(self,src,dst,overwrite): + def copyone(self, src, dst, overwrite): """ copy one resource with Depth=0 """ return copyone(self,src,dst,overwrite) - def copytree(self,src,dst,overwrite): + def copytree(self, src, dst, overwrite): """ copy a collection with Depth=infinity """ return copytree(self,src,dst,overwrite) ### low level copy methods (you only need these for method 2) - def copy(self,src,dst): + def copy(self, src, dst): """ copy a resource with depth==0 You don't need to bother about overwrite or not. @@ -241,7 +241,7 @@ return 201 - def copycol(self,src,dst): + def copycol(self, src, dst): """ copy a resource with depth==infinity You don't need to bother about overwrite or not. @@ -253,11 +253,11 @@ ### some utility functions you need to implement - def exists(self,uri): + def exists(self, uri): """ return 1 or None depending on if a resource exists """ return None # no - def is_collection(self,uri): + def is_collection(self, uri): """ return 1 or None depending on if a resource is a collection """ return None # no === modified file 'caldav/DAV/propfind.py' (properties changed: +x to -x) --- caldav/DAV/propfind.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/propfind.py 2010-03-10 10:58:40 +0000 @@ -56,7 +56,7 @@ """ - def __init__(self,uri,dataclass,depth): + def __init__(self, uri, dataclass, depth): self.request_type=None self.nsmap={} self.proplist={} @@ -67,7 +67,7 @@ self.use_full_urls=True self.__has_body=None # did we parse a body? - def read_propfind(self,xml_doc): + def read_propfind(self, xml_doc): self.request_type,self.proplist,self.namespaces=utils.parse_propfind(xml_doc) # a violation of the expected logic: client (korganizer) will ask for DAV:resourcetype @@ -208,7 +208,7 @@ return s - def mk_propname_response(self,uri,propnames,doc): + def mk_propname_response(self, uri, propnames, doc): """ make a new result element for a PROPNAME request This will simply format the propnames list. @@ -249,7 +249,7 @@ return re - def mk_prop_response(self,uri,good_props,bad_props,doc): + def mk_prop_response(self, uri, good_props, bad_props, doc): """ make a new result element We differ between the good props and the bad ones for @@ -333,7 +333,7 @@ # return the new response element return re - def get_propvalues(self,uri): + def get_propvalues(self, uri): """ create lists of property values for an URI We create two lists for an URI: the properties for === modified file 'caldav/DAV/utils.py' (properties changed: +x to -x) --- caldav/DAV/utils.py 2010-02-24 10:55:29 +0000 +++ caldav/DAV/utils.py 2010-03-10 10:58:40 +0000 @@ -73,7 +73,7 @@ return request_type,props,namespaces -def create_treelist(dataclass,uri): +def create_treelist(dataclass, uri): """ create a list of resources out of a tree This function is used for the COPY, MOVE and DELETE methods @@ -99,7 +99,7 @@ queue=queue+childs return list -def is_prefix(uri1,uri2): +def is_prefix(uri1, uri2): """ returns 1 of uri1 is a prefix of uri2 """ if uri2[:len(uri1)]==uri1: return 1 === modified file 'caldav/caldav.py' --- caldav/caldav.py 2010-03-05 09:21:22 +0000 +++ caldav/caldav.py 2010-03-10 10:58:40 +0000 @@ -70,7 +70,9 @@ value = 'OpenObject-%s_%s@%s' % (oomodel, uidval, cr.dbname) return value -def get_attribute_mapping(cr, uid, calname, context={}): +def get_attribute_mapping(cr, uid, calname, context=None): + if context is None: + context = {} if not context: context = {} pool = pooler.get_pool(cr.dbname) @@ -277,7 +279,9 @@ vevent.add(field).value = key1 return vevent - def check_import(self, cr, uid, vals, context={}): + def check_import(self, cr, uid, vals, context=None): + if context is None: + context = {} ids = [] model_obj = self.pool.get(context.get('model')) recur_pool = {} @@ -308,7 +312,9 @@ raise osv.except_osv(('Error !'), (str(e))) return ids - def export_cal(self, cr, uid, datas, vobj=None, context={}): + def export_cal(self, cr, uid, datas, vobj=None, context=None): + if context is None: + context = {} try: self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, context) ical = vobject.iCalendar() @@ -363,7 +369,9 @@ 'active': lambda *a: True, } - def export_cal(self, cr, uid, ids, vobj='vevent', context={}): + def export_cal(self, cr, uid, ids, vobj='vevent', context=None): + if context is None: + context = {} cal = self.browse(cr, uid, ids[0]) ical = vobject.iCalendar() for line in cal.line_ids: @@ -427,7 +435,7 @@ 'domain': lambda *a: '[]', } - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): cr.execute("Select count(id) from basic_calendar_lines \ where name='%s' and calendar_id=%s" % (vals.get('name'), vals.get('calendar_id'))) res = cr.fetchone() @@ -486,7 +494,7 @@ raise osv.except_osv(_('Warning !'), _('Please provide proper configuration of "%s" in Calendar Lines' % (name))) return True - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): cr.execute('select name from basic_calendar_attributes \ where id=%s' % (vals.get('name'))) name = cr.fetchone() @@ -558,7 +566,7 @@ 'duration': None, # Use: O-1, Type: DURATION, Specifies a positive duration of time. 'dtend': None, # Use: O-1, Type: DATE-TIME, Specifies the date and time that a calendar component ends. } - def export_cal(self, cr, uid, datas, vobj='vevent', context={}): + def export_cal(self, cr, uid, datas, vobj='vevent', context=None): return super(Event, self).export_cal(cr, uid, datas, 'vevent', context=context) Event() @@ -602,7 +610,7 @@ 'rrule': None, } - def export_cal(self, cr, uid, datas, vobj='vevent', context={}): + def export_cal(self, cr, uid, datas, vobj='vevent', context=None): return super(ToDo, self).export_cal(cr, uid, datas, 'vtodo', context=context) ToDo() @@ -642,7 +650,7 @@ 'x-prop': None, # Use: O-n, Type: Text, } - def get_name_offset(self, cr, uid, tzid, context={}): + def get_name_offset(self, cr, uid, tzid, context=None): mytz = pytz.timezone(tzid.title()) mydt = datetime.now(tz=mytz) offset = mydt.utcoffset() @@ -652,7 +660,9 @@ realoffset = (val < 0 and ('-' + realoffset) or ('+' + realoffset)) return (mydt.tzname(), realoffset) - def export_cal(self, cr, uid, model, tzid, ical, context={}): + def export_cal(self, cr, uid, model, tzid, ical, context=None): + if context is None: + context = {} ctx = context.copy() ctx.update({'model': model}) cal_tz = ical.add('vtimezone') @@ -692,7 +702,7 @@ 'x-prop': None, } - def export_cal(self, cr, uid, model, alarm_id, vevent, context={}): + def export_cal(self, cr, uid, model, alarm_id, vevent, context=None): valarm = vevent.add('valarm') alarm_object = self.pool.get(model) alarm_data = alarm_object.read(cr, uid, alarm_id, []) @@ -786,7 +796,9 @@ vals = map_data(cr, uid, self) return vals - def export_cal(self, cr, uid, model, attendee_ids, vevent, context={}): + def export_cal(self, cr, uid, model, attendee_ids, vevent, context=None): + if context is None: + context = {} attendee_object = self.pool.get(model) ctx = context.copy() ctx.update({'model': model}) === modified file 'caldav/caldav_fs.py' --- caldav/caldav_fs.py 2010-02-24 10:55:29 +0000 +++ caldav/caldav_fs.py 2010-03-10 10:58:40 +0000 @@ -52,7 +52,7 @@ M_NS={ "DAV:" : dav_interface.M_NS['DAV:'], } - def __init__(self, parent, verbose=False): + def __init__(self, parent, verbose=False): self.db_name = False self.parent = parent self.baseuri = parent.baseuri @@ -71,7 +71,7 @@ cr.close() return props - def get_prop(self,uri,ns,propname): + def get_prop(self, uri, ns, propname): """ return the value of a given property uri -- uri of the object to get the property of @@ -94,7 +94,7 @@ cr.close() return res - def urijoin(self,*ajoin): + def urijoin(self, *ajoin): """ Return the base URI of this request, or even join it with the ajoin path elements """ @@ -110,7 +110,7 @@ # # pos: -1 to get the parent of the uri # - def get_cr(self, uri): + def get_cr(self, uri): pdb = self.parent.auth_proxy.last_auth reluri = self.uri2local(uri) try: @@ -135,7 +135,7 @@ return None return pool.get('basic.calendar').get_calendar_object(cr, uid, uri) - def get_data(self,uri): + def get_data(self, uri): self.parent.log_message('GET: %s' % uri) if uri[-1]=='/':uri=uri[:-1] cr, uid, pool, dbname, uri2 = self.get_cr(uri) @@ -165,7 +165,7 @@ cr.close() @memoize(CACHE_SIZE) - def _get_dav_resourcetype(self,uri): + def _get_dav_resourcetype(self, uri): """ return type of object """ self.parent.log_message('get RT: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -180,7 +180,7 @@ finally: cr.close() - def _get_dav_displayname(self,uri): + def _get_dav_displayname(self, uri): self.parent.log_message('get DN: %s' % uri) if uri[-1]=='/':uri=uri[:-1] cr, uid, pool, dbname, uri2 = self.get_cr(uri) @@ -195,7 +195,7 @@ return node.displayname @memoize(CACHE_SIZE) - def _get_dav_getcontentlength(self,uri): + def _get_dav_getcontentlength(self, uri): """ return the content length of an object """ self.parent.log_message('get length: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -213,7 +213,7 @@ return str(result) @memoize(CACHE_SIZE) - def _get_dav_getetag(self,uri): + def _get_dav_getetag(self, uri): """ return the ETag of an object """ self.parent.log_message('get etag: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -231,7 +231,7 @@ return str(result) @memoize(CACHE_SIZE) - def get_lastmodified(self,uri): + def get_lastmodified(self, uri): """ return the last modified date of the object """ if uri[-1]=='/':uri=uri[:-1] today = time.time() @@ -250,7 +250,7 @@ cr.close() @memoize(CACHE_SIZE) - def get_creationdate(self,uri): + def get_creationdate(self, uri): """ return the last modified date of the object """ if uri[-1]=='/':uri=uri[:-1] @@ -270,7 +270,7 @@ cr.close() @memoize(CACHE_SIZE) - def _get_dav_getcontenttype(self,uri): + def _get_dav_getcontenttype(self, uri): self.parent.log_message('get contenttype: %s' % uri) if uri[-1]=='/':uri=uri[:-1] cr, uid, pool, dbname, uri2 = self.get_cr(uri) @@ -318,7 +318,7 @@ - def exists(self,uri): + def exists(self, uri): """ test if a resource exists """ result = False cr, uid, pool,dbname, uri2 = self.get_cr(uri) === modified file 'caldav/caldav_node.py' --- caldav/caldav_node.py 2010-02-24 10:55:29 +0000 +++ caldav/caldav_node.py 2010-03-10 10:58:40 +0000 @@ -38,31 +38,31 @@ self.displayname = calendar.name - def get_data(self, cr, uid): + def get_data(self, cr, uid): calendar_obj = pooler.get_pool(cr.dbname).get('basic.calendar') return calendar_obj.export_cal(cr, uid, [self.calendar_id]) def get_data_len(self, cr): return self.content_length - def set_data(self, cr, uid, data): + def set_data(self, cr, uid, data): calendar_obj = pooler.get_pool(cr.dbname).get('basic.calendar') return calendar_obj.import_cal(cr, uid, base64.encodestring(data), self.calendar_id) - def get_etag(self,cr): + def get_etag(self, cr): """ Get a tag, unique per object + modification. see. http://tools.ietf.org/html/rfc2616#section-13.3.3 """ return self._get_ttag(cr) + ':' + self._get_wtag(cr) - def _get_wtag(self,cr): + def _get_wtag(self, cr): """ Return the modification time as a unique, compact string """ if self.write_date: wtime = time.mktime(time.strptime(self.write_date,'%Y-%m-%d %H:%M:%S')) else: wtime = time.time() return str(wtime) - def _get_ttag(self,cr): + def _get_ttag(self, cr): return 'calendar-%d' % self.calendar_id class Calendar(osv.osv): === modified file 'caldav/webdav_server.py' --- caldav/webdav_server.py 2010-03-05 20:47:58 +0000 +++ caldav/webdav_server.py 2010-03-10 10:58:40 +0000 @@ -36,7 +36,7 @@ class DAVHandler(FixSendError,DAVRequestHandler): verbose = False - def get_userinfo(self,user,pw): + def get_userinfo(self, user, pw): return False def _log(self, message): === modified file 'caldav/wizard/__init__.py' (properties changed: +x to -x) === modified file 'crm/crm.py' --- crm/crm.py 2010-03-10 06:55:07 +0000 +++ crm/crm.py 2010-03-10 10:59:02 +0000 @@ -93,7 +93,7 @@ _constraints = [ (_check_recursion, 'Error ! You cannot create recursive sections.', ['parent_id']) ] - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name','parent_id'], context) @@ -169,7 +169,7 @@ crm_case_stage() -def _links_get(self, cr, uid, context={}): +def _links_get(self, cr, uid, context=None): obj = self.pool.get('res.request.link') ids = obj.search(cr, uid, []) res = obj.read(cr, uid, ids, ['object', 'name'], context) @@ -189,12 +189,12 @@ res[case.id] = False return res - def copy(self, cr, uid, id, default=None, context={}): + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} default.update( {'state':'draft', 'id':False}) return super(crm_case, self).copy(cr, uid, id, default, context) - def _get_log_ids(self, cr, uid, ids, field_names, arg, context={}): + def _get_log_ids(self, cr, uid, ids, field_names, arg, context=None): result = {} history_obj = False model_obj = self.pool.get('ir.model') @@ -282,14 +282,14 @@ } _order = 'date_deadline desc, create_date desc,id desc' - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): for case in self.browse(cr, uid, ids, context): if (not case.section_id.allow_unlink) and (case.state <> 'draft'): raise osv.except_osv(_('Warning !'), _('You can not delete this case. You should better cancel it.')) return super(crm_case, self).unlink(cr, uid, ids, context) - def stage_next(self, cr, uid, ids, context={}): + def stage_next(self, cr, uid, ids, context=None): s = self.get_stage_dict(cr, uid, ids, context=context) for case in self.browse(cr, uid, ids, context): section = (case.section_id.id or False) @@ -299,7 +299,7 @@ self.write(cr, uid, [case.id], {'stage_id': s[section][st]}) return True - def get_stage_dict(self, cr, uid, ids, context={}): + def get_stage_dict(self, cr, uid, ids, context=None): sid = self.pool.get('crm.case.stage').search(cr, uid, [('object_id.model', '=', self._name)], context=context) s = {} previous = {} @@ -310,7 +310,7 @@ previous[section] = stage.id return s - def stage_previous(self, cr, uid, ids, context={}): + def stage_previous(self, cr, uid, ids, context=None): s = self.get_stage_dict(cr, uid, ids, context=context) for case in self.browse(cr, uid, ids, context): section = (case.section_id.id or False) @@ -322,7 +322,7 @@ return True - def onchange_case_id(self, cr, uid, ids, case_id, name, partner_id, context={}): + def onchange_case_id(self, cr, uid, ids, case_id, name, partner_id, context=None): if not case_id: return {} case = self.browse(cr, uid, case_id, context=context) @@ -337,13 +337,13 @@ value['email_from'] = case.email_from return {'value': value} - def history(self, cr, uid, ids, keyword, history=False, email=False, details=None, context={}): + def history(self, cr, uid, ids, keyword, history=False, email=False, details=None, context=None): cases = self.browse(cr, uid, ids, context=context) return self.__history(cr, uid, cases, keyword=keyword,\ history=history, email=email, details=details,\ context=context) - def __history(self, cr, uid, cases, keyword, history=False, email=False, details=None, context={}): + def __history(self, cr, uid, cases, keyword, history=False, email=False, details=None, context=None): model_obj = self.pool.get('ir.model') for case in cases: model_ids = model_obj.search(cr, uid, [('model','=',case._name)]) @@ -382,13 +382,13 @@ }, context=context) return True - def case_log(self, cr, uid, ids,context={}, email=False, *args): + def case_log(self, cr, uid, ids, context=None, email=False, *args): cases = self.browse(cr, uid, ids) self.__history(cr, uid, cases, _('Historize'), history=True, email=email) return self.write(cr, uid, ids, {'description': False, 'som': False, 'canal_id': False}) - def case_log_reply(self, cr, uid, ids, context={}, email=False, *args): + def case_log_reply(self, cr, uid, ids, context=None, email=False, *args): cases = self.browse(cr, uid, ids) for case in cases: if not case.email_from: @@ -578,7 +578,7 @@ return {'value':{'email': email}} - def add_cc(self, cr, uid, ids, context={}): + def add_cc(self, cr, uid, ids, context=None): data = self.read(cr, uid, ids[0]) email = data['email'] subject = data['subject'] === modified file 'crm/crm_action_rule.py' --- crm/crm_action_rule.py 2010-03-03 05:57:06 +0000 +++ crm/crm_action_rule.py 2010-03-10 10:59:03 +0000 @@ -41,7 +41,7 @@ 'date_action_next': fields.datetime('Next Action', readonly=1), } - def remind_partner(self, cr, uid, ids, context={}, attach=False): + def remind_partner(self, cr, uid, ids, context=None, attach=False): return self.remind_user(cr, uid, ids, context, attach, destination=False) @@ -85,7 +85,7 @@ raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully")) return True - def _check(self, cr, uid, ids=False, context={}): + def _check(self, cr, uid, ids=False, context=None): ''' Function called by the scheduler to process cases for date actions Only works on not done and cancelled cases @@ -100,7 +100,9 @@ cases = self.browse(cr, uid, ids2, context) return self._action(cr, uid, cases, False, context=context) - def _action(self, cr, uid, cases, state_to, scrit=None, context={}): + def _action(self, cr, uid, cases, state_to, scrit=None, context=None): + if context is None: + context = {} if not context: context = {} context['state_to'] = state_to @@ -110,7 +112,7 @@ rule_ids = rule_obj.search(cr, uid, [('name','=',model_ids[0])]) return rule_obj._action(cr, uid, rule_ids, cases, scrit=scrit, context=context) - def format_body(self, body): + def format_body(self, body): return self.pool.get('base.action.rule').format_body(body) def format_mail(self, obj, body): @@ -121,7 +123,7 @@ _inherit = 'base.action.rule' _description = 'Action Rules' - def do_check(self, cr, uid, action, obj, context={}): + def do_check(self, cr, uid, action, obj, context=None): ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context) if hasattr(obj, 'section_id'): @@ -142,7 +144,7 @@ ok = ok and regex_h return ok - def do_action(self, cr, uid, action, model_obj, obj, context={}): + def do_action(self, cr, uid, action, model_obj, obj, context=None): res = super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context) write = {} @@ -174,11 +176,11 @@ class base_action_rule_line(osv.osv): _inherit = 'base.action.rule.line' - def state_get(self, cr, uid, context={}): + def state_get(self, cr, uid, context=None): res = super(base_action_rule_line, self).state_get(cr, uid, context=context) return res + [('escalate','Escalate')] + crm.AVAILABLE_STATES - def priority_get(self, cr, uid, context={}): + def priority_get(self, cr, uid, context=None): res = super(base_action_rule_line, self).priority_get(cr, uid, context=context) return res + crm.AVAILABLE_PRIORITIES === modified file 'crm/crm_mailgate.py' --- crm/crm_mailgate.py 2010-03-10 06:55:07 +0000 +++ crm/crm_mailgate.py 2010-03-10 10:59:03 +0000 @@ -36,7 +36,7 @@ _name = "crm.case" _inherit = "crm.case" - def msg_new(self, cr, uid, msg): + def msg_new(self, cr, uid, msg): mailgate_obj = self.pool.get('mail.gateway') msg_body = mailgate_obj.msg_body_get(msg) data = { @@ -54,7 +54,9 @@ self._history(cr, uid, cases, _('Receive'), history=True, email=msg['From']) return res - def msg_update(self, cr, uid, ids, msg, data={}, default_act='pending'): + def msg_update(self, cr, uid, ids, msg, data=None, default_act='pending'): + if data is None: + data = {} if isinstance(ids, (str, int, long)): select = [ids] else: @@ -86,7 +88,7 @@ getattr(self,act)(cr, uid, select) return res - def emails_get(self, cr, uid, ids, context={}): + def emails_get(self, cr, uid, ids, context=None): res = [] if isinstance(ids, (str, int, long)): select = [ids] === modified file 'crm/crm_meeting.py' --- crm/crm_meeting.py 2010-03-04 09:54:42 +0000 +++ crm/crm_meeting.py 2010-03-10 10:59:02 +0000 @@ -65,7 +65,7 @@ class calendar_attendee(osv.osv): _inherit = 'calendar.attendee' - def _compute_data(self, cr, uid, ids, name, arg, context): + def _compute_data(self, cr, uid, ids, name, arg, context): name = name[0] result = super(calendar_attendee, self)._compute_data(cr, uid, ids, name, arg, context) === modified file 'crm/crm_opportunity.py' --- crm/crm_opportunity.py 2010-03-09 13:04:06 +0000 +++ crm/crm_opportunity.py 2010-03-10 10:59:02 +0000 @@ -53,7 +53,7 @@ \nWhen the case is over, the state is set to \'Done\'.\ \nIf the case needs to be reviewed then the state is set to \'Pending\'.'), } - def onchange_stage_id(self, cr, uid, ids, stage_id, context={}): + def onchange_stage_id(self, cr, uid, ids, stage_id, context=None): if not stage_id: return {'value':{}} stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context) @@ -61,14 +61,14 @@ return {'value':{}} return {'value':{'probability':stage.probability}} - def stage_next(self, cr, uid, ids, context={}): + def stage_next(self, cr, uid, ids, context=None): res = super(crm_opportunity, self).stage_next(cr, uid, ids, context=context) for case in self.browse(cr, uid, ids, context): if case.stage_id and case.stage_id.on_change: self.write(cr, uid, [case.id], {'probability': case.stage_id.probability}) return res - def stage_previous(self, cr, uid, ids, context={}): + def stage_previous(self, cr, uid, ids, context=None): res = super(crm_opportunity, self).stage_previous(cr, uid, ids, context=context) for case in self.browse(cr, uid, ids, context): if case.stage_id and case.stage_id.on_change: === modified file 'crm/report/crm_report.py' --- crm/report/crm_report.py 2010-03-05 13:17:53 +0000 +++ crm/report/crm_report.py 2010-03-10 10:59:02 +0000 @@ -35,7 +35,7 @@ _description = "Cases and section" _auto = False - def _get_data(self, cr, uid, ids, field_name, arg, context={}): + def _get_data(self, cr, uid, ids, field_name, arg, context=None): res = {} state_perc = 0.0 avg_ans = 0.0 === modified file 'crm/report/report_businessopp.py' --- crm/report/report_businessopp.py 2010-02-24 10:55:29 +0000 +++ crm/report/report_businessopp.py 2010-03-10 10:59:02 +0000 @@ -47,7 +47,7 @@ return self.pdf class report_custom(report_int): - def create(self, cr, uid, ids, datas, context={}): + def create(self, cr, uid, ids, datas, context=None): assert len(ids), 'You should provide some ids!' responsible_data = {} responsible_names = {} === modified file 'crm/scripts/openerp_mailgate/openerp_mailgate.py' (properties changed: +x to -x) --- crm/scripts/openerp_mailgate/openerp_mailgate.py 2010-03-10 06:55:07 +0000 +++ crm/scripts/openerp_mailgate/openerp_mailgate.py 2010-03-10 10:59:03 +0000 @@ -126,7 +126,7 @@ return html class rpc_proxy(object): - def __init__(self, uid, passwd, host='localhost', port=8069, path='object', dbname='terp'): + def __init__(self, uid, passwd, host='localhost', port=8069, path='object', dbname='terp'): self.rpc = xmlrpclib.ServerProxy('http://%s:%s/xmlrpc/%s' % (host, port, path)) self.user_id = uid self.passwd = passwd @@ -136,7 +136,7 @@ return self.rpc.execute(self.dbname, self.user_id, self.passwd, *request, **kwargs) class email_parser(object): - def __init__(self, uid, password, model, email, email_default, dbname, host, port): + def __init__(self, uid, password, model, email, email_default, dbname, host, port): self.rpc = rpc_proxy(uid, password, host=host, port=port, dbname=dbname) try: self.model_id = int(model) === modified file 'crm/wizard/crm_lead_wizard.py' --- crm/wizard/crm_lead_wizard.py 2010-03-04 10:36:46 +0000 +++ crm/wizard/crm_lead_wizard.py 2010-03-10 10:59:03 +0000 @@ -128,7 +128,7 @@ case_obj.write(cr, uid, [case.id], vals) return partner_ids - def _make_partner(self, cr, uid, data, context): + def _make_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) partner_ids = self._create_partner(cr, uid, data, context) mod_obj = pool.get('ir.model.data') === modified file 'crm/wizard/crm_phonecall_wizard.py' --- crm/wizard/crm_phonecall_wizard.py 2010-03-04 11:25:45 +0000 +++ crm/wizard/crm_phonecall_wizard.py 2010-03-10 10:59:03 +0000 @@ -105,7 +105,7 @@ case_obj.write(cr, uid, [case.id], vals) return partner_ids - def _make_partner(self, cr, uid, data, context): + def _make_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) partner_ids = self._create_partner(cr, uid, data, context) mod_obj = pool.get('ir.model.data') === modified file 'crm/wizard/wizard_history_event.py' --- crm/wizard/wizard_history_event.py 2010-02-24 10:55:29 +0000 +++ crm/wizard/wizard_history_event.py 2010-03-10 10:59:03 +0000 @@ -24,7 +24,7 @@ import pooler import time -def _open_history_event(self, cr, uid, data, context): +def _open_history_event(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) data_obj = pool.get('ir.model.data') result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_filter') === modified file 'crm_caldav/crm_caldav.py' --- crm_caldav/crm_caldav.py 2010-03-03 12:59:53 +0000 +++ crm_caldav/crm_caldav.py 2010-03-10 10:58:39 +0000 @@ -27,14 +27,14 @@ class crm_meeting(osv.osv): _inherit = 'crm.meeting' - def export_cal(self, cr, uid, ids, context={}): + def export_cal(self, cr, uid, ids, context=None): ids = map(lambda x: base_calendar.base_calendar_id2real_id(x), ids) event_data = self.read(cr, uid, ids) event_obj = self.pool.get('basic.calendar.event') ical = event_obj.export_cal(cr, uid, event_data, context={'model': self._name}) return ical.serialize() - def import_cal(self, cr, uid, data, data_id=None, context={}): + def import_cal(self, cr, uid, data, data_id=None, context=None): event_obj = self.pool.get('basic.calendar.event') vals = event_obj.import_cal(cr, uid, data, context=context) return self.check_import(cr, uid, vals, context=context) === modified file 'crm_profiling/crm_profiling.py' --- crm_profiling/crm_profiling.py 2010-02-24 10:55:29 +0000 +++ crm_profiling/crm_profiling.py 2010-03-10 10:58:41 +0000 @@ -66,7 +66,9 @@ return ids_to_check -def test_prof(cr, uid, seg_id, pid, answers_ids = []): +def test_prof(cr, uid, seg_id, pid, answers_ids=None): +if answers_ids is None: + answers_ids = [] #return True if the partner pid fetch the segmentation rule seg_id ids_to_check = _get_parents(cr, uid, [seg_id]) [yes_answers, no_answers] = _get_answers(cr, uid, ids_to_check) === modified file 'delivery/delivery.py' --- delivery/delivery.py 2010-02-24 10:55:29 +0000 +++ delivery/delivery.py 2010-03-10 10:58:39 +0000 @@ -28,7 +28,9 @@ _name = "delivery.carrier" _description = "Carrier and delivery grids" - def get_price(self, cr, uid, ids, field_name, arg=None, context={}): + def get_price(self, cr, uid, ids, field_name, arg=None, context=None): + if context is None: + context = {} res={} sale_obj=self.pool.get('sale.order') grid_obj=self.pool.get('delivery.grid') @@ -55,7 +57,7 @@ _defaults = { 'active': lambda *args:1 } - def grid_get(self, cr, uid, ids, contact_id, context={}): + def grid_get(self, cr, uid, ids, contact_id, context=None): contact = self.pool.get('res.partner.address').browse(cr, uid, [contact_id])[0] for carrier in self.browse(cr, uid, ids): for grid in carrier.grids_id: @@ -110,7 +112,7 @@ return self.get_price_from_picking(cr, uid, id, total,weight, volume, context) - def get_price_from_picking(self, cr, uid, id, total, weight, volume, context={}): + def get_price_from_picking(self, cr, uid, id, total, weight, volume, context=None): grid = self.browse(cr, uid, id, context) price = 0.0 === modified file 'document/content_index.py' --- document/content_index.py 2010-03-02 09:43:49 +0000 +++ document/content_index.py 2010-03-10 10:58:36 +0000 @@ -43,7 +43,7 @@ def _getExtensions(self): return [] - def _getDefMime(self,ext): + def _getDefMime(self, ext): """ Return a mimetype for this document type, ideally the closest to the extension ext. """ mts = self._getMimeTypes(); @@ -51,7 +51,7 @@ return mts[0] return None - def indexContent(self,content,filename=None, realfile = None): + def indexContent(self, content, filename=None, realfile=None): """ Use either content or the real file, to index. Some parsers will work better with the actual content, others parse a file easier. Try the @@ -93,10 +93,10 @@ raise NhException('No appropriate method to index file') - def _doIndexContent(self,content): + def _doIndexContent(self, content): raise NhException("Content not handled here") - def _doIndexFile(self,fpath): + def _doIndexFile(self, fpath): raise NhException("Content not handled here") @@ -132,7 +132,7 @@ if not f: raise Exception("Your indexer should at least suport a mimetype or extension") - def doIndex(self,content, filename=None, content_type=None, realfname = None, debug=False): + def doIndex(self, content, filename=None, content_type=None, realfname=None, debug=False): fobj = None fname = None mime = None === modified file 'document/directory_content.py' --- document/directory_content.py 2010-02-24 10:55:29 +0000 +++ document/directory_content.py 2010-03-10 10:58:36 +0000 @@ -47,7 +47,7 @@ _name = 'document.directory.content' _description = 'Directory Content' _order = "sequence" - def _extension_get(self, cr, uid, context={}): + def _extension_get(self, cr, uid, context=None): cr.execute('select code,name from document_directory_content_type where active') res = cr.fetchall() return res === modified file 'document/document.py' --- document/document.py 2010-02-24 10:55:29 +0000 +++ document/document.py 2010-03-10 10:58:36 +0000 @@ -108,7 +108,7 @@ _sql_constraints = [ ('filename_uniq', 'unique (name,parent_id,res_id,res_model)', 'The file name must be unique !') ] - def _check_duplication(self, cr, uid, vals, ids=[], op='create'): + def _check_duplication(self, cr, uid, vals, ids=None, op='create'): name = vals.get('name', False) parent_id = vals.get('parent_id', False) res_model = vals.get('res_model', False) @@ -196,7 +196,7 @@ cr.commit() return result - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): stor = self.pool.get('document.storage') unres = [] # We have to do the unlink in 2 stages: prepare a list of actual === modified file 'document/document_directory.py' --- document/document_directory.py 2010-02-24 10:55:29 +0000 +++ document/document_directory.py 2010-03-10 10:58:36 +0000 @@ -61,7 +61,7 @@ help="Check this if you want to use the same tree structure as the object selected in the system."), 'dctx_ids': fields.one2many('document.directory.dctx', 'dir_id', 'Context fields'), } - def _get_root_directory(self, cr,uid, context=None): + def _get_root_directory(self, cr, uid, context=None): objid=self.pool.get('ir.model.data') try: mid = objid._get_id(cr, uid, 'document', 'dir_root') @@ -75,7 +75,7 @@ return None return objid.browse(cr, uid, mid, context=context).res_id - def _get_def_storage(self,cr,uid,context=None): + def _get_def_storage(self, cr, uid, context=None): if context and context.has_key('default_parent_id'): # Use the same storage as the parent.. diro = self.browse(cr,uid,context['default_parent_id']) @@ -100,7 +100,7 @@ ('dirname_uniq', 'unique (name,parent_id,ressource_id,ressource_parent_type_id)', 'The directory name must be unique !'), ('no_selfparent', 'check(parent_id <> id)', 'Directory cannot be parent of itself!') ] - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): res = [] for d in self.browse(cr, uid, ids, context=context): s = '' @@ -111,7 +111,7 @@ res.append((d.id, s)) return res - def ol_get_resource_path(self,cr,uid,dir_id,res_model,res_id): + def ol_get_resource_path(self, cr, uid, dir_id, res_model, res_id): # this method will be used in process module # to be need test and Improvement if resource dir has parent resource (link resource) path=[] @@ -182,7 +182,7 @@ raise - def _locate_child(self, cr,uid, root_id, uri,nparent, ncontext): + def _locate_child(self, cr, uid, root_id, uri, nparent, ncontext): """ try to locate the node in uri, Return a tuple (node_dir, remaining_path) """ @@ -243,7 +243,7 @@ oo2 = node.object2 and (node.object2._name, node.object2.id) or False return node - def ol_get_childs(self, cr, uid, uri, context={}): + def ol_get_childs(self, cr, uid, uri, context=None): node = self.get_object(cr, uid, uri, context) if uri: children = node.children() @@ -259,7 +259,7 @@ default.update({'name': name+ " (copy)"}) return super(document_directory,self).copy(cr,uid,id,default,context) - def _check_duplication(self, cr, uid,vals,ids=[],op='create'): + def _check_duplication(self, cr, uid, vals, ids=None, op='create'): name=vals.get('name',False) parent_id=vals.get('parent_id',False) ressource_parent_type_id=vals.get('ressource_parent_type_id',False) === modified file 'document/nodes.py' --- document/nodes.py 2010-02-24 10:55:29 +0000 +++ document/nodes.py 2010-03-10 10:58:36 +0000 @@ -58,7 +58,7 @@ assert self._dirobj self.rootdir = self._dirobj._get_root_directory(cr,uid,context) - def get_uri(self, cr, uri): + def get_uri(self, cr, uri): """ Although this fn passes back to doc.dir, it is needed since it is a potential caching point """ (ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self) @@ -74,7 +74,7 @@ """ A node representing the database directory Useless? """ - def __init__(self,ncontext): + def __init__(self, ncontext): self.nctx = ncontext @@ -122,7 +122,7 @@ print "node_class.children()" return [] #stub - def child(self,cr, name): + def child(self, cr, name): print "node_class.child()" return None @@ -130,26 +130,26 @@ print "node_class.path_get()" return False - def get_data(self,cr): + def get_data(self, cr): raise TypeError('no data for %s'% self.type) - def _get_storage(self,cr): + def _get_storage(self, cr): raise RuntimeError("no storage for base class") - def get_etag(self,cr): + def get_etag(self, cr): """ Get a tag, unique per object + modification. see. http://tools.ietf.org/html/rfc2616#section-13.3.3 """ return self._get_ttag(cr) + ':' + self._get_wtag(cr) - def _get_wtag(self,cr): + def _get_wtag(self, cr): """ Return the modification time as a unique, compact string """ if self.write_date: wtime = time.mktime(time.strptime(self.write_date,'%Y-%m-%d %H:%M:%S')) else: wtime = time.time() return str(wtime) - def _get_ttag(self,cr): + def _get_ttag(self, cr): """ Get a unique tag for this type/id of object. Must be overriden, so that each node is uniquely identified. """ @@ -161,12 +161,12 @@ its capabilities """ return {} - def get_dav_eprop(self,cr,ns,prop): + def get_dav_eprop(self, cr, ns, prop): return None class node_dir(node_class): our_type = 'collection' - def __init__(self,path, parent, context, dirr, dctx=None): + def __init__(self, path, parent, context, dirr, dctx=None): super(node_dir,self).__init__(path, parent,context) self.dir_id = dirr.id #todo: more info from dirr @@ -193,10 +193,10 @@ print e pass - def children(self,cr): + def children(self, cr): return self._child_get(cr) + self._file_get(cr) - def child(self,cr, name): + def child(self, cr, name): res = self._child_get(cr,name) if res: return res[0] @@ -205,7 +205,7 @@ return res[0] return None - def _file_get(self,cr, nodename=False): + def _file_get(self, cr, nodename=False): res = [] cntobj = self.context._dirobj.pool.get('document.directory.content') uid = self.context.uid @@ -234,7 +234,7 @@ break return res - def get_dav_eprop(self,cr,ns,prop): + def get_dav_eprop(self, cr, ns, prop): if ns != 'http://groupdav.org/' or prop != 'resourcetype': print "Who asked for %s:%s?" % (ns,prop) return None @@ -250,7 +250,7 @@ return ('vevent-collection','http://groupdav.org/') return None - def _child_get(self,cr,name = None): + def _child_get(self, cr, name=None): dirobj = self.context._dirobj uid = self.context.uid ctx = self.context.context.copy() @@ -277,7 +277,7 @@ return res - def create_child(self,cr,path,data): + def create_child(self, cr, path, data): """ API function to create a child file object and node Return the node_* created """ @@ -299,7 +299,7 @@ fnode.set_data(cr,data,fil) return fnode - def _get_ttag(self,cr): + def _get_ttag(self, cr): return 'dir-%d' % self.dir_id class node_res_dir(node_class): @@ -309,7 +309,7 @@ node_dirs (with limited domain). """ our_type = 'collection' - def __init__(self,path, parent, context, dirr, dctx=None ): + def __init__(self, path, parent, context, dirr, dctx=None ): super(node_res_dir,self).__init__(path, parent,context) self.dir_id = dirr.id #todo: more info from dirr @@ -335,16 +335,16 @@ for dfld in dirr.dctx_ids: self.dctx_dict['dctx_' + dfld.field] = dfld.expr - def children(self,cr): + def children(self, cr): return self._child_get(cr) - def child(self,cr, name): + def child(self, cr, name): res = self._child_get(cr,name) if res: return res[0] return None - def _child_get(self,cr,name = None): + def _child_get(self, cr, name=None): """ return virtual children of resource, based on the foreign object. @@ -389,7 +389,7 @@ res.append(node_res_obj(name, self.dir_id, self, self.context, self.res_model, bo)) return res - def _get_ttag(self,cr): + def _get_ttag(self, cr): return 'rdir-%d' % self.dir_id class node_res_obj(node_class): @@ -399,7 +399,7 @@ node_dirs (with limited domain). """ our_type = 'collection' - def __init__(self, path, dir_id, parent, context, res_model, res_bo, res_id = None): + def __init__(self, path, dir_id, parent, context, res_model, res_bo, res_id=None): super(node_res_obj,self).__init__(path, parent,context) assert parent #todo: more info from dirr @@ -431,10 +431,10 @@ else: self.res_id = res_id - def children(self,cr): + def children(self, cr): return self._child_get(cr) + self._file_get(cr) - def child(self,cr, name): + def child(self, cr, name): res = self._child_get(cr,name) if res: return res[0] @@ -443,7 +443,7 @@ return res[0] return None - def _file_get(self,cr, nodename=False): + def _file_get(self, cr, nodename=False): res = [] cntobj = self.context._dirobj.pool.get('document.directory.content') uid = self.context.uid @@ -474,7 +474,7 @@ res['http://groupdav.org/'] = ('resourcetype',) return res - def get_dav_eprop(self,cr,ns,prop): + def get_dav_eprop(self, cr, ns, prop): if ns != 'http://groupdav.org/' or prop != 'resourcetype': print "Who asked for %s:%s?" % (ns,prop) return None @@ -490,7 +490,7 @@ return ('vevent-collection','http://groupdav.org/') return None - def _child_get(self,cr,name = None): + def _child_get(self, cr, name=None): dirobj = self.context._dirobj uid = self.context.uid ctx = self.context.context.copy() @@ -553,7 +553,7 @@ res.append(node_res_dir(dirr.name, self, self.context, dirr, {'active_id': self.res_id})) return res - def create_child(self,cr,path,data): + def create_child(self, cr, path, data): """ API function to create a child file object and node Return the node_* created """ @@ -577,12 +577,12 @@ fnode.set_data(cr,data,fil) return fnode - def _get_ttag(self,cr): + def _get_ttag(self, cr): return 'rodir-%d-%d' % (self.dir_id,self.res_id) class node_file(node_class): our_type = 'file' - def __init__(self,path, parent, context, fil): + def __init__(self, path, parent, context, fil): super(node_file,self).__init__(path, parent,context) self.file_id = fil.id #todo: more info from ir_attachment @@ -601,7 +601,7 @@ self.storage_id = None - def get_data(self, cr, fil_obj = None): + def get_data(self, cr, fil_obj=None): """ Retrieve the data for some file. fil_obj may optionally be specified, and should be a browse object for the file. This is useful when the caller has already initiated @@ -617,14 +617,14 @@ stobj = self.context._dirobj.pool.get('document.storage') return stobj.get_data(cr,self.context.uid,stor, self,self.context.context, fil_obj) - def get_data_len(self, cr, fil_obj = None): + def get_data_len(self, cr, fil_obj=None): # TODO: verify with the storage object! bin_size = self.context.context.get('bin_size', False) if bin_size and not self.content_length: self.content_length = fil_obj.db_datas return self.content_length - def set_data(self, cr, data, fil_obj = None): + def set_data(self, cr, data, fil_obj=None): """ Store data at some file. fil_obj may optionally be specified, and should be a browse object for the file. This is useful when the caller has already initiated @@ -635,12 +635,12 @@ stobj = self.context._dirobj.pool.get('document.storage') return stobj.set_data(cr,self.context.uid,stor, self, data, self.context.context, fil_obj) - def _get_ttag(self,cr): + def _get_ttag(self, cr): return 'file-%d' % self.file_id class node_content(node_class): our_type = 'content' - def __init__(self,path, parent, context, cnt, dctx = None, act_id=None): + def __init__(self, path, parent, context, cnt, dctx=None, act_id=None): super(node_content,self).__init__(path, parent,context) self.cnt_id = cnt.id self.create_date = False @@ -654,7 +654,7 @@ self.dctx.update(dctx) self.act_id = act_id - def fill_fields(self,cr,dctx = None): + def fill_fields(self, cr, dctx=None): """ Try to read the object and fill missing fields, like mimetype, dates etc. This function must be different from the constructor, because @@ -668,7 +668,7 @@ self.mimetype = res[0][0] - def get_data(self, cr, fil_obj = None): + def get_data(self, cr, fil_obj=None): cntobj = self.context._dirobj.pool.get('document.directory.content') ctx = self.context.context.copy() ctx.update(self.dctx) @@ -677,23 +677,23 @@ self.content_length = len(data) return data - def get_data_len(self, cr, fil_obj = None): + def get_data_len(self, cr, fil_obj=None): if not self.content_length: self.get_data(cr,fil_obj) return self.content_length - def set_data(self, cr, data, fil_obj = None): + def set_data(self, cr, data, fil_obj=None): cntobj = self.context._dirobj.pool.get('document.directory.content') ctx = self.context.context.copy() ctx.update(self.dctx) return cntobj.process_write(cr,self.context.uid,self, data,ctx) - def _get_ttag(self,cr): + def _get_ttag(self, cr): return 'cnt-%d%s' % (self.cnt_id,(self.act_id and ('-' + str(self.act_id))) or '') class old_class(): # the old code, remove.. - def __init__(self, cr, uid, path, object, object2=False, context={}, content=False, type='collection', root=False): + def __init__(self, cr, uid, path, object, object2=False, context=None, content=False, type='collection', root=False): self.cr = cr def _file_get(self, nodename=False): if not self.object: @@ -721,7 +721,7 @@ res = fobj.browse(self.cr, self.uid, ids, context=self.context) return map(lambda x: node_class(self.cr, self.uid, self.path+'/'+eval('x.'+fobj._rec_name), x, False, context=self.context, type='file', root=False), res) + res2 - def get_translation(self,value,lang): + def get_translation(self, value, lang): # Must go, it works on arbitrary models and could be ambiguous. result = value pool = pooler.get_pool(self.cr.dbname) @@ -736,7 +736,7 @@ result = res[field_name] return result - def directory_list_for_child(self,nodename,parent=False): + def directory_list_for_child(self, nodename, parent=False): pool = pooler.get_pool(self.cr.dbname) where = [] if nodename: === modified file 'document/odt2txt.py' --- document/odt2txt.py 2010-02-24 10:55:29 +0000 +++ document/odt2txt.py 2010-03-10 10:58:36 +0000 @@ -24,11 +24,11 @@ import StringIO class OpenDocumentTextFile : - def __init__ (self, filepath) : + def __init__ (self, filepath): zip = zipfile.ZipFile(filepath) self.content = xml.dom.minidom.parseString(zip.read("content.xml")) - def toString (self) : + def toString (self): """ Converts the document to a string. """ buffer = u"" for val in ["text:p", "text:h", "text:list"]: @@ -36,7 +36,7 @@ buffer += self.textToString(paragraph) + "\n" return buffer - def textToString(self, element) : + def textToString(self, element): buffer = u"" for node in element.childNodes : if node.nodeType == xml.dom.Node.TEXT_NODE : === modified file 'document/std_index.py' --- document/std_index.py 2010-02-24 10:55:29 +0000 +++ document/std_index.py 2010-03-10 10:58:36 +0000 @@ -45,7 +45,7 @@ def _getExtensions(self): return ['.txt', '.py'] - def _doIndexContent(self,content): + def _doIndexContent(self, content): return content cntIndex.register(TxtIndex()) @@ -57,7 +57,7 @@ def _getExtensions(self): return ['.doc'] - def _doIndexFile(self,fname): + def _doIndexFile(self, fname): fp = Popen(['antiword',fname], shell=False, stdout=PIPE).stdout return _to_unicode( fp.read()) @@ -70,7 +70,7 @@ def _getExtensions(self): return ['.pdf'] - def _doIndexFile(self,fname): + def _doIndexFile(self, fname): fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout return _to_unicode( fp.read()) @@ -85,7 +85,7 @@ return [] #return ['.png','.jpg','.gif','.jpeg','.bmp','.tiff'] - def _doIndexContent(self,content): + def _doIndexContent(self, content): return 'image' === modified file 'document/test_cindex.py' (properties changed: +x to -x) === modified file 'document_ftp/ftpserver/abstracted_fs.py' --- document_ftp/ftpserver/abstracted_fs.py 2010-02-24 10:55:29 +0000 +++ document_ftp/ftpserver/abstracted_fs.py 2010-03-10 10:58:43 +0000 @@ -202,7 +202,7 @@ return res # Ok - def fs2ftp(self, node): + def fs2ftp(self, node): res='/' if node: paths = node.full_path() @@ -375,7 +375,7 @@ # Ok - def chdir(self, path): + def chdir(self, path): if not path: self.cwd = '/' return None === modified file 'document_webdav/DAV/BufferingHTTPServer.py' --- document_webdav/DAV/BufferingHTTPServer.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/BufferingHTTPServer.py 2010-03-10 10:58:53 +0000 @@ -50,7 +50,7 @@ self.__buffer="" self.__outfp=os.tmpfile() - def _append(self,s): + def _append(self, s): """ append a string to the buffer """ self.__buffer=self.__buffer+s === modified file 'document_webdav/DAV/WebDAVServer.py' --- document_webdav/DAV/WebDAVServer.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/WebDAVServer.py 2010-03-10 10:58:53 +0000 @@ -74,11 +74,11 @@ def _log(self, message): pass - def _append(self,s): + def _append(self, s): """ write the string to wfile """ self.wfile.write(s) - def send_body(self,DATA,code,msg,desc,ctype='application/octet-stream',headers=None): + def send_body(self, DATA, code, msg, desc, ctype='application/octet-stream', headers=None): """ send a body in one part """ if not headers: @@ -100,7 +100,7 @@ if DATA: self._append(DATA) - def send_body_chunks(self,DATA,code,msg,desc,ctype='text/xml; encoding="utf-8"'): + def send_body_chunks(self, DATA, code, msg, desc, ctype='text/xml; encoding="utf-8"'): """ send a body in chunks """ self.responses[207]=(msg,desc) @@ -301,7 +301,7 @@ except DAV_Error, (ec,dd): self.send_status(ec) - def copymove(self,CLASS): + def copymove(self, CLASS): """ common method for copying or moving objects """ dc=self.IFACE_CLASS @@ -357,7 +357,7 @@ else: self.send_status(result_code) - def get_userinfo(self,user,pw): + def get_userinfo(self, user, pw): """ Dummy method which lets all users in """ return 1 @@ -368,7 +368,7 @@ if not msg: msg=STATUS_CODES[code] self.send_body(body,code,STATUS_CODES[code],msg,mediatype) - def send_notFound(self,descr,uri): + def send_notFound(self, descr, uri): body = """ %s === modified file 'document_webdav/DAV/davcmd.py' --- document_webdav/DAV/davcmd.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/davcmd.py 2010-03-10 10:58:52 +0000 @@ -14,7 +14,7 @@ from utils import create_treelist, is_prefix from errors import * -def deltree(dc,uri,exclude={}): +def deltree(dc, uri, exclude=None): """ delete a tree of resources dc -- dataclass to use @@ -66,7 +66,7 @@ return result -def delone(dc,uri): +def delone(dc, uri): """ delete a single object """ if dc.is_collection(uri): dc.rmcol(uri) # should be empty @@ -79,7 +79,7 @@ # helper function -def copy(dc,src,dst): +def copy(dc, src, dst): """ only copy the element This is just a helper method factored out from copy and @@ -101,7 +101,7 @@ # the main functions -def copyone(dc,src,dst,overwrite=None): +def copyone(dc, src, dst, overwrite=None): """ copy one resource to a new destination """ if overwrite and dc.exists(dst): @@ -117,7 +117,7 @@ except DAV_Error, (ec,dd): return ec -def copytree(dc,src,dst,overwrite=None): +def copytree(dc, src, dst, overwrite=None): """ copy a tree of resources to another location dc -- dataclass to use @@ -185,7 +185,7 @@ ### -def moveone(dc,src,dst,overwrite=None): +def moveone(dc, src, dst, overwrite=None): """ move a single resource This is done by first copying it and then deleting @@ -198,7 +198,7 @@ # then delete it dc.rm(src) -def movetree(dc,src,dst,overwrite=None): +def movetree(dc, src, dst, overwrite=None): """ move a collection This is done by first copying it and then deleting === modified file 'document_webdav/DAV/davcopy.py' (properties changed: +x to -x) --- document_webdav/DAV/davcopy.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/davcopy.py 2010-03-10 10:58:53 +0000 @@ -47,7 +47,7 @@ """ - def __init__(self,dataclass,src_uri,dst_uri,overwrite): + def __init__(self, dataclass, src_uri, dst_uri, overwrite): self.__dataclass=dataclass self.__src=src_uri self.__dst=dst_uri === modified file 'document_webdav/DAV/davmove.py' (properties changed: +x to -x) --- document_webdav/DAV/davmove.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/davmove.py 2010-03-10 10:58:53 +0000 @@ -47,7 +47,7 @@ """ - def __init__(self,dataclass,src_uri,dst_uri,overwrite): + def __init__(self, dataclass, src_uri, dst_uri, overwrite): self.__dataclass=dataclass self.__src=src_uri self.__dst=dst_uri === modified file 'document_webdav/DAV/delete.py' (properties changed: +x to -x) --- document_webdav/DAV/delete.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/delete.py 2010-03-10 10:58:53 +0000 @@ -32,7 +32,7 @@ class DELETE: - def __init__(self,uri,dataclass): + def __init__(self, uri, dataclass): self.__dataclass=dataclass self.__uri=uri === modified file 'document_webdav/DAV/errors.py' (properties changed: +x to -x) --- document_webdav/DAV/errors.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/errors.py 2010-03-10 10:58:52 +0000 @@ -12,7 +12,7 @@ 2. the error result element, e.g. a element """ - def __init__(self,*args): + def __init__(self, *args): if len(args)==1: self.args=(args[0],"") else: @@ -32,7 +32,7 @@ class DAV_NotFound(DAV_Error): """ a requested property was not found for a resource """ - def __init__(self,*args): + def __init__(self, *args): if len(args): if isinstance(args[0],list): stre = "Path %s not found!"%('/'.join(args[0])) @@ -47,7 +47,7 @@ class DAV_Forbidden(DAV_Error): """ a method on a resource is not allowed """ - def __init__(self,*args): + def __init__(self, *args): if len(args): DAV_Error.__init__(self,403,args[0]) else: === modified file 'document_webdav/DAV/iface.py' --- document_webdav/DAV/iface.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/iface.py 2010-03-10 10:58:53 +0000 @@ -39,7 +39,7 @@ M_NS={"DAV:" : "_get_dav", "NS2" : "ns2" } - def get_propnames(self,uri): + def get_propnames(self, uri): """ return the property names allowed for the given URI In this method we simply return the above defined properties @@ -50,14 +50,14 @@ """ return self.PROPS - def get_prop2(self,uri,ns,pname): + def get_prop2(self, uri, ns, pname): """ return the value of a property """ if lower(ns)=="dav:": return self.get_dav(uri,pname) raise DAV_NotFound - def get_prop(self,uri,ns,propname): + def get_prop(self, uri, ns, propname): """ return the value of a given property uri -- uri of the object to get the property of @@ -86,7 +86,7 @@ ### DATA methods (for GET and PUT) ### - def get_data(self,uri): + def get_data(self, uri): """ return the content of an object return data or raise an exception @@ -94,7 +94,7 @@ """ raise DAV_NotFound - def put(self,uri,data): + def put(self, uri, data): """ write an object to the repository return a result code or raise an exception @@ -106,7 +106,7 @@ ### Methods for DAV properties ### - def _get_dav_creationdate(self,uri): + def _get_dav_creationdate(self, uri): """ return the creationdate of a resource """ d=self.get_creationdate(uri) # format it @@ -114,7 +114,7 @@ d = time.localtimetime(d) return time.strftime("%Y-%m-%dT%H:%M:%S%Z",d) - def _get_dav_getlastmodified(self,uri): + def _get_dav_getlastmodified(self, uri): """ return the last modified date of a resource """ d=self.get_lastmodified(uri) if isinstance(d, int) or isinstance(d, float): @@ -127,11 +127,11 @@ ### OVERRIDE THESE! ### - def get_creationdate(self,uri): + def get_creationdate(self, uri): """ return the creationdate of the resource """ return time.time() - def get_lastmodified(self,uri): + def get_lastmodified(self, uri): """ return the last modification date of the resource """ return time.time() @@ -142,7 +142,7 @@ ### methods for deleting a resource - def rmcol(self,uri): + def rmcol(self, uri): """ delete a collection This should not delete any children! This is automatically done @@ -153,7 +153,7 @@ """ raise DAV_NotFound - def rm(self,uri): + def rm(self, uri): """ delete a single resource return a success code or raise an exception @@ -210,27 +210,27 @@ ### MOVE handlers - def moveone(self,src,dst,overwrite): + def moveone(self, src, dst, overwrite): """ move one resource with Depth=0 """ return moveone(self,src,dst,overwrite) - def movetree(self,src,dst,overwrite): + def movetree(self, src, dst, overwrite): """ move a collection with Depth=infinity """ return movetree(self,src,dst,overwrite) ### COPY handlers - def copyone(self,src,dst,overwrite): + def copyone(self, src, dst, overwrite): """ copy one resource with Depth=0 """ return copyone(self,src,dst,overwrite) - def copytree(self,src,dst,overwrite): + def copytree(self, src, dst, overwrite): """ copy a collection with Depth=infinity """ return copytree(self,src,dst,overwrite) ### low level copy methods (you only need these for method 2) - def copy(self,src,dst): + def copy(self, src, dst): """ copy a resource with depth==0 You don't need to bother about overwrite or not. @@ -241,7 +241,7 @@ return 201 - def copycol(self,src,dst): + def copycol(self, src, dst): """ copy a resource with depth==infinity You don't need to bother about overwrite or not. @@ -253,11 +253,11 @@ ### some utility functions you need to implement - def exists(self,uri): + def exists(self, uri): """ return 1 or None depending on if a resource exists """ return None # no - def is_collection(self,uri): + def is_collection(self, uri): """ return 1 or None depending on if a resource is a collection """ return None # no === modified file 'document_webdav/DAV/propfind.py' (properties changed: +x to -x) --- document_webdav/DAV/propfind.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/propfind.py 2010-03-10 10:58:53 +0000 @@ -56,7 +56,7 @@ """ - def __init__(self,uri,dataclass,depth): + def __init__(self, uri, dataclass, depth): self.request_type=None self.nsmap={} self.proplist={} @@ -67,7 +67,7 @@ self.use_full_urls=True self.__has_body=None # did we parse a body? - def read_propfind(self,xml_doc): + def read_propfind(self, xml_doc): self.request_type,self.proplist,self.namespaces=utils.parse_propfind(xml_doc) # a violation of the expected logic: client (korganizer) will ask for DAV:resourcetype @@ -208,7 +208,7 @@ return s - def mk_propname_response(self,uri,propnames,doc): + def mk_propname_response(self, uri, propnames, doc): """ make a new result element for a PROPNAME request This will simply format the propnames list. @@ -249,7 +249,7 @@ return re - def mk_prop_response(self,uri,good_props,bad_props,doc): + def mk_prop_response(self, uri, good_props, bad_props, doc): """ make a new result element We differ between the good props and the bad ones for @@ -333,7 +333,7 @@ # return the new response element return re - def get_propvalues(self,uri): + def get_propvalues(self, uri): """ create lists of property values for an URI We create two lists for an URI: the properties for === modified file 'document_webdav/DAV/utils.py' (properties changed: +x to -x) --- document_webdav/DAV/utils.py 2010-02-24 10:55:29 +0000 +++ document_webdav/DAV/utils.py 2010-03-10 10:58:53 +0000 @@ -73,7 +73,7 @@ return request_type,props,namespaces -def create_treelist(dataclass,uri): +def create_treelist(dataclass, uri): """ create a list of resources out of a tree This function is used for the COPY, MOVE and DELETE methods @@ -99,7 +99,7 @@ queue=queue+childs return list -def is_prefix(uri1,uri2): +def is_prefix(uri1, uri2): """ returns 1 of uri1 is a prefix of uri2 """ if uri2[:len(uri1)]==uri1: return 1 === modified file 'document_webdav/dav_fs.py' --- document_webdav/dav_fs.py 2010-02-24 10:55:29 +0000 +++ document_webdav/dav_fs.py 2010-03-10 10:58:53 +0000 @@ -63,14 +63,14 @@ M_NS={ "DAV:" : dav_interface.M_NS['DAV:'], } - def __init__(self, parent, verbose=False): + def __init__(self, parent, verbose=False): self.db_name = False self.directory_id=False self.db_name_list=[] self.parent = parent self.baseuri = parent.baseuri - def get_propnames(self,uri): + def get_propnames(self, uri): props = self.PROPS self.parent.log_message('get propnames: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -84,7 +84,7 @@ cr.close() return props - def get_prop(self,uri,ns,propname): + def get_prop(self, uri, ns, propname): """ return the value of a given property uri -- uri of the object to get the property of @@ -118,10 +118,10 @@ # return self.db_name # - def later_get_db_from_path(self,path): + def later_get_db_from_path(self, path): return "aaa" - def urijoin(self,*ajoin): + def urijoin(self, *ajoin): """ Return the base URI of this request, or even join it with the ajoin path elements """ @@ -142,7 +142,7 @@ cr.close() return self.db_name_list - def get_childs(self,uri): + def get_childs(self, uri): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get childs: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -183,7 +183,7 @@ # # pos: -1 to get the parent of the uri # - def get_cr(self, uri): + def get_cr(self, uri): pdb = self.parent.auth_proxy.last_auth reluri = self.uri2local(uri) try: @@ -203,12 +203,12 @@ uri2 = reluri.split('/')[3:] return cr, uid, pool, dbname, uri2 - def uri2object(self, cr,uid, pool,uri): + def uri2object(self, cr, uid, pool, uri): if not uid: return None return pool.get('document.directory').get_object(cr, uid, uri) - def get_data(self,uri): + def get_data(self, uri): self.parent.log_message('GET: %s' % uri) if uri[-1]=='/':uri=uri[:-1] cr, uid, pool, dbname, uri2 = self.get_cr(uri) @@ -238,7 +238,7 @@ cr.close() @memoize(CACHE_SIZE) - def _get_dav_resourcetype(self,uri): + def _get_dav_resourcetype(self, uri): """ return type of object """ self.parent.log_message('get RT: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -255,7 +255,7 @@ finally: cr.close() - def _get_dav_displayname(self,uri): + def _get_dav_displayname(self, uri): self.parent.log_message('get DN: %s' % uri) if uri[-1]=='/':uri=uri[:-1] cr, uid, pool, dbname, uri2 = self.get_cr(uri) @@ -270,7 +270,7 @@ return node.displayname @memoize(CACHE_SIZE) - def _get_dav_getcontentlength(self,uri): + def _get_dav_getcontentlength(self, uri): """ return the content length of an object """ self.parent.log_message('get length: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -288,7 +288,7 @@ return str(result) @memoize(CACHE_SIZE) - def _get_dav_getetag(self,uri): + def _get_dav_getetag(self, uri): """ return the ETag of an object """ self.parent.log_message('get etag: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -306,7 +306,7 @@ return str(result) @memoize(CACHE_SIZE) - def get_lastmodified(self,uri): + def get_lastmodified(self, uri): """ return the last modified date of the object """ if uri[-1]=='/':uri=uri[:-1] today = time.time() @@ -325,7 +325,7 @@ cr.close() @memoize(CACHE_SIZE) - def get_creationdate(self,uri): + def get_creationdate(self, uri): """ return the last modified date of the object """ if uri[-1]=='/':uri=uri[:-1] @@ -345,7 +345,7 @@ cr.close() @memoize(CACHE_SIZE) - def _get_dav_getcontenttype(self,uri): + def _get_dav_getcontenttype(self, uri): self.parent.log_message('get contenttype: %s' % uri) if uri[-1]=='/':uri=uri[:-1] cr, uid, pool, dbname, uri2 = self.get_cr(uri) @@ -361,7 +361,7 @@ finally: cr.close() - def mkcol(self,uri): + def mkcol(self, uri): """ create a new collection """ self.parent.log_message('MKCOL: %s' % uri) if uri[-1]=='/':uri=uri[:-1] @@ -399,7 +399,7 @@ cr.close() return True - def put(self,uri,data,content_type=None): + def put(self, uri, data, content_type=None): """ put the object into the filesystem """ self.parent.log_message('Putting %s (%d), %s'%( misc.ustr(uri), len(data), content_type)) parent='/'.join(uri.split('/')[:-1]) @@ -437,7 +437,7 @@ cr.close() return 201 - def rmcol(self,uri): + def rmcol(self, uri): """ delete a collection """ if uri[-1]=='/':uri=uri[:-1] @@ -460,7 +460,7 @@ cr.close() return 204 - def rm(self,uri): + def rm(self, uri): if uri[-1]=='/':uri=uri[:-1] object=False @@ -487,7 +487,7 @@ ### a rm directly ### - def delone(self,uri): + def delone(self, uri): """ delete a single resource You have to return a result dict of the form @@ -500,7 +500,7 @@ parent='/'.join(uri.split('/')[:-1]) return res - def deltree(self,uri): + def deltree(self, uri): """ delete a collection You have to return a result dict of the form @@ -517,7 +517,7 @@ ### MOVE handlers (examples) ### - def moveone(self,src,dst,overwrite): + def moveone(self, src, dst, overwrite): """ move one resource with Depth=0 an alternative implementation would be @@ -537,7 +537,7 @@ res=moveone(self,src,dst,overwrite) return res - def movetree(self,src,dst,overwrite): + def movetree(self, src, dst, overwrite): """ move a collection with Depth=infinity an alternative implementation would be @@ -561,7 +561,7 @@ ### COPY handlers ### - def copyone(self,src,dst,overwrite): + def copyone(self, src, dst, overwrite): """ copy one resource with Depth=0 an alternative implementation would be @@ -581,7 +581,7 @@ res=copyone(self,src,dst,overwrite) return res - def copytree(self,src,dst,overwrite): + def copytree(self, src, dst, overwrite): """ copy a collection with Depth=infinity an alternative implementation would be @@ -608,7 +608,7 @@ ### Look in davcmd.py for further details. ### - def copy(self,src,dst): + def copy(self, src, dst): src=urllib.unquote(src) dst=urllib.unquote(dst) ct = self._get_dav_getcontenttype(src) @@ -616,7 +616,7 @@ self.put(dst,data,ct) return 201 - def copycol(self,src,dst): + def copycol(self, src, dst): """ copy a collection. As this is not recursive (the davserver recurses itself) @@ -628,7 +628,7 @@ return self.mkcol(dst) - def exists(self,uri): + def exists(self, uri): """ test if a resource exists """ result = False cr, uid, pool,dbname, uri2 = self.get_cr(uri) @@ -645,6 +645,6 @@ return result @memoize(CACHE_SIZE) - def is_collection(self,uri): + def is_collection(self, uri): """ test if the given uri is a collection """ return self._get_dav_resourcetype(uri)==COLLECTION === modified file 'document_webdav/webdav_server.py' --- document_webdav/webdav_server.py 2010-02-24 10:55:29 +0000 +++ document_webdav/webdav_server.py 2010-03-10 10:58:53 +0000 @@ -36,7 +36,7 @@ class DAVHandler(FixSendError,DAVRequestHandler): verbose = False - def get_userinfo(self,user,pw): + def get_userinfo(self, user, pw): print "get_userinfo" return False def _log(self, message): === modified file 'event/event.py' --- event/event.py 2010-02-24 10:55:29 +0000 +++ event/event.py 2010-03-10 10:59:03 +0000 @@ -56,16 +56,16 @@ def copy(self, cr, uid, id, default=None, context=None): return super(event, self).copy(cr, uid,id, default={'code': self.pool.get('ir.sequence').get(cr, uid, 'event.event'),'state':'draft'}) - def button_draft(self, cr, uid, ids, context={}): + def button_draft(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state':'draft'}) - def button_cancel(self, cr, uid, ids, context={}): + def button_cancel(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state':'cancel'}) - def button_done(self, cr, uid, ids, context={}): + def button_done(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state':'done'}) - def button_confirm(self, cr, uid, ids, context={}): + def button_confirm(self, cr, uid, ids, context=None): for eve in self.browse(cr, uid, ids): if eve.mail_auto_confirm: #send reminder that will confirm the event for all the people that were already confirmed @@ -98,7 +98,7 @@ res[event.id] = 0 return res - def write(self, cr, uid, ids,vals, *args, **kwargs): + def write(self, cr, uid, ids, vals, *args, **kwargs): res = super(event,self).write(cr, uid, ids,vals, *args, **kwargs) if 'date_begin' in vals and vals['date_begin']: for eve in self.browse(cr, uid, ids): @@ -151,7 +151,7 @@ class event_registration(osv.osv): - def _history(self, cr, uid,ids,keyword, history=False, email=False, context={}): + def _history(self, cr, uid, ids, keyword, history=False, email=False, context=None): for case in self.browse(cr, uid, ids): if not case.case_id: return True @@ -193,7 +193,7 @@ args[1]['description']= event.mail_confirm return super(event_registration, self).write(cr, uid, *args, **argv) - def mail_user_confirm(self,cr,uid,ids): + def mail_user_confirm(self, cr, uid, ids): reg_ids=self.browse(cr,uid,ids) for reg_id in reg_ids: src = reg_id.event_id.reply_to or False @@ -206,7 +206,7 @@ raise osv.except_osv(_('Error!'), _('You must define a reply-to address in order to mail the participant. You can do this in the Mailing tab of your event. Note that this is also the place where you can configure your event to not send emails automaticly while registering')) return False - def mail_user(self,cr,uid,ids): + def mail_user(self, cr, uid, ids): reg_ids=self.browse(cr,uid,ids) for reg_id in reg_ids: src = reg_id.event_id.reply_to or False @@ -340,13 +340,13 @@ return {'value':data} return {'value':data} - def onchange_categ_id(self, cr, uid, ids, categ, context={}): + def onchange_categ_id(self, cr, uid, ids, categ, context=None): if not categ: return {'value':{}} cat = self.pool.get('crm.case.categ').browse(cr, uid, categ, context).probability return {'value':{'probability':cat}} - def _map_ids(self,method,cr, uid, ids, *args, **argv): + def _map_ids(self, method, cr, uid, ids, *args, **argv): case_data = self.browse(cr,uid,ids) new_ids=[] for case in case_data: @@ -355,27 +355,27 @@ return getattr(self.pool.get('crm.case'),method)(cr, uid, new_ids, *args, **argv) - def case_close(self,cr, uid, ids, *args, **argv): + def case_close(self, cr, uid, ids, *args, **argv): return self._map_ids('case_close',cr,uid,ids,*args,**argv) def case_escalate(self,cr, uid, ids, *args, **argv): return self._map_ids('case_escalate',cr,uid,ids,*args,**argv) - def case_open(self,cr, uid, ids, *args, **argv): + def case_open(self, cr, uid, ids, *args, **argv): return self._map_ids('case_open',cr,uid,ids,*args,**argv) def case_cancel(self,cr, uid, ids, *args, **argv): return self._map_ids('case_cancel',cr,uid,ids,*args,**argv) - def case_pending(self,cr, uid, ids, *args, **argv): + def case_pending(self, cr, uid, ids, *args, **argv): return self._map_ids('case_pending',cr,uid,ids,*args,**argv) def case_reset(self,cr, uid, ids, *args, **argv): return self._map_ids('case_reset',cr,uid,ids,*args,**argv) - def case_log(self,cr, uid, ids, *args, **argv): + def case_log(self, cr, uid, ids, *args, **argv): return self._map_ids('case_log',cr,uid,ids,*args,**argv) def case_log_reply(self,cr, uid, ids, *args, **argv): return self._map_ids('case_log_reply',cr,uid,ids,*args,**argv) - def add_reply(self,cr, uid, ids, *args, **argv): + def add_reply(self, cr, uid, ids, *args, **argv): return self._map_ids('add_reply',cr,uid,ids,*args,**argv) def remind_partner(self,cr, uid, ids, *args, **argv): return self._map_ids('remind_partner',cr,uid,ids,*args,**argv) - def remind_user(self,cr, uid, ids, *args, **argv): + def remind_user(self, cr, uid, ids, *args, **argv): return self._map_ids('remind_user',cr,uid,ids,*args,**argv) === modified file 'event_project/event.py' --- event_project/event.py 2010-02-24 10:55:29 +0000 +++ event_project/event.py 2010-03-10 10:58:51 +0000 @@ -47,7 +47,7 @@ class event(osv.osv): _inherit = 'event.event' - def write(self, cr, uid, ids,vals, *args, **kwargs): + def write(self, cr, uid, ids, vals, *args, **kwargs): if 'date_begin' in vals and vals['date_begin']: for eve in self.browse(cr, uid, ids): if eve.project_id: === modified file 'hr/hr.py' (properties changed: +x to -x) --- hr/hr.py 2010-03-05 17:51:47 +0000 +++ hr/hr.py 2010-03-10 10:58:59 +0000 @@ -58,7 +58,7 @@ hr_employee_marital_status() class hr_job(osv.osv): - def _no_of_employee(self, cr, uid, ids, name,args,context=None): + def _no_of_employee(self, cr, uid, ids, name, args, context=None): res = {} for emp in self.browse(cr, uid, ids): res[emp.id] = len(emp.employee_ids or []) === modified file 'hr/hr_department.py' --- hr/hr_department.py 2010-02-24 10:55:29 +0000 +++ hr/hr_department.py 2010-03-10 10:58:59 +0000 @@ -51,7 +51,7 @@ 'manager_id': fields.many2one('res.users', 'Manager', required=True), 'member_ids': fields.many2many('res.users', 'hr_department_user_rel', 'department_id', 'user_id', 'Members'), } - def _get_members(self,cr, uid, context={}): + def _get_members(self, cr, uid, context=None): mids = self.search(cr, uid, [('manager_id','=',uid)]) result = {uid:1} for m in self.browse(cr, uid, mids, context): @@ -103,7 +103,7 @@ _inherit = 'res.users' _description = 'res.users' - def _parent_compute(self, cr, uid, ids, name, args, context={}): + def _parent_compute(self, cr, uid, ids, name, args, context=None): result = {} obj_dept = self.pool.get('hr.department') for user_id in ids: @@ -125,7 +125,7 @@ return [('id', 'in', [0])] return [('id', 'in', child_ids.get(uid,[]))] - def _child_compute(self, cr, uid, ids, name, args, context={}): + def _child_compute(self, cr, uid, ids, name, args, context=None): obj_dept = self.pool.get('hr.department') obj_user = self.pool.get('res.users') result = {} === modified file 'hr_attendance/hr_attendance.py' --- hr_attendance/hr_attendance.py 2010-02-24 10:55:29 +0000 +++ hr_attendance/hr_attendance.py 2010-03-10 10:58:59 +0000 @@ -37,7 +37,7 @@ } hr_action_reason() -def _employee_get(obj,cr,uid,context={}): +def _employee_get(obj, cr, uid, context=None): ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) if ids: return ids[0] @@ -82,7 +82,7 @@ _inherit = "hr.employee" _description = "Employee" - def _state(self, cr, uid, ids, name, args, context={}): + def _state(self, cr, uid, ids, name, args, context=None): result = {} for id in ids: result[id] = 'absent' @@ -105,12 +105,12 @@ 'state': fields.function(_state, method=True, type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], string='Attendance'), } - def _action_check(self, cr, uid, emp_id, dt=False,context={}): + def _action_check(self, cr, uid, emp_id, dt=False, context=None): 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={}, dt=False, *args): + def attendance_action_change(self, cr, uid, ids, type='action', context=None, dt=False, *args): id = False warning_sign = 'sign' === modified file 'hr_evaluation/hr_evaluation.py' --- hr_evaluation/hr_evaluation.py 2010-03-05 12:21:31 +0000 +++ hr_evaluation/hr_evaluation.py 2010-03-10 10:59:00 +0000 @@ -81,7 +81,7 @@ 'evaluation_date': fields.date('Next Evaluation', help="Date of the next evaluation"), } - def onchange_evaluation_plan_id(self,cr,uid,ids,evaluation_plan_id,context={}): + def onchange_evaluation_plan_id(self, cr, uid, ids, evaluation_plan_id, context=None): evaluation_date = self.browse(cr, uid, ids)[0].evaluation_date or '' evaluation_plan_obj=self.pool.get('hr_evaluation.plan') if evaluation_plan_id: @@ -128,7 +128,7 @@ 'state' : lambda *a: 'draft', } - def onchange_employee_id(self,cr,uid,ids,employee_id,context={}): + def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): employee_obj=self.pool.get('hr.employee') evaluation_plan_id='' if employee_id: @@ -138,7 +138,7 @@ employee_ids=employee_obj.search(cr,uid,[('parent_id','=',employee.id)]) return {'value': {'plan_id':evaluation_plan_id}} - def button_plan_in_progress(self,cr, uid, ids, context): + def button_plan_in_progress(self, cr, uid, ids, context): employee_obj = self.pool.get('hr.employee') hr_eval_inter_obj = self.pool.get('hr.evaluation.interview') survey_request_obj = self.pool.get('survey.request') @@ -188,7 +188,7 @@ self.write(cr,uid,ids,{'state':'wait'}) return True - def button_final_validation(self,cr, uid, ids, context): + def button_final_validation(self, cr, uid, ids, context): self.write(cr,uid,ids,{'state':'progress'}) request_obj = self.pool.get('hr.evaluation.interview') for id in self.browse(cr, uid ,ids): @@ -196,11 +196,11 @@ raise osv.except_osv(_('Warning !'),_("You cannot change state, because some appraisal in waiting answer or draft state")) return True - def button_done(self,cr, uid, ids, context): + def button_done(self, cr, uid, ids, context): self.write(cr,uid,ids,{'state':'done', 'date_close': time.strftime('%Y-%m-%d')}) return True - def button_cancel(self,cr, uid, ids, context): + def button_cancel(self, cr, uid, ids, context): self.write(cr,uid,ids,{'state':'cancel'}) return True @@ -265,4 +265,4 @@ self.write(cr, uid, ids, { 'state' : 'cancel'}) return True -hr_evaluation_interview() \ No newline at end of file +hr_evaluation_interview() === modified file 'hr_expense/hr_expense.py' --- hr_expense/hr_expense.py 2010-02-24 10:55:29 +0000 +++ hr_expense/hr_expense.py 2010-03-10 10:58:49 +0000 @@ -25,14 +25,14 @@ from osv import fields, osv from tools.translate import _ -def _employee_get(obj,cr,uid,context={}): +def _employee_get(obj, cr, uid, context=None): ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) if ids: return ids[0] return False class hr_expense_expense(osv.osv): - def copy(self, cr, uid, id, default=None, context={}): + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} default.update( {'invoice_id':False,'date_confirm':False,'date_valid':False,'user_valid':False}) return super(hr_expense_expense, self).copy(cr, uid, id, default, context) @@ -212,7 +212,7 @@ 'date_value' : lambda *a: time.strftime('%Y-%m-%d'), } _order = "sequence" - def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context={}): + def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None): v={} if product_id: product=self.pool.get('product.product').browse(cr,uid,product_id, context=context) === modified file 'hr_holidays/hr.py' (properties changed: +x to -x) --- hr_holidays/hr.py 2010-02-24 10:55:29 +0000 +++ hr_holidays/hr.py 2010-03-10 10:58:48 +0000 @@ -32,7 +32,7 @@ class hr_holidays_status(osv.osv): _name = "hr.holidays.status" _description = "Leave Types" - def get_days(self, cr, uid, ids, employee_id, return_false, context={}): + def get_days(self, cr, uid, ids, employee_id, return_false, context=None): res = {} for record in self.browse(cr, uid, ids, context): res[record.id] = {} @@ -53,7 +53,9 @@ res[record.id]['remaining_leaves'] = max_leaves - leaves_taken return res - def _user_left_days(self, cr, uid, ids, name, args, context={}): + def _user_left_days(self, cr, uid, ids, name, args, context=None): + if context is None: + context = {} res = {} return_false = False if context and context.has_key('employee_id'): @@ -91,7 +93,7 @@ _description = "Holidays Per User" _rec_name = "user_id" - def _get_remaining_leaves(self, cr, uid, ids, field_name, arg=None, context={}): + def _get_remaining_leaves(self, cr, uid, ids, field_name, arg=None, context=None): obj_holiday = self.pool.get('hr.holidays') result = {} for holiday_user in self.browse(cr, uid, ids): @@ -133,7 +135,7 @@ _description = "Holidays" _order = "type desc, date_from asc" - def _employee_get(obj,cr,uid,context={}): + def _employee_get(obj, cr, uid, context=None): ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) if ids: return ids[0] @@ -214,7 +216,7 @@ self._create_holiday(cr, uid, [id_holiday]) return id_holiday - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): self._update_user_holidays(cr, uid, ids) return super(hr_holidays, self).unlink(cr, uid, ids, context) @@ -245,7 +247,7 @@ } return result - def onchange_sec_id(self, cr, uid, ids, status, context={}): + def onchange_sec_id(self, cr, uid, ids, status, context=None): warning = {} if status: brows_obj = self.pool.get('hr.holidays.status').browse(cr, uid, [status])[0] @@ -335,7 +337,7 @@ }) return True - def check_holidays(self,cr,uid,ids): + def check_holidays(self, cr, uid, ids): for record in self.browse(cr, uid, ids): if not record.number_of_days: raise osv.except_osv(_('Warning!'),_('Wrong leave definition.')) === modified file 'hr_holidays/report/holidays_summary_report.py' --- hr_holidays/report/holidays_summary_report.py 2010-02-24 10:55:29 +0000 +++ hr_holidays/report/holidays_summary_report.py 2010-03-10 10:58:48 +0000 @@ -42,7 +42,7 @@ return -def emp_create_xml(self,cr,uid,dept,holiday_type,row_id,empid,name,som,eom): +def emp_create_xml(self, cr, uid, dept, holiday_type, row_id, empid, name, som, eom): display={} if dept==0: === modified file 'hr_recruitment/hr_hr.py' --- hr_recruitment/hr_hr.py 2010-03-02 12:48:29 +0000 +++ hr_recruitment/hr_hr.py 2010-03-10 10:58:47 +0000 @@ -70,4 +70,4 @@ 'survey_id': fields.many2one('survey', 'Survey'), } -hr_job() \ No newline at end of file +hr_job() === modified file 'hr_timesheet/hr_timesheet.py' --- hr_timesheet/hr_timesheet.py 2010-02-24 10:55:29 +0000 +++ hr_timesheet/hr_timesheet.py 2010-03-10 10:59:00 +0000 @@ -45,7 +45,7 @@ 'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade'), } - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): toremove = {} for obj in self.browse(cr, uid, ids, context): toremove[obj.line_id.id] = True @@ -53,7 +53,7 @@ return super(hr_analytic_timesheet, self).unlink(cr, uid, ids, context) - def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}): + def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context=None): res = {} # if prod_id and unit_amount: if prod_id: @@ -122,7 +122,7 @@ return {'value':{},'warning':warning} return {'value':{}} - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): try: res = super(hr_analytic_timesheet, self).create(cr, uid, vals, context) return res === modified file 'hr_timesheet_invoice/hr_timesheet_invoice.py' --- hr_timesheet_invoice/hr_timesheet_invoice.py 2010-02-24 10:55:29 +0000 +++ hr_timesheet_invoice/hr_timesheet_invoice.py 2010-03-10 10:59:01 +0000 @@ -39,7 +39,7 @@ class account_analytic_account(osv.osv): - def _invoiced_calc(self, cr, uid, ids, name, arg, context={}): + def _invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids): invoiced = {} @@ -86,7 +86,7 @@ return super(account_analytic_line,self).write(cr, uid, ids, vals, context=context) - def _check_inv(self, cr, uid, ids,vals): + def _check_inv(self, cr, uid, ids, vals): select = ids if isinstance(select, (int, long)): select = [ids] === modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py' --- hr_timesheet_sheet/hr_timesheet_sheet.py 2010-03-09 06:36:03 +0000 +++ hr_timesheet_sheet/hr_timesheet_sheet.py 2010-03-10 10:59:02 +0000 @@ -29,7 +29,7 @@ class one2many_mod2(fields.one2many): - def get(self, cr, obj, ids, name, user=None, offset=0, context={}, values={}): + def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): res = {} for id in ids: res[id] = [] @@ -66,7 +66,7 @@ class one2many_mod(fields.one2many): - def get(self, cr, obj, ids, name, user=None, offset=0, context={}, values={}): + def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): res = {} for id in ids: res[id] = [] @@ -249,7 +249,7 @@ 'department_id':fields.many2one('hr.department','Department'), } - def _default_date_from(self,cr, uid, context={}): + def _default_date_from(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, uid, context) r = user.company_id and user.company_id.timesheet_range or 'month' if r=='month': @@ -260,7 +260,7 @@ return time.strftime('%Y-01-01') return time.strftime('%Y-%m-%d') - def _default_date_to(self,cr, uid, context={}): + def _default_date_to(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, uid, context) r = user.company_id and user.company_id.timesheet_range or 'month' if r=='month': @@ -311,7 +311,9 @@ wf_service.trg_create(uid, self._name, id, cr) return True - def name_get(self, cr, uid, ids, context={}): + 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']) \ @@ -333,7 +335,9 @@ class hr_timesheet_line(osv.osv): _inherit = "hr.analytic.timesheet" - def _get_default_date(self, cr, uid, context={}): + def _get_default_date(self, cr, uid, context=None): + if context is None: + context = {} if 'date' in context: return context['date'] return time.strftime('%Y-%m-%d') @@ -451,7 +455,9 @@ class hr_attendance(osv.osv): _inherit = "hr.attendance" - def _get_default_date(self, cr, uid, context={}): + def _get_default_date(self, cr, uid, context=None): + if context is None: + context = {} if 'name' in context: return context['name'] + time.strftime(' %H:%M:%S') return time.strftime('%Y-%m-%d %H:%M:%S') @@ -482,7 +488,7 @@ res[line_id] = False return res - def _sheet_search(self, cursor, user, obj, name, args, context={}): + def _sheet_search(self, cursor, user, obj, name, args, context=None): if not len(args): return [] sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') @@ -545,7 +551,9 @@ 'name': _get_default_date, } - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): + if context is None: + context = {} if 'sheet_id' in context: ts = self.pool.get('hr_timesheet_sheet.sheet').browse(cr, uid, context['sheet_id']) if ts.state not in ('draft', 'new'): @@ -561,7 +569,9 @@ self._check(cr, uid, ids) return super(hr_attendance,self).unlink(cr, uid, ids,*args, **kwargs) - def write(self, cr, uid, ids, vals, context={}): + def write(self, cr, uid, ids, vals, context=None): + if context is None: + context = {} self._check(cr, uid, ids) res = super(hr_attendance,self).write(cr, uid, ids, vals, context=context) if 'sheet_id' in context: === modified file 'html_view/__init__.py' --- html_view/__init__.py 2010-03-09 13:17:18 +0000 +++ html_view/__init__.py 2010-03-10 10:58:48 +0000 @@ -1,1 +1,1 @@ -import html_view \ No newline at end of file +import html_view === modified file 'html_view/__terp__.py' --- html_view/__terp__.py 2010-03-09 13:17:18 +0000 +++ html_view/__terp__.py 2010-03-10 10:58:48 +0000 @@ -14,4 +14,4 @@ 'active': False, 'certificate': '', } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'html_view/html_view.py' --- html_view/html_view.py 2010-03-09 13:17:18 +0000 +++ html_view/html_view.py 2010-03-10 10:58:48 +0000 @@ -10,4 +10,4 @@ 'bank_ids': fields.one2many('res.partner.bank', 'partner_id', 'Banks'), } -html_view() \ No newline at end of file +html_view() === modified file 'idea/idea.py' --- idea/idea.py 2010-02-24 10:55:29 +0000 +++ idea/idea.py 2010-03-10 10:58:34 +0000 @@ -43,7 +43,7 @@ _name = 'idea.idea' _rec_name = 'title' - def _vote_avg_compute(self, cr, uid, ids, name, arg, context = None): + def _vote_avg_compute(self, cr, uid, ids, name, arg, context=None): if not len(ids): return {} @@ -56,7 +56,7 @@ cr.execute(sql, (ids,)) return dict(cr.fetchall()) - def _vote_count(self,cr,uid,ids,name,arg,context=None): + def _vote_count(self, cr, uid, ids, name, arg, context=None): if not len(ids): return {} @@ -69,7 +69,7 @@ cr.execute(sql, (ids,)) return dict(cr.fetchall()) - def _comment_count(self,cr,uid,ids,name,arg,context=None): + def _comment_count(self, cr, uid, ids, name, arg, context=None): if not len(ids): return {} @@ -82,7 +82,7 @@ cr.execute(sql,(ids,)) return dict(cr.fetchall()) - def _vote_read(self, cr, uid, ids, name, arg, context = None): + def _vote_read(self, cr, uid, ids, name, arg, context=None): res = {} for id in ids: res[id] = '-1' @@ -92,7 +92,7 @@ res[vote.idea_id.id] = vote.score return res - def _vote_save(self, cr, uid, id, field_name, field_value, arg, context = None): + def _vote_save(self, cr, uid, id, field_name, field_value, arg, context=None): vote_obj = self.pool.get('idea.vote') vote = vote_obj.search(cr,uid,[('idea_id', '=', id),('user_id', '=', uid)]) textual_value = str(field_value) === modified file 'l10n_be/wizard/partner_vat_listing.py' --- l10n_be/wizard/partner_vat_listing.py 2010-02-24 10:55:29 +0000 +++ l10n_be/wizard/partner_vat_listing.py 2010-03-10 10:58:36 +0000 @@ -245,4 +245,4 @@ wizard_vat('list.vat.detail') -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'l10n_be/wizard/wizard_vat_intra.py' --- l10n_be/wizard/wizard_vat_intra.py 2010-02-24 10:55:29 +0000 +++ l10n_be/wizard/wizard_vat_intra.py 2010-03-10 10:58:36 +0000 @@ -229,4 +229,4 @@ 'result': {'type':'form', 'arch':msg_form, 'fields':msg_fields, 'state':[('end','Ok')]}, } } -parter_vat_intra('vat.intra.xml') \ No newline at end of file +parter_vat_intra('vat.intra.xml') === modified file 'l10n_ch/__init__.py' (properties changed: +x to -x) === modified file 'l10n_ch/__terp__.py' (properties changed: +x to -x) === modified file 'l10n_ch/account_move_line.py' (properties changed: +x to -x) === modified file 'l10n_ch/bank.py' (properties changed: +x to -x) === modified file 'l10n_ch/company.py' (properties changed: +x to -x) === modified file 'l10n_ch/dta.py' (properties changed: +x to -x) === modified file 'l10n_ch/invoice.py' (properties changed: +x to -x) === modified file 'l10n_ch/partner.py' (properties changed: +x to -x) === modified file 'l10n_ch/payment.py' (properties changed: +x to -x) --- l10n_ch/payment.py 2010-02-24 10:55:29 +0000 +++ l10n_ch/payment.py 2010-03-10 10:58:55 +0000 @@ -36,7 +36,7 @@ class payment_order(osv.osv): _inherit = 'payment.order' - def get_wizard(self,mode): + def get_wizard(self, mode): if mode == 'dta': return 'l10n_ch','wizard_account_dta_create' return super(payment_order,self).get_wizard(mode) === modified file 'l10n_ch/report/__init__.py' (properties changed: +x to -x) === modified file 'l10n_ch/report/bvr.py' (properties changed: +x to -x) --- l10n_ch/report/bvr.py 2010-02-24 10:55:29 +0000 +++ l10n_ch/report/bvr.py 2010-03-10 10:58:54 +0000 @@ -62,7 +62,7 @@ date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') return date_formatted - def police_absolute_path(self, inner_path) : + def police_absolute_path(self, inner_path): path = os.path.join(os.path.dirname(sys.argv[0]), inner_path) return path @@ -79,7 +79,7 @@ - def comma_me(self,amount): + def comma_me(self, amount): if type(amount) is float : amount = str('%.2f'%amount) else : @@ -91,7 +91,7 @@ else: return self.comma_me(new) - def _space(self,nbr, nbrspc=5): + def _space(self, nbr, nbrspc=5): res = '' for i in range(len(nbr)): res = res + nbr[i] === modified file 'l10n_ch/wizard/__init__.py' (properties changed: +x to -x) === modified file 'l10n_ch/wizard/bvr_import.py' (properties changed: +x to -x) === modified file 'l10n_ch/wizard/dta_wizard.py' (properties changed: +x to -x) === modified file 'l10n_ch/wizard/journal_config.py' (properties changed: +x to -x) --- l10n_ch/wizard/journal_config.py 2010-02-24 10:55:29 +0000 +++ l10n_ch/wizard/journal_config.py 2010-03-10 10:58:55 +0000 @@ -95,7 +95,7 @@ 'default_credit_account_id':_get_credit, } - def on_change_debit(self, cr, uid, id, journal, account) : + def on_change_debit(self, cr, uid, id, journal, account): if account : self.pool.get('account.journal').write( cr, uid, journal, @@ -111,7 +111,7 @@ ) return {} - def execute(self,cr,uid,ids,context=None): + def execute(self, cr, uid, ids, context=None): jids = self.pool.get('account.journal').search(cr, uid, []) if self._inner_steps < len(jids)-1: self._inner_steps += 1 === modified file 'l10n_ch/wizard/wizard_bvr.py' (properties changed: +x to -x) === modified file 'l10n_ch_chart_c2c_pcg/wizard/__init__.py' (properties changed: +x to -x) === modified file 'l10n_ch_chart_c2c_pcg/wizard/config.py' (properties changed: +x to -x) --- l10n_ch_chart_c2c_pcg/wizard/config.py 2010-02-24 10:55:29 +0000 +++ l10n_ch_chart_c2c_pcg/wizard/config.py 2010-03-10 10:59:01 +0000 @@ -75,7 +75,7 @@ return self._on_change( cr, uid, ids, tax, vals={'account_paid_id': account}) - def execute(self,cr,uid,ids,context={}): + def execute(self, cr, uid, ids, context=None): jids = self.pool.get('account.tax.template').search(cr, uid, []) if self._inner_steps < len(jids)-1 : self._inner_steps += 1 === modified file 'l10n_fr/report/base_report.py' --- l10n_fr/report/base_report.py 2010-02-24 10:55:29 +0000 +++ l10n_fr/report/base_report.py 2010-03-10 10:58:43 +0000 @@ -40,7 +40,7 @@ }) self.context = context - def _load(self,name,form): + def _load(self, name, form): fiscalyear=self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear']) period_query_cond=self.pool.get('account.period').search(self.cr, self.uid,[('fiscalyear_id','=',form['fiscalyear'])]) @@ -55,13 +55,13 @@ for line in datas: self._load_accounts(form,line['code'],eval(line['definition']),fiscalyear,period_query_cond) - def _set_variable(self,variable,valeur): + def _set_variable(self, variable, valeur): self.localcontext.update({variable:valeur}) - def _get_variable(self,variable): + def _get_variable(self, variable): return self.localcontext[variable] - def _load_accounts(self,form,code,definition,fiscalyear,period_query_cond): + def _load_accounts(self, form, code, definition, fiscalyear, period_query_cond): #self.context.copy() accounts={} for x in definition['load']: === modified file 'l10n_lu/wizard/pdf_ext.py' --- l10n_lu/wizard/pdf_ext.py 2010-02-24 10:55:29 +0000 +++ l10n_lu/wizard/pdf_ext.py 2010-03-10 10:58:35 +0000 @@ -57,7 +57,7 @@ %%EOF """ -def output_field( f ): +def output_field(f): return "\xfe\xff" + "".join( [ "\x00"+c for c in f ] ) def extract_keys(lines): === modified file 'l10n_lu/wizard/print_vat.py' --- l10n_lu/wizard/print_vat.py 2010-02-24 10:55:29 +0000 +++ l10n_lu/wizard/print_vat.py 2010-03-10 10:58:35 +0000 @@ -48,7 +48,7 @@ class report_custom(report_int): - def create(self, cr, uid, ids, datas, context={}): + def create(self, cr, uid, ids, datas, context=None): pool = pooler.get_pool(cr.dbname) === modified file 'lunch/lunch.py' --- lunch/lunch.py 2010-02-24 10:55:29 +0000 +++ lunch/lunch.py 2010-03-10 10:58:45 +0000 @@ -37,7 +37,7 @@ class lunch_product(osv.osv): _name = 'lunch.product' - def _category_name_get(self, cr, uid, context={}): + def _category_name_get(self, cr, uid, context=None): obj = self.pool.get('lunch.category') cat_ids= obj.search(cr,uid,[]) res = obj.read(cr,uid,cat_ids,['name', 'category']) @@ -128,7 +128,7 @@ 'state': lambda self,cr,uid,context: 'draft', } - def confirm(self,cr,uid,ids,box,context): + def confirm(self, cr, uid, ids, box, context): cashmove_ref= self.pool.get('lunch.cashmove') for order in self.browse(cr,uid,ids): if order.state == 'confirmed': @@ -142,7 +142,7 @@ self.write(cr,uid,[order.id],{'cashmove':new_id, 'state':'confirmed'}) return {} - def lunch_order_cancel(self,cr,uid,ids,context): + def lunch_order_cancel(self, cr, uid, ids, context): orders= self.browse(cr,uid,ids) for order in orders: if not order.cashmove: === modified file 'lunch/wizard/cancel.py' --- lunch/wizard/cancel.py 2010-02-24 10:55:29 +0000 +++ lunch/wizard/cancel.py 2010-03-10 10:58:45 +0000 @@ -33,7 +33,7 @@ cancel_fields = { } -def _cancel(self,cr,uid,data,context): +def _cancel(self, cr, uid, data, context): return pooler.get_pool(cr.dbname).get('lunch.order').lunch_order_cancel(cr,uid,data['ids'],context) class order_cancel(wizard.interface): === modified file 'lunch/wizard/confirm.py' --- lunch/wizard/confirm.py 2010-02-24 10:55:29 +0000 +++ lunch/wizard/confirm.py 2010-03-10 10:58:45 +0000 @@ -36,7 +36,7 @@ 'confirm_cashbox': {'string':'Name of box', 'type':'many2one', 'required':True, 'relation':'lunch.cashbox' }, } -def _confirm(self,cr,uid,data,context): +def _confirm(self, cr, uid, data, context): pool= pooler.get_pool(cr.dbname) order_ref = pool.get('lunch.order') order_ref.confirm(cr,uid,data['ids'],data['form']['confirm_cashbox'],context) === modified file 'lunch/wizard/reset_box.py' --- lunch/wizard/reset_box.py 2010-02-24 10:55:29 +0000 +++ lunch/wizard/reset_box.py 2010-03-10 10:58:45 +0000 @@ -33,7 +33,7 @@ confirm_setting_zero_fields = {} -def _set_to_zero(self,cr,uid,data,context): +def _set_to_zero(self, cr, uid, data, context): pool= pooler.get_pool(cr.dbname) cashmove_ref = pool.get('lunch.cashmove') cr.execute("select user_cashmove, box,sum(amount) from lunch_cashmove where active= 't' and box in (%s) group by user_cashmove, box"%','.join(map(str,data['ids']))) === modified file 'mail_gateway/mail_gateway.py' --- mail_gateway/mail_gateway.py 2010-02-24 10:55:29 +0000 +++ mail_gateway/mail_gateway.py 2010-03-10 10:58:48 +0000 @@ -97,7 +97,7 @@ 'reply_to': lambda * a:tools.config.get('email_from',False) } - def _fetch_mails(self, cr, uid, ids=False, context={}): + def _fetch_mails(self, cr, uid, ids=False, context=None): ''' Function called by the scheduler to fetch mails ''' @@ -107,7 +107,7 @@ ids2 = map(lambda x: x[0], cr.fetchall() or []) return self.fetch_mails(cr, uid, ids=ids2, context=context) - def parse_mail(self, cr, uid, gateway_id, email_message, context={}): + def parse_mail(self, cr, uid, gateway_id, email_message, context=None): msg_id, res_id, note = (False, False, False) mail_history_obj = self.pool.get('mail.gateway.history') mailgateway = self.browse(cr, uid, gateway_id, context=context) @@ -125,7 +125,7 @@ mail_history_obj.create(cr, uid, {'name': msg_id, 'res_id': res_id, 'gateway_id': mailgateway.id, 'note': note}) return res_id, note - def fetch_mails(self, cr, uid, ids=[], context={}): + def fetch_mails(self, cr, uid, ids=None, context=None): log_messages = [] mailgate_server = False new_messages = [] @@ -235,7 +235,7 @@ return res_id - def msg_body_get(self, msg): + def msg_body_get(self, msg): message = {}; message['body'] = ''; message['attachment'] = {}; @@ -277,7 +277,7 @@ return message #end def - def msg_update(self, cr, uid, msg, res_id, res_model, user_email): + def msg_update(self, cr, uid, msg, res_id, res_model, user_email): if user_email and self.emails_get(user_email)==self.emails_get(self._decode_header(msg['From'])): return self.msg_user(cr, uid, msg, res_id, res_model) else: @@ -308,7 +308,7 @@ res_model = self.pool.get(res_model) return res_model.msg_update(cr, uid, res_id, msg, data=data, default_act='pending') - def msg_send(self, msg, reply_to, emails, priority=None, res_id=False): + def msg_send(self, msg, reply_to, emails, priority=None, res_id=False): if not emails: return False msg_to = [emails[0]] === modified file 'mail_gateway/wizard/wizard_fetch_mail.py' --- mail_gateway/wizard/wizard_fetch_mail.py 2010-02-24 10:55:29 +0000 +++ mail_gateway/wizard/wizard_fetch_mail.py 2010-03-10 10:58:48 +0000 @@ -44,7 +44,7 @@ 'message': {'string':"Log Detail", 'type':'text', 'readonly':True}, } -def _default(self , cr, uid, data, context): +def _default(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) gateway_pool=pool.get('mail.gateway') server = [] === modified file 'membership/membership.py' --- membership/membership.py 2010-03-06 20:52:19 +0000 +++ membership/membership.py 2010-03-10 10:58:46 +0000 @@ -342,7 +342,7 @@ res[partner_id] = False return res - def _get_partners(self, cr, uid, ids, context={}): + def _get_partners(self, cr, uid, ids, context=None): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member','in',ids2)], context=context) @@ -736,7 +736,7 @@ member_line_obj.unlink(cr, uid, ml_ids, context=context) return super(account_invoice_line, self).unlink(cr, uid, ids, context=context) - def create(self, cr, uid, vals, context={}): + def create(self, cr, uid, vals, context=None): result = super(account_invoice_line, self).create(cr, uid, vals, context) line = self.browse(cr, uid, result) member_line_obj = self.pool.get('membership.membership_line') === modified file 'mrp/mrp.py' --- mrp/mrp.py 2010-03-05 10:08:13 +0000 +++ mrp/mrp.py 2010-03-10 10:58:45 +0000 @@ -133,7 +133,7 @@ class mrp_bom(osv.osv): _name = 'mrp.bom' _description = 'Bills of Material' - def _child_compute(self, cr, uid, ids, name, arg, context={}): + def _child_compute(self, cr, uid, ids, name, arg, context=None): result = {} for bom in self.browse(cr, uid, ids, context=context): result[bom.id] = map(lambda x: x.id, bom.bom_lines) @@ -218,7 +218,7 @@ ] - def onchange_product_id(self, cr, uid, ids, product_id, name, context={}): + def onchange_product_id(self, cr, uid, ids, product_id, name, context=None): if product_id: prod=self.pool.get('product.product').browse(cr,uid,[product_id])[0] v = {'product_uom':prod.uom_id.id} @@ -227,7 +227,9 @@ return {'value': v} return {} - def _bom_find(self, cr, uid, product_id, product_uom, properties=[]): + def _bom_find(self, cr, uid, product_id, product_uom, properties=None): + if properties is None: + properties = [] bom_result = False # Why searching on BoM without parent ? cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,)) @@ -291,7 +293,7 @@ result2 = result2 + res[1] return result, result2 - def set_indices(self, cr, uid, ids, context = {}): + def set_indices(self, cr, uid, ids, context=None): if not ids or (ids and not ids[0]): return True res = self.read(cr, uid, ids, ['revision_ids', 'revision_type']) @@ -377,7 +379,7 @@ _description = 'Production' _date_name = 'date_planned' - def _get_sale_order(self,cr,uid,ids,field_name=False): + def _get_sale_order(self, cr, uid, ids, field_name=False): move_obj=self.pool.get('stock.move') def get_parent_move(move_id): move = move_obj.browse(cr,uid,move_id) @@ -400,7 +402,7 @@ res[production['id']]=move.sale_line_id and move.sale_line_id.order_id.client_order_ref or False return res - def _production_calc(self, cr, uid, ids, prop, unknow_none, context={}): + def _production_calc(self, cr, uid, ids, prop, unknow_none, context=None): result = {} for prod in self.browse(cr, uid, ids, context=context): result[prod.id] = { @@ -412,13 +414,13 @@ result[prod.id]['cycle_total'] += wc.cycle return result - def _production_date_end(self, cr, uid, ids, prop, unknow_none, context={}): + def _production_date_end(self, cr, uid, ids, prop, unknow_none, context=None): result = {} for prod in self.browse(cr, uid, ids, context=context): result[prod.id] = prod.date_planned return result - def _production_date(self, cr, uid, ids, prop, unknow_none, context={}): + def _production_date(self, cr, uid, ids, prop, unknow_none, context=None): result = {} for prod in self.browse(cr, uid, ids, context=context): result[prod.id] = prod.date_planned[:10] @@ -493,7 +495,7 @@ raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!' % s['state'])) return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) - def copy(self, cr, uid, id, default=None,context=None): + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} default.update({ @@ -504,7 +506,7 @@ }) return super(mrp_production, self).copy(cr, uid, id, default, context) - def location_id_change(self, cr, uid, ids, src, dest, context={}): + def location_id_change(self, cr, uid, ids, src, dest, context=None): if dest: return {} if src: @@ -531,7 +533,7 @@ self.write(cr, uid, ids, {'state':'picking_except'}) return True - def action_compute(self, cr, uid, ids, properties=[]): + def action_compute(self, cr, uid, ids, properties=None): results = [] for production in self.browse(cr, uid, ids): cr.execute('delete from mrp_production_product_line where production_id=%s', (production.id,)) @@ -926,7 +928,7 @@ raise osv.except_osv(_('Invalid action !'), _('Cannot delete Requisition Order(s) which are in %s State!' % s['state'])) return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) - def onchange_product_id(self, cr, uid, ids, product_id, context={}): + def onchange_product_id(self, cr, uid, ids, product_id, context=None): if product_id: w=self.pool.get('product.product').browse(cr,uid,product_id, context) v = { @@ -942,7 +944,7 @@ return True return False - def check_move_cancel(self, cr, uid, ids, context={}): + def check_move_cancel(self, cr, uid, ids, context=None): res = True ok = False for procurement in self.browse(cr, uid, ids, context): @@ -952,7 +954,7 @@ res = False return res and ok - def check_move_done(self, cr, uid, ids, context={}): + def check_move_done(self, cr, uid, ids, context=None): res = True for proc in self.browse(cr, uid, ids, context): if proc.move_id: @@ -964,13 +966,13 @@ # This method may be overrided by objects that override mrp.procurment # for computing their own purpose # - def _quantity_compute_get(self, cr, uid, proc, context={}): + def _quantity_compute_get(self, cr, uid, proc, context=None): if proc.product_id.type=='product': if proc.move_id.product_uos: return proc.move_id.product_uos_qty return False - def _uom_compute_get(self, cr, uid, proc, context={}): + def _uom_compute_get(self, cr, uid, proc, context=None): if proc.product_id.type=='product': if proc.move_id.product_uos: return proc.move_id.product_uos.id @@ -980,7 +982,7 @@ # Return the quantity of product shipped/produced/served, wich may be # different from the planned quantity # - def quantity_get(self, cr, uid, id, context={}): + def quantity_get(self, cr, uid, id, context=None): proc = self.browse(cr, uid, id, context) result = self._quantity_compute_get(cr, uid, proc, context) if not result: @@ -994,16 +996,16 @@ result = proc.product_uom.id return result - def check_waiting(self, cr, uid, ids, context=[]): + def check_waiting(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids, context=context): if procurement.move_id and procurement.move_id.state=='auto': return True return False - def check_produce_service(self, cr, uid, procurement, context=[]): + def check_produce_service(self, cr, uid, procurement, context=None): return True - def check_produce_product(self, cr, uid, procurement, context=[]): + def check_produce_product(self, cr, uid, procurement, context=None): properties = [x.id for x in procurement.property_ids] bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties) if not bom_id: @@ -1011,7 +1013,7 @@ return False return True - def check_make_to_stock(self, cr, uid, ids, context={}): + def check_make_to_stock(self, cr, uid, ids, context=None): ok = True for procurement in self.browse(cr, uid, ids, context=context): if procurement.product_id.type=='service': @@ -1020,7 +1022,7 @@ ok = ok and self._check_make_to_stock_product(cr, uid, procurement, context) return ok - def check_produce(self, cr, uid, ids, context={}): + def check_produce(self, cr, uid, ids, context=None): res = True user = self.pool.get('res.users').browse(cr, uid, uid) for procurement in self.browse(cr, uid, ids): @@ -1063,7 +1065,7 @@ return True return False - def action_confirm(self, cr, uid, ids, context={}): + def action_confirm(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids): if procurement.product_qty <= 0.00: raise osv.except_osv(_('Data Insufficient !'), _('Please check the Quantity of Requisition Order(s), it should not be less than 1!')) @@ -1091,14 +1093,14 @@ self.write(cr, uid, ids, {'state':'confirmed','message':''}) return True - def action_move_assigned(self, cr, uid, ids, context={}): + def action_move_assigned(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'running','message':_('from stock: products assigned.')}) return True - def _check_make_to_stock_service(self, cr, uid, procurement, context={}): + def _check_make_to_stock_service(self, cr, uid, procurement, context=None): return True - def _check_make_to_stock_product(self, cr, uid, procurement, context={}): + def _check_make_to_stock_product(self, cr, uid, procurement, context=None): ok = True if procurement.move_id: id = procurement.move_id.id @@ -1109,12 +1111,12 @@ cr.execute('update mrp_procurement set message=%s where id=%s', (_('from stock and no minimum orderpoint rule defined'), procurement.id)) return ok - def action_produce_assign_service(self, cr, uid, ids, context={}): + def action_produce_assign_service(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids): self.write(cr, uid, [procurement.id], {'state':'running'}) return True - def action_produce_assign_product(self, cr, uid, ids, context={}): + def action_produce_assign_product(self, cr, uid, ids, context=None): produce_id = False company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id for procurement in self.browse(cr, uid, ids): @@ -1145,7 +1147,7 @@ {'location_id':procurement.location_id.id}) return produce_id - def action_po_assign(self, cr, uid, ids, context={}): + def action_po_assign(self, cr, uid, ids, context=None): purchase_id = False company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id for procurement in self.browse(cr, uid, ids): @@ -1289,7 +1291,7 @@ 'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False), 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c) } - def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}): + def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context=None): if warehouse_id: w=self.pool.get('stock.warehouse').browse(cr,uid,warehouse_id, context) v = {'location_id':w.lot_stock_id.id} @@ -1301,7 +1303,7 @@ v = {'product_uom':prod.uom_id.id} return {'value': v} return {} - def copy(self, cr, uid, id, default=None,context={}): + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} default.update({ @@ -1321,7 +1323,7 @@ default['procurements'] = [] return super(StockMove, self).copy(cr, uid, id, default, context) - def _action_explode(self, cr, uid, move, context={}): + def _action_explode(self, cr, uid, move, context=None): if move.product_id.supply_method=='produce' and move.product_id.procure_method=='make_to_order': bis = self.pool.get('mrp.bom').search(cr, uid, [ ('product_id','=',move.product_id.id), === modified file 'mrp/mrp_wizard.py' --- mrp/mrp_wizard.py 2010-02-24 08:17:06 +0000 +++ mrp/mrp_wizard.py 2010-03-10 10:58:44 +0000 @@ -46,7 +46,9 @@ 'mode': lambda *x: 'consume_produce' } - def do_produce(self, cr, uid, ids, context={}): + def do_produce(self, cr, uid, ids, context=None): + if context is None: + context = {} prod_obj = self.pool.get('mrp.production') move_ids = context['active_ids'] for data in self.read(cr, uid, ids): === modified file 'mrp/report/bom_structure.py' --- mrp/report/bom_structure.py 2010-02-24 10:55:29 +0000 +++ mrp/report/bom_structure.py 2010-03-10 10:58:44 +0000 @@ -36,7 +36,7 @@ def get_children(self, object, level=0): result = [] - def _get_rec(object,level): + def _get_rec(object, level): for l in object: res = {} res['name'] = l.name @@ -61,4 +61,4 @@ report_sxw.report_sxw('report.bom.structure','mrp.bom','mrp/report/bom_structure.rml',parser=bom_structure) -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'mrp/report/price.py' --- mrp/report/price.py 2010-02-24 10:55:29 +0000 +++ mrp/report/price.py 2010-03-10 10:58:44 +0000 @@ -29,7 +29,7 @@ #FIXME: we should use toxml class report_custom(report_rml): - def create_xml(self, cr, uid, ids, datas, context={}): + def create_xml(self, cr, uid, ids, datas, context=None): number = (datas.get('form', False) and datas['form']['number']) or 1 def process_bom(bom, currency_id): === modified file 'mrp/report/workcenter_load.py' --- mrp/report/workcenter_load.py 2010-02-24 10:55:29 +0000 +++ mrp/report/workcenter_load.py 2010-03-10 10:58:44 +0000 @@ -95,7 +95,7 @@ return dates return {} - def create(self, cr, uid, ids, datas, context={}): + def create(self, cr, uid, ids, datas, context=None): assert len(ids), 'You should provide some ids!' colors = choice_colors(len(ids)) cr.execute( === modified file 'mrp/wizard/wizard_change_production_qty.py' --- mrp/wizard/wizard_change_production_qty.py 2010-02-24 10:55:29 +0000 +++ mrp/wizard/wizard_change_production_qty.py 2010-03-10 10:58:44 +0000 @@ -38,7 +38,7 @@ 'product_qty': {'string': 'Product Qty', 'type':'float', 'required':True}, } -def _get_qty(self,cr,uid, data, state): +def _get_qty(self, cr, uid, data, state): prod_obj = pooler.get_pool(cr.dbname).get('mrp.production') prod = prod_obj.browse(cr, uid,data['ids'])[0] form1_fields['product_qty']['default']=prod.product_qty === modified file 'mrp_operations/mrp_operations.py' --- mrp_operations/mrp_operations.py 2010-02-24 10:55:29 +0000 +++ mrp_operations/mrp_operations.py 2010-03-10 10:59:01 +0000 @@ -95,7 +95,7 @@ 'delay': lambda *a: 0.0 } - def modify_production_order_state(self,cr,uid,ids,action): + def modify_production_order_state(self, cr, uid, ids, action): wf_service = netsvc.LocalService("workflow") oper_obj=self.browse(cr,uid,ids)[0] prod_obj=oper_obj.production_id @@ -120,7 +120,7 @@ wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr) return - def write(self, cr, uid, ids, vals, context={}, update=True): + def write(self, cr, uid, ids, vals, context=None, update=True): result = super(mrp_production_workcenter_line, self).write(cr, uid, ids, vals, context=context) if vals.get('date_planned', False) and update: pids = {} @@ -174,7 +174,7 @@ 'allow_reorder': fields.boolean('Free Serialisation', help="Check this to be able to move independently all production orders, without moving dependent ones."), } - def _production_date_end(self, cr, uid, ids, prop, unknow_none, context={}): + def _production_date_end(self, cr, uid, ids, prop, unknow_none, context=None): result = {} for prod in self.browse(cr, uid, ids, context=context): result[prod.id] = prod.date_planned @@ -194,7 +194,9 @@ tmp=self.pool.get('mrp.production.workcenter.line').action_cancel(cr,uid,[workcenter_line.id]) return super(mrp_production,self).action_cancel(cr,uid,ids) - def _compute_planned_workcenter(self, cr, uid, ids, context={}, mini=False): + def _compute_planned_workcenter(self, cr, uid, ids, context=None, mini=False): + if context is None: + context = {} dt_end = DateTime.now() for po in self.browse(cr, uid, ids, context=context): dt_end = DateTime.strptime(po.date_start or po.date_planned, '%Y-%m-%d %H:%M:%S') @@ -230,7 +232,7 @@ }) return dt_end - def _move_pass(self, cr, uid, ids, context={}): + def _move_pass(self, cr, uid, ids, context=None): for po in self.browse(cr, uid, ids, context): if po.allow_reorder: continue @@ -255,7 +257,7 @@ self.write(cr, uid, [l.production_id.id], {'date_start':dt.strftime('%Y-%m-%d %H:%M:%S')}, mini=True) return True - def _move_futur(self, cr, uid, ids, context={}): + def _move_futur(self, cr, uid, ids, context=None): for po in self.browse(cr, uid, ids, context): if po.allow_reorder: continue @@ -272,7 +274,7 @@ break - def write(self, cr, uid, ids, vals, context={}, update=True, mini=True): + def write(self, cr, uid, ids, vals, context=None, update=True, mini=True): direction = {} if vals.get('date_start', False): for po in self.browse(cr, uid, ids, context=context): @@ -291,7 +293,7 @@ pass return result - def action_compute(self, cr, uid, ids, properties=[]): + def action_compute(self, cr, uid, ids, properties=None): result = super(mrp_production, self).action_compute(cr, uid, ids, properties=properties) self._compute_planned_workcenter(cr, uid, ids, context={}) return result @@ -321,7 +323,7 @@ res[operation.id]=operation.production_id.date_planned return res - def calc_delay(self,cr,uid,vals): + def calc_delay(self, cr, uid, vals): code_lst=[] time_lst=[] @@ -349,7 +351,7 @@ diff += (b-a).seconds / float(60*60) return diff - def check_operation(self,cr,uid,vals): + def check_operation(self, cr, uid, vals): code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])]) code=self.pool.get('mrp_operations.operation.code').browse(cr,uid,code_ids)[0] code_lst = [] === modified file 'mrp_operations/report/__init__.py' (properties changed: +x to -x) === modified file 'mrp_operations/report/mrp_code_barcode.py' (properties changed: +x to -x) === modified file 'mrp_operations/report/mrp_wc_barcode.py' (properties changed: +x to -x) === modified file 'mrp_subproduct/mrp_subproduct.py' --- mrp_subproduct/mrp_subproduct.py 2010-02-24 10:55:29 +0000 +++ mrp_subproduct/mrp_subproduct.py 2010-03-10 10:58:51 +0000 @@ -35,7 +35,7 @@ _defaults={ 'subproduct_type': lambda *args: 'fixed' } - def onchange_product_id(self, cr, uid, ids, product_id,context={}): + def onchange_product_id(self, cr, uid, ids, product_id, context=None): if product_id: prod=self.pool.get('product.product').browse(cr,uid,product_id) v = {'product_uom':prod.uom_id.id} === modified file 'olap/__init__.py' (properties changed: +x to -x) === modified file 'olap/cli/tinybi.py' (properties changed: +x to -x) === modified file 'olap/cube/__init__.py' (properties changed: +x to -x) === modified file 'olap/cube/agregator.py' (properties changed: +x to -x) === modified file 'olap/cube/axis.py' (properties changed: +x to -x) === modified file 'olap/cube/axis_map.py' (properties changed: +x to -x) === modified file 'olap/cube/common.py' (properties changed: +x to -x) --- olap/cube/common.py 2010-02-24 10:55:29 +0000 +++ olap/cube/common.py 2010-03-10 10:58:42 +0000 @@ -2,7 +2,7 @@ from sqlalchemy import * import common -def measure_sql_exp_col(metadata,col): +def measure_sql_exp_col(metadata, col): temp = col.split(".") table_name = filter(lambda x: x.name==temp[0],metadata.table_iterator(reverse=False)) if table_name: === modified file 'olap/cube/cross.py' (properties changed: +x to -x) === modified file 'olap/cube/cube.py' (properties changed: +x to -x) === modified file 'olap/cube/datatype.py' (properties changed: +x to -x) === modified file 'olap/cube/formatstring.py' (properties changed: +x to -x) === modified file 'olap/cube/level.py' (properties changed: +x to -x) --- olap/cube/level.py 2010-02-24 10:55:29 +0000 +++ olap/cube/level.py 2010-03-10 10:58:43 +0000 @@ -5,7 +5,9 @@ import pooler,tools class level(object): - def __init__(self, level, sublevels=[]): + def __init__(self, level, sublevels=None): + if sublevels is None: + sublevels = [] self.level = level self.sublevels = sublevels self.object = False @@ -33,7 +35,7 @@ pos += 1 return self.object - def _to_unicode(self,s): + def _to_unicode(self, s): try: return s.encode('ascii') except UnicodeError: @@ -45,7 +47,7 @@ except UnicodeError: return s - def _to_decode(self,s): + def _to_decode(self, s): try: return s.encode('utf-8') except UnicodeError: === modified file 'olap/cube/levels/__init__.py' (properties changed: +x to -x) === modified file 'olap/cube/levels/level_date.py' (properties changed: +x to -x) === modified file 'olap/cube/levels/level_interface.py' (properties changed: +x to -x) === modified file 'olap/cube/levels/level_normal.py' (properties changed: +x to -x) === modified file 'olap/cube/mdx_input/__init__.py' (properties changed: +x to -x) === modified file 'olap/cube/mdx_input/mdx_input.py' (properties changed: +x to -x) === modified file 'olap/cube/mdx_operator.py' (properties changed: +x to -x) === modified file 'olap/cube/mdx_output/__init__.py' (properties changed: +x to -x) === modified file 'olap/cube/mdx_output/mdx_output.py' (properties changed: +x to -x) === modified file 'olap/cube/mdx_parser.py' (properties changed: +x to -x) --- olap/cube/mdx_parser.py 2010-02-24 10:55:29 +0000 +++ olap/cube/mdx_parser.py 2010-03-10 10:58:42 +0000 @@ -115,7 +115,7 @@ page_name = oneOf(' '.join(row_names)) axis_parser = self.mdx_cross_axis() + Optional(onToken + page_name) - def _assign_name(s,a,toks): + def _assign_name(s, a, toks): if len(toks)>=3: toks[0].name_set(toks[-1]) for x in range(1,len(toks)-1): === modified file 'olap/cube/measure.py' (properties changed: +x to -x) === modified file 'olap/cube/query.py' (properties changed: +x to -x) --- olap/cube/query.py 2010-02-24 10:55:29 +0000 +++ olap/cube/query.py 2010-03-10 10:58:42 +0000 @@ -36,7 +36,7 @@ cube_data = newcube return cube_data - def run(self,currency): + def run(self, currency): db = sqlalchemy.create_engine(self.object.schema_id.database_id.connection_url,encoding='utf-8') metadata = sqlalchemy.MetaData(db) print 'Connected to database...', self.object.schema_id.database_id.connection_url @@ -212,7 +212,9 @@ res += '>' return res - def log(self,cr,uid,cube,query,context={}): + def log(self, cr, uid, cube, query, context=None): + if context is None: + context = {} if not context==False: log_ids = pooler.get_pool(cr.dbname).get('olap.query.logs').search( cr, uid, [('query','=', query), ('user_id','=', uid)]) if log_ids: === modified file 'olap/cube/slicer.py' (properties changed: +x to -x) === modified file 'olap/cube/warehouse.py' --- olap/cube/warehouse.py 2010-02-24 10:55:29 +0000 +++ olap/cube/warehouse.py 2010-03-10 10:58:43 +0000 @@ -55,7 +55,9 @@ result = engine.execute(tab.insert(), data) return {} - def log(self,cr,uid,cube,query,data,connection,context={}): + def log(self, cr, uid, cube, query, data, connection, context=None): + if context is None: + context = {} if not context==False: log_ids = pooler.get_pool(cr.dbname).get('olap.query.logs').search( cr, uid, [('query','=', query), ('user_id','=', uid)]) if log_ids: @@ -143,7 +145,7 @@ final_result = ([rows, cols], datas) return final_result - def match_table(self, cr, uid,request, context): + def match_table(self, cr, uid, request, context): qry_obj = pooler.get_pool(cr.dbname).get('olap.query.logs') result = self.parse_query(request) qry = result[1][0] @@ -267,4 +269,4 @@ # else: # print "pages" return qry_list - \ No newline at end of file + === modified file 'olap/olap.py' --- olap/olap.py 2010-02-24 10:55:29 +0000 +++ olap/olap.py 2010-03-10 10:58:43 +0000 @@ -44,7 +44,7 @@ - def _connection_get(self,cr,uid,ids,field_name,arg,context = {}): + def _connection_get(self, cr, uid, ids, field_name, arg, context=None): """ Return a connection string url needed by SQL Alchemy. Exemple: 'postgres://scott:tiger@localhost:5432/mydatabase' @@ -54,7 +54,7 @@ res[obj.id] = '%s://%s:%s@%s:%d/%s' % (obj.type,obj.db_login,obj.db_password,obj.db_host,obj.db_port,obj.db_name) return res - def test_connection(self,cr,uid,ids,context = {}): + def test_connection(self, cr, uid, ids, context=None): try: self_obj = self.browse(cr,uid,ids,context) for obj in self_obj: @@ -113,7 +113,7 @@ _name = "olap.schema" _description = "Olap Schema" - def _app_detect(self,cr,uid,ids,field_name,arg,context = {}): + def _app_detect(self, cr, uid, ids, field_name, arg, context=None): """ Return a Application type """ @@ -165,7 +165,7 @@ 'ready': lambda * a: False } - def action_dbconnect(self,cr,uid,ids,context = {}): + def action_dbconnect(self, cr, uid, ids, context=None): schema = self.browse(cr,uid,ids,context)[0] type = schema.database_id.type maxconn = 64 @@ -210,7 +210,7 @@ return True - def action_dbload(self,cr,uid,ids,context = {}): + def action_dbload(self, cr, uid, ids, context=None): for id in ids: id_change = self.browse(cr,uid,id) self.write(cr,uid,id,{'loaded':True}) @@ -218,7 +218,7 @@ return True - def action_dbconfigure(self,cr,uid,ids,context = {}): + def action_dbconfigure(self, cr, uid, ids, context=None): for id in ids: id_browsed = self.browse(cr,uid,id) if not id_browsed.state == 'dbconfigure': @@ -226,18 +226,18 @@ self.write(cr,uid,id,{'configure':True}) return True - def action_dbready(self,cr,uid,ids,context = {}): + def action_dbready(self, cr, uid, ids, context=None): for id in ids: self.write(cr,uid,id,{'ready':True}) self.write(cr,uid,id,{'state':'done'}) return True - def action_done(self,cr,uid,ids,context = {}): + def action_done(self, cr, uid, ids, context=None): for id in ids: self.write(cr,uid,id,{'state':'done'}) return True - def create_xml_schema(self,cr,uid,xml_schema,context = {}): + def create_xml_schema(self, cr, uid, xml_schema, context=None): """ This function fill in the database according to a XML schema. Exemple of schema: @@ -269,7 +269,7 @@ """ raise 'Not implemented !' - def request(self,cr,uid,name,request,context = {}): + def request(self, cr, uid, name, request, context=None): ids = self.search(cr,uid,[('name','=',name)]) if not len(ids): raise 'Schema not found !' @@ -334,7 +334,7 @@ 'active': lambda * args: True, 'hide': lambda * args: False } - def name_get(self,cr,uid,ids,context = {}): + def name_get(self, cr, uid, ids, context=None): result = [] for t in self.browse(cr,uid,ids,context): if t.name <> t.table_db_name: @@ -343,7 +343,7 @@ result.append((t.id,t.name)) return result - def show_col_view(self,cr,uid,ids,context = {}): + def show_col_view(self, cr, uid, ids, context=None): ids_cols = self.pool.get('olap.database.columns').search(cr,uid,([('table_id','=',ids[0])])) id = self.pool.get('ir.ui.view').search(cr,uid,([('name','=','olap.database.columns.tree')]),context = {})[0] return { @@ -356,13 +356,13 @@ 'type': 'ir.actions.act_window', } - def hide_col(self,cr,uid,ids,context = {}): + def hide_col(self, cr, uid, ids, context=None): # To hide all the related columns also for id in ids: self.write(cr,uid,id,{'hide':True}) return {} - def show_col(self,cr,uid,ids,context = {}): + def show_col(self, cr, uid, ids, context=None): # To show or unhide all the columns also for id in ids: self.write(cr,uid,id,{'hide':False}) @@ -391,7 +391,7 @@ 'time': 'TimeStamp without Time Zone', 'number':'NUMBER', } - def _datatypes_get(self,*args,**argv): + def _datatypes_get(self, *args, **argv): return self.datatypes.items() _columns = { 'column_db_name': fields.char('Column DBName',size = 64,required = True,readonly = True), @@ -408,7 +408,7 @@ 'active': lambda * args: True, 'primary_key': lambda * args: False, } - def name_get(self,cr,uid,ids,context = {}): + def name_get(self, cr, uid, ids, context=None): result = [] for t in self.browse(cr,uid,ids,context): if t.name <> t.column_db_name: @@ -510,17 +510,19 @@ order,context = context,count = count) - def hide_col(self,cr,uid,ids,context = {}): - for id in ids: - self.write(cr,uid,id,{'hide':True}) - return {} - - def show_col(self,cr,uid,ids,context = {}): - for id in ids: - self.write(cr,uid,id,{'hide':True}) - return {} - - def field_add(self,cr,uid,ids,context = {}): + def hide_col(self, cr, uid, ids, context=None): + for id in ids: + self.write(cr,uid,id,{'hide':True}) + return {} + + def show_col(self, cr, uid, ids, context=None): + for id in ids: + self.write(cr,uid,id,{'hide':True}) + return {} + + def field_add(self, cr, uid, ids, context=None): + if context is None: + context = {} col_data = self.pool.get('olap.database.columns').read(cr,uid,ids,[],context)[0] ctx_list = [] if col_data['related_to']: @@ -540,7 +542,9 @@ ctx_list = [('client','web'),('app','bi'),('id',parent_id)] return ctx_list - def make_hierarchy(self,cr,uid,ids,context = {}): + def make_hierarchy(self, cr, uid, ids, context=None): + if context is None: + context = {} col_data = self.pool.get('olap.database.columns').read(cr,uid,ids,[],context)[0] ctx_list = [] if context and context.has_key('hier_parent_id')and context['hier_parent_id']: @@ -576,7 +580,7 @@ _name = "olap.cube.table" _description = "Olap cube table" - def write(self,cr,uid,ids,vals,context = None): + def write(self, cr, uid, ids, vals, context=None): if vals and vals.get('available_table_ids',0) and context and (context.has_key('master_dim') or context.has_key('d_id') or context.has_key('parent_schema_id')): new_fields = vals['available_table_ids'][0][2] final = [] @@ -624,7 +628,7 @@ id = self.pool.get('olap.cube.table.line').create(cr,uid,val,context = context) return super(olap_cube_table,self).write(cr,uid,ids,vals,context) - def create(self,cr,uid,vals,context = None): + def create(self, cr, uid, vals, context=None): cube_table_id = super(olap_cube_table,self).create(cr,uid,vals,context) if vals and vals.get('available_table_ids',0) and context and (context.has_key('d_id') or context.has_key('parent_schema_id') or context.has_key('master_dim') or context.has_key('d_id')): lines_ids = vals['available_table_ids'][0][2] @@ -646,7 +650,7 @@ args = [('schema_id','=',dim_obj.cube_id.schema_id.id)] return super(olap_cube_table,self).search(cr,uid,args,offset,limit,order,context = context,count = count) - def _available_table_get(self,cr,uid,ids,name,arg,context = None): + def _available_table_get(self, cr, uid, ids, name, arg, context=None): result = {} parent_table_id = [] parent_table_ids = [] @@ -660,19 +664,25 @@ result[table.id] = [] return result - def _set_schema(self,cr,uid,context = {}): + def _set_schema(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('d_id'): dim_obj = self.pool.get('olap.dimension').browse(cr,uid,int(context['d_id'])) return dim_obj.cube_id.schema_id.id if context and context.has_key('parent_schema_id'): return context['parent_schema_id'] - def _set_name(self,cr,uid,context = {}): + def _set_name(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('d_id'): dim_obj = self.pool.get('olap.dimension').browse(cr,uid,int(context['d_id'])) return dim_obj.cubeAid.table_id.name - def _get_id(self,cr,uid,ids,context = {}): + def _get_id(self, cr, uid, ids, context=None): + if context is None: + context = {} if context and context.has_key('d_id'): dim_obj = self.pool.get('olap.dimension').browse(cr,uid,int(context['d_id'])) table_id = self.pool.get('olap.database.tables').search(cr,uid,[('table_db_name','in',[dim_obj.cube_id.table_id.name]),('fact_database_id','=',dim_obj.cube_id.schema_id.database_id.id)]) @@ -681,7 +691,7 @@ col_ids = self.pool.get('olap.database.columns').search(cr,uid,[('primary_key','=',True),('hide','<>',True)]) return col_ids - def _def_set(self,cr,uid,context = {}): + def _def_set(self, cr, uid, context=None): return [] _columns = { @@ -700,7 +710,7 @@ _defaults = { 'schema_id':_set_schema, } - def field_add(self,cr,uid,ids,context = {}): + def field_add(self, cr, uid, ids, context=None): return {} olap_cube_table() @@ -714,7 +724,7 @@ 'field_id': fields.many2one('olap.database.columns','Link Field'), } # Set the Table when changing field_id - def onchange_field_id(self,*args,**argv): + def onchange_field_id(self, *args, **argv): pass olap_cube_table_line() @@ -722,7 +732,9 @@ _name = "olap.cube" _description = "Olap cube" - def _set_schema(self,cr,uid,context = {}): + def _set_schema(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('schema_id'): return context['schema_id'] return False @@ -765,7 +777,9 @@ _name = "olap.dimension" _description = "Olap dimension" - def _set_cube(self,cr,uid,context = {}): + def _set_cube(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('cube_id'): return context['cube_id'] return False @@ -793,18 +807,22 @@ 'many2one': 'Many2one' } - def _set_dimension(self,cr,uid,context = {}): + def _set_dimension(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('dimension_id'): return context['dimension_id'] return False - def _set_name(self,cr,uid,context = {}): + def _set_name(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('dimension_id'): dim_obj = self.pool.get('olap.dimension').browse(cr,uid,int(context['dimension_id'])) return dim_obj.name return False - def _hierarchy_get(self,*args,**argv): + def _hierarchy_get(self, *args, **argv): return self.hierarchy_type.items() _columns = { @@ -836,17 +854,21 @@ 'date_month': levels.level_date_month() } - def _set_hierarchy(self,cr,uid,context = {}): + def _set_hierarchy(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('hierarchy_id'): return context['hierarchy_id'] return False - def _set_name(self,cr,uid,context = {}): + def _set_name(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('hierarchy_id'): hier_obj = self.pool.get('olap.hierarchy').browse(cr,uid,int(context['hierarchy_id'])) return hier_obj.name - def onchange_column_name(self,cr,uid,ids,column,context = {}): + def onchange_column_name(self, cr, uid, ids, column, context=None): if not column: return {} val = {} @@ -857,7 +879,7 @@ val['type'] = 'date_year' return {'value':val} - def _type_get(self,cr,uid,*args,**argv): + def _type_get(self, cr, uid, *args, **argv): keys = self._types.keys() return map(lambda x: (x,x),keys) @@ -887,12 +909,14 @@ _name = "olap.measure" _description = "Olap measure" - def _set_cube(self,cr,uid,context = {}): + def _set_cube(self, cr, uid, context=None): + if context is None: + context = {} if context and context.has_key('cube_id'): return context['cube_id'] return False - def onchange_measure_name(self,cr,uid,ids,column,context = {}): + def onchange_measure_name(self, cr, uid, ids, column, context=None): val = {} if not column: return {} @@ -986,13 +1010,13 @@ class bi_load_db_wizard(osv.osv_memory): _name = 'bi.load.db.wizard' - def _get_fact_table(self,cr,uid,ctx): + def _get_fact_table(self, cr, uid, ctx): if ctx and ctx.has_key('active_id'): schema_obj = self.pool.get('olap.schema').browse(cr,uid,ctx['active_id']) return schema_obj.name return False - def _get_db_name(self,cr,uid,ctx): + def _get_db_name(self, cr, uid, ctx): if ctx and ctx.has_key('active_id'): schema_obj = self.pool.get('olap.schema').browse(cr,uid,ctx['active_id']) return schema_obj.database_id.name @@ -1008,7 +1032,7 @@ 'db_name':_get_db_name, } - def action_load(self,cr,uid,ids,context = None): + def action_load(self, cr, uid, ids, context=None): if context and context.has_key('active_id'): lines = self.pool.get('olap.schema').browse(cr,uid,context['active_id']) pool = pooler.get_pool(cr.dbname) @@ -1466,7 +1490,7 @@ # } # - def action_cancel(self,cr,uid,ids,context = None): + def action_cancel(self, cr, uid, ids, context=None): return {'type':'ir.actions.act_window_close' } @@ -1480,7 +1504,7 @@ _name = 'bi.auto.configure.wizard' - def _get_name(self,cr,uid,ctx): + def _get_name(self, cr, uid, ctx): if ctx and ctx.has_key('active_id'): schema_obj = self.pool.get('olap.schema').browse(cr,uid,ctx['active_id']) return schema_obj.name @@ -1495,7 +1519,7 @@ 'name':_get_name, } - def action_load(self,cr,uid,ids,context = None): + def action_load(self, cr, uid, ids, context=None): vals = {} apptabnew_vals = {} appfieldnew_vals = {} @@ -1617,7 +1641,7 @@ return {'type':'ir.actions.act_window_close' } - def action_cancel(self,cr,uid,ids,context = None): + def action_cancel(self, cr, uid, ids, context=None): return {'type':'ir.actions.act_window_close' } @@ -1628,7 +1652,7 @@ _name = "olap.warehouse.wizard" _description = "Olap Warehouse" - def _get_queries(self, cr, uid, context = {}): + def _get_queries(self, cr, uid, context=None): query_obj = self.pool.get('olap.query.logs') qry_ids = query_obj.search(cr, uid, [('user_id','=',uid),('count','>=',3)]) if qry_ids: @@ -1655,7 +1679,7 @@ _name = "olap.parameters.config.wizard" _description = "Olap Server Parameters" - def _get_host(self,cr,uid,context = None): + def _get_host(self, cr, uid, context=None): obj = self.pool.get('olap') objid = self.pool.get('ir.model.data') aid = objid._get_id(cr,uid,'olap','menu_url_cube_browser') @@ -1664,7 +1688,7 @@ s_p = Literal("http://").suppress() + Word(alphanums + "_" + ".") + Literal(":").suppress() + Word(nums) + Literal("/").suppress() + Word(alphanums + "_" + " ").suppress() return s_p.parseString(aid.url)[0] - def _get_port(self,cr,uid,context = None): + def _get_port(self, cr, uid, context=None): obj = self.pool.get('olap') objid = self.pool.get('ir.model.data') aid = objid._get_id(cr,uid,'olap','menu_url_cube_browser') @@ -1685,7 +1709,7 @@ 'host_port': _get_port, } - def action_cancel(self,cr,uid,ids,conect = None): + def action_cancel(self, cr, uid, ids, conect=None): return { 'view_type': 'form', "view_mode": 'form', @@ -1694,7 +1718,7 @@ 'target':'new', } - def action_config(self,cr,uid,ids,context = None): + def action_config(self, cr, uid, ids, context=None): conf = self.browse(cr,uid,ids[0],context) obj = self.pool.get('olap') objid = self.pool.get('ir.model.data') === modified file 'olap/wizard/__init__.py' (properties changed: +x to -x) === modified file 'olap/wizard/wizard_application_configure.py' (properties changed: +x to -x) --- olap/wizard/wizard_application_configure.py 2010-02-24 10:55:29 +0000 +++ olap/wizard/wizard_application_configure.py 2010-03-10 10:58:43 +0000 @@ -43,7 +43,7 @@ class wizard_application_configure(wizard.interface): - def configure_application(self,cr,uid,data,context): + def configure_application(self, cr, uid, data, context): vals={} apptabnew_vals={} === modified file 'olap/wizard/wizard_clear_logs.py' (properties changed: +x to -x) --- olap/wizard/wizard_clear_logs.py 2010-02-24 10:55:29 +0000 +++ olap/wizard/wizard_clear_logs.py 2010-03-10 10:58:43 +0000 @@ -48,12 +48,12 @@ } -def clear_logs(self,cr,uid,part,context={}): +def clear_logs(self, cr, uid, part, context=None): ids=pooler.get_pool(cr.dbname).get('olap.query.logs').search(cr,uid,[('user_id','=',uid)]) pooler.get_pool(cr.dbname).get('olap.query.logs').unlink(cr, uid,ids,context) return {} -def _getdata(self,cr,uid,part,context={}): +def _getdata(self, cr, uid, part, context=None): ids=pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid) part['form']['user_name']=ids['name'] # part['form']['db_name']=lines.database_id.db_name === modified file 'olap/wizard/wizard_load_columns.py' (properties changed: +x to -x) --- olap/wizard/wizard_load_columns.py 2010-02-24 10:55:29 +0000 +++ olap/wizard/wizard_load_columns.py 2010-03-10 10:58:43 +0000 @@ -30,7 +30,7 @@ import pooler class wizard_load_columns(wizard.interface): - def _get_table_data(self, cr, uid, data, context={}): + def _get_table_data(self, cr, uid, data, context=None): pool_obj = pooler.get_pool(cr.dbname) ids_cols=pool_obj.get('olap.database.columns').search(cr, uid, ([('table_id','=',data['id'])]),context={}) model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_olap_database_columns_form')],context={}) === modified file 'olap/wizard/wizard_load_configured_table.py' (properties changed: +x to -x) --- olap/wizard/wizard_load_configured_table.py 2010-02-24 10:55:29 +0000 +++ olap/wizard/wizard_load_configured_table.py 2010-03-10 10:58:43 +0000 @@ -31,7 +31,7 @@ import netsvc class wizard_load_configured_table(wizard.interface): - def _get_table_data(self, cr, uid, data, context={}): + def _get_table_data(self, cr, uid, data, context=None): pool_obj = pooler.get_pool(cr.dbname) # vals={} === modified file 'olap/wizard/wizard_load_data.py' (properties changed: +x to -x) --- olap/wizard/wizard_load_data.py 2010-02-24 10:55:29 +0000 +++ olap/wizard/wizard_load_data.py 2010-03-10 10:58:43 +0000 @@ -57,7 +57,7 @@ 'db_name': {'string':'Database Name', 'type':'char','size':'64', 'required':True, 'readonly':True}, } -def olap_db_connect(self,cr,uid,part,context={}): +def olap_db_connect(self, cr, uid, part, context=None): pool = pooler.get_pool(cr.dbname) lines=pool.get('olap.schema').browse(cr, uid, part['id'],context) id_db=lines.database_id.id @@ -380,7 +380,7 @@ wf_service.trg_validate(uid, 'olap.schema', part['id'], 'dbload', cr) return {} -def _getdata(self,cr,uid,part,context={}): +def _getdata(self, cr, uid, part, context=None): lines=pooler.get_pool(cr.dbname).get('olap.schema').browse(cr, uid, part['id'],context) part['form']['fact_table']=lines.database_id.name part['form']['db_name']=lines.database_id.db_name === modified file 'olap/wizard/wizard_query_builder.py' (properties changed: +x to -x) --- olap/wizard/wizard_query_builder.py 2010-02-24 10:55:29 +0000 +++ olap/wizard/wizard_query_builder.py 2010-03-10 10:58:43 +0000 @@ -57,7 +57,7 @@ return res -def get_details(self, cr, uid,data, context): +def get_details(self, cr, uid, data, context): """ To Fetch dimension of selected schema """ @@ -237,4 +237,4 @@ 'result':{'type':'form','arch':query_builder_fetch_form,'fields':query_builder_fetch_fields,'state':[('ok', 'Fetch Data')]}, }, } -wizard_query_builder('olap.query_builder') \ No newline at end of file +wizard_query_builder('olap.query_builder') === modified file 'olap/wizard/wizard_test_connection.py' (properties changed: +x to -x) --- olap/wizard/wizard_test_connection.py 2010-02-24 10:55:29 +0000 +++ olap/wizard/wizard_test_connection.py 2010-03-10 10:58:43 +0000 @@ -8,7 +8,7 @@ _connection_arch = UpdateableStr() -def _test_connection(self,cr,uid,part,context={}): +def _test_connection(self, cr, uid, part, context=None): lines=pooler.get_pool(cr.dbname).get('olap.fact.database').browse(cr, uid, part['id'],context) host = lines.db_host port = lines.db_port === modified file 'olap_crm/__init__.py' (properties changed: +x to -x) --- olap_crm/__init__.py 2010-02-24 10:55:29 +0000 +++ olap_crm/__init__.py 2010-03-10 10:58:46 +0000 @@ -19,4 +19,4 @@ # ############################################################################## -import olap_crm \ No newline at end of file +import olap_crm === modified file 'olap_extract/__init__.py' (properties changed: +x to -x) --- olap_extract/__init__.py 2010-02-24 10:55:29 +0000 +++ olap_extract/__init__.py 2010-03-10 10:58:34 +0000 @@ -20,4 +20,4 @@ ############################################################################## import olap_extract -import wizard_olap_extract \ No newline at end of file +import wizard_olap_extract === modified file 'olap_extract/wizard_olap_extract.py' (properties changed: +x to -x) --- olap_extract/wizard_olap_extract.py 2010-02-24 10:55:29 +0000 +++ olap_extract/wizard_olap_extract.py 2010-03-10 10:58:34 +0000 @@ -40,13 +40,15 @@ class wizard_olap_extract(wizard.interface): - def zipper(self,zipname,filename,mode="a"): + def zipper(self, zipname, filename, mode="a"): z = zipfile.ZipFile(zipname+".zip", mode) z.write(filename) print "\n",z.printdir() - def write_csv(self,filename,content=[]): + def write_csv(self, filename, content=None): + if content is None: + content = [] fid = open(filename, 'w') if fid == -1: print 'File: temp.csv not found or could not be opened' @@ -58,7 +60,7 @@ fid.close return True - def table_depth(self,cr,uid,list=[],context={}): + def table_depth(self, cr, uid, list=None, context=None): res={} templeft={} @@ -85,7 +87,7 @@ return res - def _extract_schema(self, cr, uid, data, context={}): + def _extract_schema(self, cr, uid, data, context=None): _name = data['form']['module_name'] _modulename = "olap_"+_name === modified file 'olap_sale/__init__.py' (properties changed: +x to -x) --- olap_sale/__init__.py 2010-02-24 10:55:29 +0000 +++ olap_sale/__init__.py 2010-03-10 10:58:49 +0000 @@ -19,4 +19,4 @@ # ############################################################################## -import olap_sale \ No newline at end of file +import olap_sale === modified file 'point_of_sale/account_bank_statement.py' --- point_of_sale/account_bank_statement.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/account_bank_statement.py 2010-03-10 10:58:38 +0000 @@ -58,7 +58,7 @@ return {'value':{'subtotal': sub or 0.0}} - def on_change_sub(self, cr, uid, ids, pieces, number,*a): + def on_change_sub(self, cr, uid, ids, pieces, number, *a): sub=pieces*number return {'value':{'subtotal': sub or 0.0}} @@ -92,7 +92,7 @@ res2[statement.id]=encoding_total return res2 - def _default_journal_id(self, cr, uid, context={}): + def _default_journal_id(self, cr, uid, context=None): company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id print [('type','=','cash'),('auto_cash','=',False), ('company_id', '=', company_id)] journal = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('auto_cash','=',False), ('company_id', '=', company_id)]) === modified file 'point_of_sale/pos.py' --- point_of_sale/pos.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/pos.py 2010-03-10 10:58:38 +0000 @@ -76,14 +76,14 @@ _order = "date_order, create_date desc" _order = "date_order desc" - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): for rec in self.browse(cr, uid, ids, context=context): for rec_statement in rec.statement_ids: if (rec_statement.statement_id and rec_statement.statement_id.state=='confirm') or rec.state=='done': raise osv.except_osv(_('Invalid action !'), _('Cannot delete a point of sale which is closed or contains confirmed cashboxes!')) return super(pos_order, self).unlink(cr, uid, ids, context=context) - def onchange_partner_pricelist(self, cr, uid, ids, part, context={}): + def onchange_partner_pricelist(self, cr, uid, ids, part, context=None): if not part: return {} pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id @@ -250,7 +250,7 @@ res = prop_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context) return res - def copy(self, cr, uid, id, default=None, context={}): + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} default.update({ @@ -265,7 +265,7 @@ }) return super(pos_order, self).copy(cr, uid, id, default, context) - def _get_v( self, cr, uid, ids,*a): + def _get_v(self, cr, uid, ids, *a): flag=False res_company = self.pool.get('res.company') res_obj = self.pool.get('res.users') @@ -359,7 +359,7 @@ else: return False - def _journal_default(self, cr, uid, context={}): + def _journal_default(self, cr, uid, context=None): journal_list = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')]) if journal_list: return journal_list[0] @@ -384,7 +384,7 @@ } - def test_order_lines(self, cr, uid, order, context={}): + def test_order_lines(self, cr, uid, order, context=None): if not order.lines: raise osv.except_osv(_('Error'), _('No order lines defined for this sale.')) @@ -392,7 +392,7 @@ wf_service.trg_validate(uid, 'pos.order', order.id, 'paid', cr) return True - def dummy_button(self, cr, uid, order, context={}): + def dummy_button(self, cr, uid, order, context=None): return True def test_paid(self, cr, uid, ids, context=None): @@ -464,7 +464,7 @@ # delete it in the new picking: line.unlink(context=context) - def create_picking(self, cr, uid, ids, context={}): + def create_picking(self, cr, uid, ids, context=None): """Create a picking for each order and validate it.""" picking_obj = self.pool.get('stock.picking') @@ -649,7 +649,7 @@ return order_line_id - def refund(self, cr, uid, ids, context={}): + def refund(self, cr, uid, ids, context=None): clone_list = [] line_obj = self.pool.get('pos.order.line') @@ -673,7 +673,7 @@ }) return clone_list - def action_invoice(self, cr, uid, ids, context={}): + def action_invoice(self, cr, uid, ids, context=None): res_obj = self.pool.get('res.company') inv_ref = self.pool.get('account.invoice') inv_line_ref = self.pool.get('account.invoice.line') @@ -1077,7 +1077,7 @@ self.write(cr,uid,ids,{'price_unit':price}) return {'value': {'price_unit': price}, 'qty': 1} - def onchange_subtotal(self, cr, uid, ids, discount, price, pricelist,qty,partner_id, product_id,*a): + def onchange_subtotal(self, cr, uid, ids, discount, price, pricelist, qty, partner_id, product_id, *a): prod_obj = self.pool.get('product.product') price_f = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id) prod_id='' @@ -1089,7 +1089,7 @@ return {'value':{'discount':disc, 'price_unit':price_f}}#,'notice':''}}#, 'price_subtotal':(price_f*qty*(1-disc))}} return {} - def onchange_ded(self, cr, uid,ids, val_ded,price_u,*a): + def onchange_ded(self, cr, uid, ids, val_ded, price_u, *a): pos_order = self.pool.get('pos.order.line') res_obj = self.pool.get('res.users') res_company = self.pool.get('res.company') @@ -1101,7 +1101,7 @@ return {'value': {'discount':val, 'notice':'' }} return {'value': {'discount':val}} - def onchange_discount(self, cr, uid,ids, discount,price,*a): + def onchange_discount(self, cr, uid, ids, discount, price, *a): pos_order = self.pool.get('pos.order.line') res_obj = self.pool.get('res.users') res_company = self.pool.get('res.company') @@ -1146,12 +1146,12 @@ 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, } - def create(self, cr, user, vals, context={}): + def create(self, cr, user, vals, context=None): if vals.get('product_id'): return super(pos_order_line, self).create(cr, user, vals, context) return False - def write(self, cr, user, ids, values, context={}): + def write(self, cr, user, ids, values, context=None): if 'product_id' in values and not values['product_id']: return False return super(pos_order_line, self).write(cr, user, ids, values, context) @@ -1209,14 +1209,14 @@ _name = 'pos.payment' _description = 'Pos Payment' - def _journal_get(self, cr, uid, context={}): + def _journal_get(self, cr, uid, context=None): obj = self.pool.get('account.journal') ids = obj.search(cr, uid, [('type', '=', 'cash')]) res = obj.read(cr, uid, ids, ['id', 'name'], context) res = [(r['id'], r['name']) for r in res] return res - def _journal_default(self, cr, uid, context={}): + def _journal_default(self, cr, uid, context=None): journal_list = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')]) if journal_list: return journal_list[0] @@ -1239,12 +1239,12 @@ 'payment_date': lambda *a: time.strftime('%Y-%m-%d'), } - def create(self, cr, user, vals, context={}): + def create(self, cr, user, vals, context=None): if vals.get('journal_id') and vals.get('amount'): return super(pos_payment, self).create(cr, user, vals, context) return False - def write(self, cr, user, ids, values, context={}): + def write(self, cr, user, ids, values, context=None): if 'amount' in values and not values['amount']: return False if 'journal_id' in values and not values['journal_id']: @@ -1474,7 +1474,7 @@ class account_move_line(osv.osv): _inherit = 'account.move.line' - def create(self, cr, user, vals, context={}): + def create(self, cr, user, vals, context=None): pos_obj = self.pool.get('pos.order') val_name = vals.get('name', '') val_ref = vals.get('ref', '') @@ -1493,7 +1493,7 @@ class account_move(osv.osv): _inherit = 'account.move' - def create(self, cr, user, vals, context={}): + def create(self, cr, user, vals, context=None): pos_obj = self.pool.get('pos.order') val_name = vals.get('name', '') val_ref = vals.get('ref', '') === modified file 'point_of_sale/pos_account_bank_statement.py' --- point_of_sale/pos_account_bank_statement.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/pos_account_bank_statement.py 2010-03-10 10:58:37 +0000 @@ -36,7 +36,7 @@ account_bank_statement() class account_bank_statement_line(osv.osv): - def _default_company(self, cr, uid, context={}): + def _default_company(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if user.company_id: return user.company_id.id === modified file 'point_of_sale/report/all_closed_cashbox_of_the_day.py' --- point_of_sale/report/all_closed_cashbox_of_the_day.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/all_closed_cashbox_of_the_day.py 2010-03-10 10:58:37 +0000 @@ -44,7 +44,7 @@ user = self.cr.fetchone() return user[0] - def _get_data(self,user): + def _get_data(self, user): data = {} sql = """ SELECT abs.journal_id,abs.id,abs.date,abs.closing_date,abs.name as statement,aj.name as journal,ap.name as period,ru.name as user,rc.name as company, abs.state,abs.balance_end_real FROM account_bank_statement as abs @@ -57,7 +57,7 @@ data = self.cr.dictfetchall() return data - def _get_lines(self,statement): + def _get_lines(self, statement): data = {} sql = """ select absl.* from account_bank_statement_line as absl, account_bank_statement as abs where absl.statement_id = abs.id and abs.id = %d"""%(statement['id']) @@ -65,7 +65,7 @@ data = self.cr.dictfetchall() return data - def _get_bal(self,data): + def _get_bal(self, data): res = {} sql =""" select sum(pieces*number) as bal from singer_statement where starting_id = %d """%(data['id']) self.cr.execute(sql) @@ -75,7 +75,7 @@ else : return False - def _get_sub_total(self,user,data,date): + def _get_sub_total(self, user, data, date): res={} self.cr.execute(""" select sum(absl.amount) from account_bank_statement as abs LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id @@ -102,7 +102,7 @@ return 0.00 - def _get_net_total_starting(self,user): + def _get_net_total_starting(self, user): lst = [] res={} total_ending_bal = 0.0 @@ -124,7 +124,7 @@ lst.append(total_starting_bal) return lst - def _get_net_total(self,user): + def _get_net_total(self, user): lst = [] res={} total_ending_bal = 0.0 === modified file 'point_of_sale/report/pos_details.py' --- point_of_sale/report/pos_details.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_details.py 2010-03-10 10:58:37 +0000 @@ -26,7 +26,7 @@ class pos_details(report_sxw.rml_parse): - def _get_invoice(self,inv_id,user): + def _get_invoice(self, inv_id, user): res={} self.cr.execute("select name from account_invoice as ac where id = %d" %(inv_id)) res = self.cr.fetchone() @@ -35,7 +35,7 @@ else: return '' - def _pos_sales_details(self,form,user): + def _pos_sales_details(self, form, user): data={} self.cr.execute ("select po.name as pos_name,po.date_order,pt.name ,pol.qty,pol.price_unit,pol.discount,po.invoice_id,sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,res_users as ru,res_company as rc " \ @@ -53,7 +53,7 @@ else: return {} - def _get_qty_total_2(self, form,user): + def _get_qty_total_2(self, form, user): qty=[] self.cr.execute("select sum(pol.qty) as qty " \ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,res_users as ru,res_company as rc " \ @@ -64,12 +64,12 @@ qty = self.cr.fetchone() return qty[0] or 0.00 - def _get_sales_total_2(self, form,user): + def _get_sales_total_2(self, form, user): self.cr.execute("sELECT sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total from pos_order_line as pol , pos_order po, product_product as pp,product_template as pt where po.company_id='%s' and po.id=pol.order_id and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= '%s' and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= '%s' and po.state in ('paid','invoiced','done') and pt.id=pp.product_tmpl_id and pol.product_id=pp.id"% (str(user.company_id.id),form['date_start'],form['date_end'])) res2=self.cr.fetchone() return res2 and res2[0] or 0.0 - def _get_sum_invoice_2(self,form,user): + def _get_sum_invoice_2(self, form, user): res2=[] self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))" \ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt ,res_users as ru,res_company as rc " \ @@ -81,7 +81,7 @@ self.total_invoiced=res2[0] return res2[0] or False - def _paid_total_2(self,form,user): + def _paid_total_2(self, form, user): res3=[] self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))" \ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, res_users as ru,res_company as rc " \ @@ -115,7 +115,7 @@ objects, 0.0) - def _get_payments(self, form,user, ignore_gift=False): + def _get_payments(self, form, user, ignore_gift=False): # gift_journal_id = None # if ignore_gift: # config_journal_ids = self.pool.get("pos.config.journal").search(self.cr, self.uid, [('code', '=', 'GIFT')]) === modified file 'point_of_sale/report/pos_details_summary.py' --- point_of_sale/report/pos_details_summary.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_details_summary.py 2010-03-10 10:58:36 +0000 @@ -78,7 +78,7 @@ [o for o in objects if o.invoice_id and o.invoice_id.number], 0.0) - def _ellipsis(self, string, maxlen=100, ellipsis = '...'): + def _ellipsis(self, string, maxlen=100, ellipsis='...'): ellipsis = ellipsis or '' return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen] === modified file 'point_of_sale/report/pos_lines.py' --- point_of_sale/report/pos_lines.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_lines.py 2010-03-10 10:58:37 +0000 @@ -43,7 +43,7 @@ self.total = tot return self.total - def __taxes__(self,obj): + def __taxes__(self, obj): self.cr.execute ( " Select acct.name from pos_order as po " \ " LEFT JOIN pos_order_line as pol ON po.id = pol.order_id " \ " LEFT JOIN product_taxes_rel as ptr ON pol.product_id = ptr.prod_id " \ === modified file 'point_of_sale/report/pos_payment_report.py' --- point_of_sale/report/pos_payment_report.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_payment_report.py 2010-03-10 10:58:37 +0000 @@ -34,7 +34,7 @@ 'pos_payment_total':self._pos_payment_total, }) - def _pos_payment(self,obj): + def _pos_payment(self, obj): data={} sql = """ select id from pos_order where id = %d"""%(obj.id) self.cr.execute(sql) @@ -58,7 +58,7 @@ return data - def _pos_payment_total(self,o): + def _pos_payment_total(self, o): # res=[] # self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \ # "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \ === modified file 'point_of_sale/report/pos_payment_report_date.py' --- point_of_sale/report/pos_payment_report_date.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_payment_report_date.py 2010-03-10 10:58:37 +0000 @@ -34,7 +34,7 @@ 'pos_payment_date_total':self.__pos_payment_date__total__, }) - def __pos_payment_date__(self,form): + def __pos_payment_date__(self, form): dt1 = form['date_start'] + ' 00:00:00' dt2 = form['date_end'] + ' 23:59:59' data={} @@ -47,7 +47,7 @@ data=self.cr.dictfetchall() return data - def __pos_payment_date__total__(self,form): + def __pos_payment_date__total__(self, form): dt1 = form['date_start'] + ' 00:00:00' dt2 = form['date_end'] + ' 23:59:59' res=[] === modified file 'point_of_sale/report/pos_payment_report_user.py' --- point_of_sale/report/pos_payment_report_user.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_payment_report_user.py 2010-03-10 10:58:37 +0000 @@ -33,7 +33,7 @@ 'pos_payment_user_total':self.__pos_payment_user__total__, }) - def __pos_payment_user__(self,form): + def __pos_payment_user__(self, form): data={} ids = form['user_id'][0][-1] idss = map(str, ids) === modified file 'point_of_sale/report/pos_sales_user.py' --- point_of_sale/report/pos_sales_user.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_sales_user.py 2010-03-10 10:58:37 +0000 @@ -34,7 +34,7 @@ }) - def _get_data(self,form): + def _get_data(self, form): dt1 = form['date_start'] + ' 00:00:00' dt2 = form['date_end'] + ' 23:59:59' data={} === modified file 'point_of_sale/report/pos_sales_user_today.py' --- point_of_sale/report/pos_sales_user_today.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_sales_user_today.py 2010-03-10 10:58:37 +0000 @@ -34,7 +34,7 @@ }) - def _get_data(self,form): + def _get_data(self, form): data={} ids = form['user_id'][0][-1] idss = map(str, ids) === modified file 'point_of_sale/report/pos_users_product.py' --- point_of_sale/report/pos_users_product.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/report/pos_users_product.py 2010-03-10 10:58:37 +0000 @@ -35,7 +35,7 @@ 'get_total':self._get_total, }) - def _get_data(self,o): + def _get_data(self, o): data={} sql1=""" SELECT distinct(o.id) from account_bank_statement s, account_bank_statement_line l,pos_order o,pos_order_line i where i.order_id=o.id and o.state='paid' and l.statement_id=s.id and l.pos_statement_id=o.id and s.id=%d"""%(o.id) self.cr.execute(sql1) @@ -52,7 +52,7 @@ self.total += d['amt'] return data - def _get_user(self,object): + def _get_user(self, object): for o in object : sql = """select ru.name from account_bank_statement as abs,res_users ru where abs.user_id = ru.id === modified file 'point_of_sale/wizard/wizard_pos_sales_user.py' --- point_of_sale/wizard/wizard_pos_sales_user.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/wizard/wizard_pos_sales_user.py 2010-03-10 10:58:38 +0000 @@ -66,4 +66,4 @@ 'state' : 'end'} }, } -wizard_pos_sales_user('pos.sales.user') \ No newline at end of file +wizard_pos_sales_user('pos.sales.user') === modified file 'point_of_sale/wizard/wizard_receipt.py' --- point_of_sale/wizard/wizard_receipt.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/wizard/wizard_receipt.py 2010-03-10 10:58:37 +0000 @@ -29,7 +29,7 @@ import pooler from tools.translate import _ -def _check(self,cr,uid,data,*a): +def _check(self, cr, uid, data, *a): pool = pooler.get_pool(cr.dbname) order_lst = pool.get('pos.order').browse(cr,uid,data['ids']) for order in order_lst: === modified file 'point_of_sale/wizard/wizard_refund_order.py' --- point_of_sale/wizard/wizard_refund_order.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/wizard/wizard_refund_order.py 2010-03-10 10:58:37 +0000 @@ -42,7 +42,7 @@ ''' -def _get_journal(self,cr,uid,context): +def _get_journal(self, cr, uid, context): pool = pooler.get_pool(cr.dbname) obj = pool.get('account.journal') user = pool.get('res.users').browse(cr, uid, uid) @@ -52,7 +52,7 @@ res.insert(0, ('', '')) return res -def _get_pdt(self,cr,uid,context): +def _get_pdt(self, cr, uid, context): pool = pooler.get_pool(cr.dbname) obj = pool.get('product.product') ids = obj.search(cr, uid, [('income_pdt', '=', True)]) @@ -61,7 +61,7 @@ res.insert(0, ('', '')) return res -def _get_pdt_exp(self,cr,uid,context): +def _get_pdt_exp(self, cr, uid, context): pool = pooler.get_pool(cr.dbname) obj = pool.get('product.product') company_id = pool.get('res.users').browse(cr, uid, uid).company_id.id === modified file 'point_of_sale/wizard/wizard_return.py' --- point_of_sale/wizard/wizard_return.py 2010-02-24 10:55:29 +0000 +++ point_of_sale/wizard/wizard_return.py 2010-03-10 10:58:37 +0000 @@ -324,7 +324,7 @@ 'type': 'ir.actions.act_window' } return act -def test(self,cr,uid,data,context={}): +def test(self, cr, uid, data, context=None): # import pdb; pdb.set_trace() data['id']=data['res_id'] return {'id':data['res_id']} @@ -337,7 +337,9 @@ #def _test_exist1(self,cr,uid,data,context={}): # return 'choice' -def _test_exist(self,cr,uid,data,context={}): +def _test_exist(self, cr, uid, data, context=None): +if context is None: + context = {} # order_obj= pooler.get_pool(cr.dbname).get('pos.order') # order_line_obj= pooler.get_pool(cr.dbname).get('pos.order.line') # obj=order_obj.browse(cr,uid, data['ids'])[0] === modified file 'process/process.py' --- process/process.py 2010-02-24 10:55:29 +0000 +++ process/process.py 2010-03-10 10:58:50 +0000 @@ -254,7 +254,7 @@ return dict(name=name, resource=resource, state=state, perm=perm, notes=notes, nodes=nodes, transitions=transitions) - def copy(self, cr, uid, id, default=None, context={}): + def copy(self, cr, uid, id, default=None, context=None): """ Deep copy the entire process. """ @@ -318,7 +318,7 @@ 'flow_start': lambda *args: False, } - def copy_data(self, cr, uid, id, default=None, context={}): + def copy_data(self, cr, uid, id, default=None, context=None): if not default: default = {} default.update({ @@ -375,7 +375,7 @@ 'state': lambda *args: 'dummy', } - def copy_data(self, cr, uid, id, default=None, context={}): + def copy_data(self, cr, uid, id, default=None, context=None): if not default: default = {} === modified file 'product/pricelist.py' --- product/pricelist.py 2010-03-06 20:52:19 +0000 +++ product/pricelist.py 2010-03-10 10:58:39 +0000 @@ -37,7 +37,7 @@ When a field is a price, you can use it in pricelists to base sale and purchase prices based on some fields of the product. """ - def _price_field_get(self, cr, uid, context={}): + def _price_field_get(self, cr, uid, context=None): mf = self.pool.get('ir.model.fields') ids = mf.search(cr, uid, [('model','in', (('product.product'),('product.template'))), ('ttype','=','float')], context=context) res = [] @@ -82,7 +82,7 @@ class product_pricelist(osv.osv): - def _pricelist_type_get(self, cr, uid, context={}): + def _pricelist_type_get(self, cr, uid, context=None): pricelist_type_obj = self.pool.get('product.pricelist.type') pricelist_type_ids = pricelist_type_obj.search(cr, uid, [], order='name') pricelist_types = pricelist_type_obj.read(cr, uid, pricelist_type_ids, ['key','name'], context=context) @@ -106,7 +106,7 @@ 'company_id': fields.many2one('res.company', 'Company'), } - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): result= [] if not all(ids): return result @@ -293,7 +293,7 @@ } # We desactivate duplicated pricelists, so that dates do not overlap - def copy(self, cr, uid, id, default=None,context={}): + def copy(self, cr, uid, id, default=None, context=None): if not default: default= {} default['active'] = False return super(product_pricelist_version, self).copy(cr, uid, id, default, context) @@ -328,7 +328,7 @@ product_pricelist_version() class product_pricelist_item(osv.osv): - def _price_field_get(self, cr, uid, context={}): + def _price_field_get(self, cr, uid, context=None): pt = self.pool.get('product.price.type') ids = pt.search(cr, uid, [], context=context) result = [] @@ -391,7 +391,7 @@ (_check_recursion, _('Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList Item!'), ['base_pricelist_id']) ] - def product_id_change(self, cr, uid, ids, product_id, context={}): + def product_id_change(self, cr, uid, ids, product_id, context=None): if not product_id: return {} prod = self.pool.get('product.product').read(cr, uid, [product_id], ['code','name']) === modified file 'product/product.py' --- product/product.py 2010-03-06 19:55:00 +0000 +++ product/product.py 2010-03-10 10:58:39 +0000 @@ -117,7 +117,7 @@ from_unit, to_unit = uoms[-1], uoms[0] return self._compute_qty_obj(cr, uid, from_unit, qty, to_unit) - def _compute_qty_obj(self, cr, uid, from_unit, qty, to_unit, context={}): + def _compute_qty_obj(self, cr, uid, from_unit, qty, to_unit, context=None): if from_unit.category_id.id <> to_unit.category_id.id: return qty if from_unit.factor_inv_data: @@ -231,7 +231,7 @@ class product_template(osv.osv): _name = "product.template" _description = "Product Template" - def _calc_seller_delay(self, cr, uid, ids, name, arg, context={}): + def _calc_seller_delay(self, cr, uid, ids, name, arg, context=None): result = {} for product in self.browse(cr, uid, ids, context): if product.seller_ids: @@ -285,12 +285,14 @@ res = cr.fetchone() return res and res[0] or False - def _default_category(self, cr, uid, context={}): + def _default_category(self, cr, uid, context=None): + if context is None: + context = {} if 'categ_id' in context and context['categ_id']: return context['categ_id'] return False - def onchange_uom(self, cursor, user, ids, uom_id,uom_po_id): + def onchange_uom(self, cursor, user, ids, uom_id, uom_po_id): if uom_id and uom_po_id: uom_obj=self.pool.get('product.uom') uom=uom_obj.browse(cursor,user,[uom_id])[0] @@ -338,7 +340,9 @@ (_check_uom, 'Error: The default UOM and the purchase UOM must be in the same category.', ['uom_id']), ] - def name_get(self, cr, user, ids, context={}): + def name_get(self, cr, user, ids, context=None): + if context is None: + context = {} if 'partner_id' in context: pass return super(product_template, self).name_get(cr, user, ids, context) @@ -352,7 +356,9 @@ return _('Products: ')+self.pool.get('product.category').browse(cr, uid, context['categ_id'], context).name return res - def _product_price(self, cr, uid, ids, name, arg, context={}): + def _product_price(self, cr, uid, ids, name, arg, context=None): + if context is None: + context = {} res = {} quantity = context.get('quantity', 1) pricelist = context.get('pricelist', False) @@ -392,20 +398,20 @@ res[product.id] = (res[product.id] or 0.0) * (product.price_margin or 1.0) + product.price_extra return res - def _get_partner_code_name(self, cr, uid, ids, product_id, partner_id, context={}): + def _get_partner_code_name(self, cr, uid, ids, product_id, partner_id, context=None): product = self.browse(cr, uid, [product_id], context)[0] for supinfo in product.seller_ids: if supinfo.name.id == partner_id: return {'code': supinfo.product_code, 'name': supinfo.product_name, 'variants': ''} return {'code' : product.default_code, 'name' : product.name, 'variants': product.variants} - def _product_code(self, cr, uid, ids, name, arg, context={}): + def _product_code(self, cr, uid, ids, name, arg, context=None): res = {} for p in self.browse(cr, uid, ids, context): res[p.id] = self._get_partner_code_name(cr, uid, [], p.id, context.get('partner_id', None), context)['code'] return res - def _product_partner_ref(self, cr, uid, ids, name, arg, context={}): + def _product_partner_ref(self, cr, uid, ids, name, arg, context=None): res = {} for p in self.browse(cr, uid, ids, context): data = self._get_partner_code_name(cr, uid, [], p.id, context.get('partner_id', None), context) @@ -449,7 +455,7 @@ 'pricelist_id': fields.dummy(string='Pricelist',relation='product.pricelist', type='many2one'), } - def onchange_uom(self, cursor, user, ids, uom_id,uom_po_id): + def onchange_uom(self, cursor, user, ids, uom_id, uom_po_id): if uom_id and uom_po_id: uom_obj=self.pool.get('product.uom') uom=uom_obj.browse(cursor,user,[uom_id])[0] @@ -484,7 +490,7 @@ def on_order(self, cr, uid, ids, orderline, quantity): pass - def name_get(self, cr, user, ids, context={}): + def name_get(self, cr, user, ids, context=None): if not len(ids): return [] def _name_get(d): @@ -520,7 +526,7 @@ # # Could be overrided for variants matrices prices # - def price_get(self, cr, uid, ids, ptype='list_price', context={}): + def price_get(self, cr, uid, ids, ptype='list_price', context=None): res = {} product_uom_obj = self.pool.get('product.uom') @@ -590,7 +596,7 @@ _order = 'sequence' - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] res = [] @@ -600,7 +606,7 @@ res.append((pckg.id,p_name)) return res - def _get_1st_ul(self, cr, uid, context={}): + def _get_1st_ul(self, cr, uid, context=None): cr.execute('select id from product_ul order by id asc limit 1') res = cr.fetchone() return (res and res[0]) or False === modified file 'product/report/product_pricelist.py' --- product/report/product_pricelist.py 2010-02-24 10:55:29 +0000 +++ product/report/product_pricelist.py 2010-03-10 10:58:39 +0000 @@ -38,7 +38,7 @@ 'get_titles': self._get_titles, }) - def _get_titles(self,form): + def _get_titles(self, form): lst = [] vals = {} qtys = 1 @@ -50,7 +50,7 @@ lst.append(vals) return lst - def _set_quantity(self,form): + def _set_quantity(self, form): for i in range(1,6): q = 'qty%d'%i if form[q] >0 and form[q] not in self.quantity: @@ -69,7 +69,7 @@ pricelist = pool.get('product.pricelist').read(self.cr,self.uid,[pricelist_id],['currency_id'])[0] return pricelist['currency_id'][1] - def _get_categories(self, products,form): + def _get_categories(self, products, form): cat_ids=[] res=[] self.pricelist = form['price_list'] @@ -101,7 +101,7 @@ res.append({'name':cat['name'],'products':products}) return res - def _get_price(self,pricelist_id, product_id,qty): + def _get_price(self, pricelist_id, product_id, qty): pool = pooler.get_pool(self.cr.dbname) price_dict = pool.get('product.pricelist').price_get(self.cr,self.uid,[pricelist_id],product_id,qty) if price_dict[pricelist_id]: === modified file 'project/project.py' --- project/project.py 2010-03-08 07:17:31 +0000 +++ project/project.py 2010-03-10 10:58:41 +0000 @@ -153,31 +153,35 @@ (_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date']) ] - def set_template(self, cr, uid, ids, context={}): + def set_template(self, cr, uid, ids, context=None): res = self.setActive(cr, uid, ids, value=False, context=context) return res - def set_done(self, cr, uid, ids, context={}): + def set_done(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'close'}, context=context) return True - def set_cancel(self, cr, uid, ids, context={}): + def set_cancel(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'cancelled'}, context=context) return True - def set_pending(self, cr, uid, ids, context={}): + def set_pending(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'pending'}, context=context) return True - def set_open(self, cr, uid, ids, context={}): + def set_open(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'open'}, context=context) return True - def reset_project(self, cr, uid, ids, context={}): + def reset_project(self, cr, uid, ids, context=None): res = self.setActive(cr, uid, ids,value=True, context=context) return res - def copy(self, cr, uid, id, default={},context={}): + def copy(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + if context is None: + context = {} proj = self.browse(cr, uid, id, context=context) default = default or {} context['active_test'] = False @@ -190,7 +194,9 @@ cr.execute('update project_task set active=True where project_id =ANY(%s)',(ids,)) return res - def duplicate_template(self, cr, uid, ids,context={}): + def duplicate_template(self, cr, uid, ids, context=None): + if context is None: + context = {} result = [] for proj in self.browse(cr, uid, ids): parent_id = context.get('parent_id',False) @@ -211,7 +217,7 @@ return result # set active value for a project, its sub projects and its tasks - def setActive(self, cr, uid, ids, value=True, context={}): + def setActive(self, cr, uid, ids, value=True, context=None): for proj in self.browse(cr, uid, ids, context): self.write(cr, uid, [proj.id], {'state': value and 'open' or 'template'}, context) cr.execute('select id from project_task where project_id=%s', (proj.id,)) @@ -229,7 +235,7 @@ _description = "Tasks" _date_name = "date_start" - def _str_get(self, task, level=0, border='***', context={}): + def _str_get(self, task, level=0, border='***', context=None): return border+' '+(task.user_id and task.user_id.name.upper() or '')+(level and (': L'+str(level)) or '')+(' - %.1fh / %.1fh'%(task.effective_hours or 0.0,task.planned_hours))+' '+border+'\n'+ \ border[0]+' '+(task.name or '')+'\n'+ \ (task.description or '')+'\n\n' @@ -252,10 +258,12 @@ res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours return res - def onchange_planned(self, cr, uid, ids, planned = 0.0, effective = 0.0): + def onchange_planned(self, cr, uid, ids, planned=0.0, effective=0.0): return {'value':{'remaining_hours' : planned - effective}} - def _default_project(self, cr, uid, context={}): + def _default_project(self, cr, uid, context=None): + if context is None: + context = {} if 'project_id' in context and context['project_id']: return int(context['project_id']) return False @@ -264,7 +272,9 @@ # ('remaining_hours', 'CHECK (remaining_hours>=0)', 'Please increase and review remaining hours ! It can not be smaller than 0.'), #] - def copy_data(self, cr, uid, id, default={},context={}): + def copy_data(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} default = default or {} default['work_ids'] = [] return super(task, self).copy_data(cr, uid, id, default, context) @@ -481,7 +491,7 @@ cr.execute('update project_task set remaining_hours=remaining_hours - %s where id=%s', (vals.get('hours',0.0), vals['task_id'])) return super(project_work,self).create(cr, uid, vals, *args, **kwargs) - def write(self, cr, uid, ids,vals,context={}): + def write(self, cr, uid, ids, vals, context=None): if 'hours' in vals and (not vals['hours']): vals['hours'] = 0.00 if 'hours' in vals: @@ -497,7 +507,7 @@ class config_compute_remaining(osv.osv_memory): _name='config.compute.remaining' - def _get_remaining(self,cr, uid, ctx): + def _get_remaining(self, cr, uid, ctx): if 'active_id' in ctx: return self.pool.get('project.task').browse(cr,uid,ctx['active_id']).remaining_hours return False @@ -530,7 +540,9 @@ 'description': fields.text('Description'), } - def _default_project(self, cr, uid, context={}): + def _default_project(self, cr, uid, context=None): + if context is None: + context = {} if 'project_id' in context and context['project_id']: return int(context['project_id']) return False === modified file 'project/project_mailgate.py' --- project/project_mailgate.py 2010-02-24 10:55:29 +0000 +++ project/project_mailgate.py 2010-03-10 10:58:42 +0000 @@ -36,7 +36,7 @@ _name = "project.task" _inherit = "project.task" - def msg_new(self, cr, uid, msg): + def msg_new(self, cr, uid, msg): mailgate_obj = self.pool.get('mail.gateway') msg_body = mailgate_obj.msg_body_get(msg) data = { @@ -51,7 +51,9 @@ res = self.create(cr, uid, data) return res - def msg_update(self, cr, uid, id, msg, data={}, default_act='pending'): + def msg_update(self, cr, uid, id, msg, data=None, default_act='pending'): + if data is None: + data = {} mailgate_obj = self.pool.get('mail.gateway') msg_actions, body_data = mailgate_obj.msg_act_get(msg) data.update({ @@ -77,7 +79,7 @@ getattr(self,act)(cr, uid, [id]) return True - def emails_get(self, cr, uid, ids, context={}): + def emails_get(self, cr, uid, ids, context=None): res = [] if isinstance(ids, (str, int, long)): select = [ids] === modified file 'project/project_resource.py' --- project/project_resource.py 2010-02-26 12:47:40 +0000 +++ project/project_resource.py 2010-03-10 10:58:42 +0000 @@ -1,7 +1,7 @@ import pooler import datetime -def timeformat_convert(cr, uid, time_string, context={}): +def timeformat_convert(cr, uid, time_string, context=None): # Function to convert input time string:: 8.5 to output time string 8:30 split_list = str(time_string).split('.') @@ -78,4 +78,4 @@ if non_working: wktime_cal.append((non_working[:-1],time_range)) - return wktime_cal \ No newline at end of file + return wktime_cal === modified file 'project/wizard/close_task.py' --- project/wizard/close_task.py 2010-02-24 10:55:29 +0000 +++ project/wizard/close_task.py 2010-03-10 10:58:42 +0000 @@ -36,7 +36,7 @@ 'description': {'string':'Description', 'type':'text', 'required':'True'}, } -def email_send(cr, uid, ids, to_adr, description, context={}): +def email_send(cr, uid, ids, to_adr, description, context=None): for task in pooler.get_pool(cr.dbname).get('project.task').browse(cr, uid, ids, context): project = task.project_id subject = "Task '%s' closed" % task.name === modified file 'project/wizard/compute_tasks_date.py' --- project/wizard/compute_tasks_date.py 2010-02-26 13:20:06 +0000 +++ project/wizard/compute_tasks_date.py 2010-03-10 10:58:42 +0000 @@ -76,7 +76,7 @@ priority_dict = {'0':1000,'1':800,'2':500,'3':300,'4':100} # To create dynamic no of tasks with the resource specified - def tasks_resource(j,eff,priorty = 500,obj=None): + def tasks_resource(j, eff, priorty=500, obj=None): def task(): """ task is a dynamic method! === modified file 'project_caldav/project_caldav.py' --- project_caldav/project_caldav.py 2010-02-24 10:55:29 +0000 +++ project_caldav/project_caldav.py 2010-03-10 10:58:48 +0000 @@ -29,12 +29,12 @@ 'attendee_ids': fields.many2many('calendar.attendee', \ 'task_attendee_rel', 'task_id', 'attendee_id', 'Attendees'), } - def import_cal(self, cr, uid, data, data_id=None, context={}): + def import_cal(self, cr, uid, data, data_id=None, context=None): todo_obj = self.pool.get('basic.calendar.todo') vals = todo_obj.import_cal(cr, uid, data, context=context) return self.check_import(cr, uid, vals, context=context) - def check_import(self, cr, uid, vals, context={}): + def check_import(self, cr, uid, vals, context=None): ids = [] for val in vals: obj_tm = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.project_time_mode_id === modified file 'project_gtd/project_gtd.py' --- project_gtd/project_gtd.py 2010-02-28 11:20:56 +0000 +++ project_gtd/project_gtd.py 2010-03-10 10:58:52 +0000 @@ -131,7 +131,7 @@ default['context_id']=False return super(project_task,self).copy_data(cr, uid, id, default, context) - def _get_context(self,cr, uid, ctx): + def _get_context(self, cr, uid, ctx): ids = self.pool.get('project.gtd.context').search(cr, uid, [], context=ctx) return ids and ids[0] or False _defaults = { === modified file 'project_issue/project_issue.py' --- project_issue/project_issue.py 2010-03-05 13:25:30 +0000 +++ project_issue/project_issue.py 2010-03-10 10:59:03 +0000 @@ -86,7 +86,7 @@ def convert_to_bug(self, cr, uid, ids, context=None): return self._convert(cr, uid, ids, 'bug_categ', context=context) - def onchange_stage_id(self, cr, uid, ids, stage_id, context={}): + def onchange_stage_id(self, cr, uid, ids, stage_id, context=None): if not stage_id: return {'value':{}} stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context) === modified file 'project_long_term/project.py' --- project_long_term/project.py 2010-03-09 11:52:35 +0000 +++ project_long_term/project.py 2010-03-10 10:58:48 +0000 @@ -223,7 +223,7 @@ self.write(cr, uid, ids, {'state': 'open'}) return True - def set_pending(self, cr, uid, ids,*args): + def set_pending(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state': 'pending'}) return True === modified file 'project_long_term/wizard/compute_phases_date.py' --- project_long_term/wizard/compute_phases_date.py 2010-03-09 11:52:35 +0000 +++ project_long_term/wizard/compute_phases_date.py 2010-03-10 10:58:48 +0000 @@ -42,7 +42,7 @@ } class wizard_compute_phases(wizard.interface): - def _phase_schedule(self, cr, uid, phase, start_date, calendar_id=False, context={}): + def _phase_schedule(self, cr, uid, phase, start_date, calendar_id=False, context=None): """Schedule phase with the start date till all the next phases are completed. === modified file 'project_long_term/wizard/schedule_tasks.py' --- project_long_term/wizard/schedule_tasks.py 2010-03-09 11:52:35 +0000 +++ project_long_term/wizard/schedule_tasks.py 2010-03-10 10:58:48 +0000 @@ -37,7 +37,7 @@ class wizard_schedule_task(wizard.interface): - def _create_resources(self, cr, uid, phase, context={}): + def _create_resources(self, cr, uid, phase, context=None): """ Return a list of Resource Class objects for the resources allocated to the phase. """ === modified file 'project_long_term/wizard/working_calendar.py' --- project_long_term/wizard/working_calendar.py 2010-03-09 11:52:35 +0000 +++ project_long_term/wizard/working_calendar.py 2010-03-10 10:58:48 +0000 @@ -22,7 +22,7 @@ import pooler import datetime -def convert_timeformat(cr, uid, time_string, context={}): +def convert_timeformat(cr, uid, time_string, context=None): """ Convert input time string: 8.5 to output time string 8:30.""" split_list = str(time_string).split('.') @@ -111,4 +111,4 @@ if non_working: wktime_cal.append((non_working[:-1], time_range)) return wktime_cal -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'project_mrp/mrp.py' --- project_mrp/mrp.py 2010-02-24 10:55:29 +0000 +++ project_mrp/mrp.py 2010-03-10 10:59:04 +0000 @@ -26,7 +26,7 @@ _name = "mrp.procurement" _inherit = "mrp.procurement" - def action_produce_assign_service(self, cr, uid, ids, context={}): + def action_produce_assign_service(self, cr, uid, ids, context=None): for procurement in self.browse(cr, uid, ids): sline = self.pool.get('sale.order.line') sale_ids = sline.search(cr, uid, [('procurement_id','=',procurement.id)], context) === modified file 'project_planning/project_planning.py' --- project_planning/project_planning.py 2010-03-03 15:54:52 +0000 +++ project_planning/project_planning.py 2010-03-10 10:58:52 +0000 @@ -69,7 +69,7 @@ result[plan.id] = total_free return result - def _check_planning_responsible(self, cr, uid, ids, context={}): + def _check_planning_responsible(self, cr, uid, ids, context=None): for obj_plan in self.browse(cr,uid,ids): cr.execute(""" SELECT id FROM report_account_analytic_planning plan @@ -116,19 +116,19 @@ (_check_planning_responsible, 'Invalid planning ! Planning dates can\'t overlap for the same responsible. ', ['user_id']) ] - def action_open(self, cr, uid, id, context={}): + def action_open(self, cr, uid, id, context=None): self.write(cr, uid, id, {'state' : 'open'}) return True - def action_cancel(self, cr, uid, id, context={}): + def action_cancel(self, cr, uid, id, context=None): self.write(cr, uid, id, {'state' : 'cancel'}) return True - def action_draft(self, cr, uid, id, context={}): + def action_draft(self, cr, uid, id, context=None): self.write(cr, uid, id, {'state' : 'draft'}) return True - def action_done(self, cr, uid, id, context={}): + def action_done(self, cr, uid, id, context=None): self.write(cr, uid, id, {'state' : 'done'}) return True @@ -139,7 +139,7 @@ _description = "Planning Line" _rec_name = 'user_id' - def name_get(self, cr, uid, ids, context={}): + def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] reads = self.read(cr, uid, ids, ['user_id','planning_id','note'], context) === modified file 'project_retro_planning/project_retro_planning.py' --- project_retro_planning/project_retro_planning.py 2010-02-24 10:55:29 +0000 +++ project_retro_planning/project_retro_planning.py 2010-03-10 10:59:03 +0000 @@ -28,7 +28,7 @@ _inherit = 'project.project' _description = 'project.project' - def write(self, cr, uid, ids,vals, *args, **kwargs): + def write(self, cr, uid, ids, vals, *args, **kwargs): if 'date_end' in vals and vals['date_end']: data_project = self.browse(cr,uid,ids) for prj in data_project: === modified file 'project_timesheet/project_timesheet.py' --- project_timesheet/project_timesheet.py 2010-02-24 10:55:29 +0000 +++ project_timesheet/project_timesheet.py 2010-03-10 10:58:38 +0000 @@ -150,7 +150,7 @@ return super(task,self).unlink(cr, uid, ids, *args, **kwargs) - def write(self, cr, uid, ids,vals,context={}): + def write(self, cr, uid, ids, vals, context=None): if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']): vals_line = {} hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet') === modified file 'purchase/purchase.py' --- purchase/purchase.py 2010-03-06 20:52:19 +0000 +++ purchase/purchase.py 2010-03-10 10:59:04 +0000 @@ -131,7 +131,7 @@ res[r] = 100.0 * res[r][0] / res[r][1] return res - def _get_order(self, cr, uid, ids, context={}): + def _get_order(self, cr, uid, ids, context=None): result = {} for line in self.pool.get('purchase.order.line').browse(cr, uid, ids, context=context): result[line.order_id.id] = True @@ -229,7 +229,7 @@ return super(purchase_order, self).unlink(cr, uid, unlink_ids, context=context) - def button_dummy(self, cr, uid, ids, context={}): + def button_dummy(self, cr, uid, ids, context=None): return True def onchange_dest_address_id(self, cr, uid, ids, adr_id): @@ -254,11 +254,11 @@ fiscal_position = part.property_account_position and part.property_account_position.id or False return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist, 'fiscal_position': fiscal_position}} - def wkf_approve_order(self, cr, uid, ids, context={}): + def wkf_approve_order(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'approved', 'date_approve': time.strftime('%Y-%m-%d')}) return True - def wkf_confirm_order(self, cr, uid, ids, context={}): + def wkf_confirm_order(self, cr, uid, ids, context=None): for po in self.browse(cr, uid, ids): if self.pool.get('res.partner.event.type').check(cr, uid, 'purchase_open'): self.pool.get('res.partner.event').create(cr, uid, {'name':'Purchase Order: '+po.name, 'partner_id':po.partner_id.id, 'date':time.strftime('%Y-%m-%d %H:%M:%S'), 'user_id':uid, 'partner_type':'retailer', 'probability': 1.0, 'planned_cost':po.amount_untaxed}) @@ -357,14 +357,14 @@ res = inv_id return res - def has_stockable_product(self,cr, uid, ids, *args): + def has_stockable_product(self, cr, uid, ids, *args): for order in self.browse(cr, uid, ids): for order_line in order.order_line: if order_line.product_id and order_line.product_id.product_tmpl_id.type in ('product', 'consu'): return True return False - def action_cancel(self, cr, uid, ids, context={}): + def action_cancel(self, cr, uid, ids, context=None): ok = True purchase_order_line_obj = self.pool.get('purchase.order.line') for purchase in self.browse(cr, uid, ids): @@ -387,7 +387,7 @@ self.write(cr,uid,ids,{'state':'cancel'}) return True - def action_picking_create(self,cr, uid, ids, *args): + def action_picking_create(self, cr, uid, ids, *args): picking_id = False for order in self.browse(cr, uid, ids): loc_id = order.partner_id.property_stock_supplier.id @@ -431,7 +431,7 @@ wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr) return picking_id - def copy(self, cr, uid, id, default=None,context={}): + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} default.update({ @@ -447,7 +447,7 @@ purchase_order() class purchase_order_line(osv.osv): - def _amount_line(self, cr, uid, ids, prop, unknow_none,unknow_dict): + def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict): res = {} cur_obj=self.pool.get('res.currency') for line in self.browse(cr, uid, ids): @@ -477,7 +477,7 @@ _table = 'purchase_order_line' _name = 'purchase.order.line' _description = 'Purchase Order lines' - def copy_data(self, cr, uid, id, default=None,context={}): + def copy_data(self, cr, uid, id, default=None, context=None): if not default: default = {} default.update({'state':'draft', 'move_ids':[]}) === modified file 'purchase_manual/purchase_manual.py' --- purchase_manual/purchase_manual.py 2010-02-24 10:55:29 +0000 +++ purchase_manual/purchase_manual.py 2010-03-10 10:59:01 +0000 @@ -41,7 +41,7 @@ 'invoiced': lambda *a: 0, } - def copy_data(self, cr, uid, id, default=None, context={}): + def copy_data(self, cr, uid, id, default=None, context=None): print 'copy called' if not default: default = {} @@ -52,14 +52,14 @@ }) return super(purchase_order_line, self).copy_data(cr, uid, id, default, context) - def action_confirm(self, cr, uid, ids, context={}): + def action_confirm(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'confirmed'}, context) return True purchase_order_line() class purchase_order(osv.osv): _inherit='purchase.order' - def action_invoice_create(self, cr, uid, ids, context={}): + def action_invoice_create(self, cr, uid, ids, context=None): print 'Invoice Create' res = super(purchase_order, self).action_invoice_create(cr, uid, ids, context) for po in self.browse(cr, uid, ids, context): @@ -69,7 +69,7 @@ self.pool.get('purchase.order.line').write(cr, uid, todo, {'invoiced':True}, context) return res - def wkf_confirm_order(self, cr, uid, ids, context={}): + def wkf_confirm_order(self, cr, uid, ids, context=None): res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context) todo = [] for po in self.browse(cr, uid, ids, context): === modified file 'purchase_tender/purchase_tender.py' --- purchase_tender/purchase_tender.py 2010-02-24 10:55:29 +0000 +++ purchase_tender/purchase_tender.py 2010-03-10 10:58:41 +0000 @@ -50,7 +50,7 @@ _columns = { 'tender_id' : fields.many2one('purchase.tender','Purchase Tender') } - def wkf_confirm_order(self, cr, uid, ids, context={}): + def wkf_confirm_order(self, cr, uid, ids, context=None): res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context) for po in self.browse(cr, uid, ids, context): if po.tender_id: === modified file 'report_account/report_receivable.py' --- report_account/report_receivable.py 2010-02-24 10:55:29 +0000 +++ report_account/report_receivable.py 2010-03-10 10:58:39 +0000 @@ -28,7 +28,7 @@ from osv import fields,osv -def _code_get(self, cr, uid, context={}): +def _code_get(self, cr, uid, context=None): acc_type_obj = self.pool.get('account.account.type') ids = acc_type_obj.search(cr, uid, []) res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context) === modified file 'report_task/report_task.py' --- report_task/report_task.py 2010-02-24 10:55:29 +0000 +++ report_task/report_task.py 2010-03-10 10:58:46 +0000 @@ -105,7 +105,7 @@ _auto = False _order = "name" - def _get_task_hours(self, cr, uid, ids, name,args,context): + def _get_task_hours(self, cr, uid, ids, name, args, context): result = {} for record in self.browse(cr, uid, ids,context): last_date = mx.DateTime.strptime(record.name, '%Y-%m-%d') + mx.DateTime.RelativeDateTime(months=1) - 1 @@ -118,7 +118,7 @@ result[record.id] = total return result - def get_hrs_timesheet(self, cr, uid, ids, name,args,context): + def get_hrs_timesheet(self, cr, uid, ids, name, args, context): result = {} sum = 0.0 for record in self.browse(cr, uid, ids, context): === modified file 'resource/__init__.py' (properties changed: +x to -x) === modified file 'resource/__terp__.py' (properties changed: +x to -x) === modified file 'resource/resource.py' (properties changed: +x to -x) --- resource/resource.py 2010-03-02 13:27:02 +0000 +++ resource/resource.py 2010-03-10 10:58:52 +0000 @@ -198,7 +198,7 @@ (check_dates, 'Error! leave start-date must be lower then leave end-date.', ['date_from', 'date_to']) ] - def onchange_resource(self,cr,uid,ids,resource): + def onchange_resource(self, cr, uid, ids, resource): result = {} if resource: resource_pool = self.pool.get('resource.resource') === modified file 'sale/mrp.py' --- sale/mrp.py 2010-02-24 10:55:29 +0000 +++ sale/mrp.py 2010-03-10 10:58:50 +0000 @@ -26,7 +26,7 @@ _inherit = 'mrp.production' - def _ref_calc(self, cr, uid, ids, field_names=None, arg=False, context={}): + def _ref_calc(self, cr, uid, ids, field_names=None, arg=False, context=None): if not field_names: field_names=[] res = {} @@ -65,4 +65,4 @@ res[production['id']] = move.sale_line_id and move.sale_line_id.order_id.client_order_ref or False return res -mrp_production() \ No newline at end of file +mrp_production() === modified file 'sale/wizard/make_invoice_advance.py' --- sale/wizard/make_invoice_advance.py 2010-02-24 10:55:29 +0000 +++ sale/wizard/make_invoice_advance.py 2010-03-10 10:58:50 +0000 @@ -46,7 +46,7 @@ """ fields_msg = {} -def _createInvoices(self, cr, uid, data, context={}): +def _createInvoices(self, cr, uid, data, context=None): list_inv = [] pool_obj = pooler.get_pool(cr.dbname) obj_sale = pool_obj.get('sale.order') === modified file 'sale_analytic_plans/sale_analytic_plans.py' --- sale_analytic_plans/sale_analytic_plans.py 2010-02-24 10:55:29 +0000 +++ sale_analytic_plans/sale_analytic_plans.py 2010-03-10 10:59:00 +0000 @@ -31,7 +31,7 @@ _columns = { 'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'), } - def invoice_line_create(self, cr, uid, ids, context={}): + def invoice_line_create(self, cr, uid, ids, context=None): create_ids=super(sale_order_line,self).invoice_line_create(cr, uid, ids, context) i=0 for line in self.browse(cr, uid, ids, context): === modified file 'sale_journal/sale_journal.py' --- sale_journal/sale_journal.py 2010-02-24 10:55:29 +0000 +++ sale_journal/sale_journal.py 2010-03-10 10:58:46 +0000 @@ -62,7 +62,7 @@ 'user_id': lambda self,cr,uid,context: uid, 'state': lambda self,cr,uid,context: 'draft', } - def button_sale_cancel(self, cr, uid, ids, context={}): + def button_sale_cancel(self, cr, uid, ids, context=None): for id in ids: sale_ids = self.pool.get('sale.order').search(cr, uid, [('journal_id','=',id),('state','=','draft')]) for saleid in sale_ids: @@ -77,13 +77,13 @@ wf_service.trg_validate(uid, 'sale.order', saleid, 'order_confirm', cr) return True - def button_open(self, cr, uid, ids, context={}): + def button_open(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'open'}) return True def button_draft(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'draft'}) return True - def button_close(self, cr, uid, ids, context={}): + def button_close(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'done', 'date_validation':time.strftime('%Y-%m-%d')}) return True sale_journal() @@ -112,7 +112,7 @@ 'user_id': lambda self,cr,uid,context: uid, 'state': lambda self,cr,uid,context: 'draft', } - def button_picking_cancel(self, cr, uid, ids, context={}): + def button_picking_cancel(self, cr, uid, ids, context=None): for id in ids: pick_ids = self.pool.get('stock.picking').search(cr, uid, [('journal_id','=',id)]) for pickid in pick_ids: @@ -122,7 +122,7 @@ def button_open(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'open'}) return True - def button_draft(self, cr, uid, ids, context={}): + def button_draft(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'draft'}) return True def button_close(self, cr, uid, ids, context={}): === modified file 'scrum/report/sprint_burndown.py' --- scrum/report/sprint_burndown.py 2010-03-09 07:28:46 +0000 +++ scrum/report/sprint_burndown.py 2010-03-10 10:58:49 +0000 @@ -42,7 +42,7 @@ return self.pdf class report_tasks(report_int): - def create(self, cr, uid, ids, datas, context={}): + def create(self, cr, uid, ids, datas, context=None): io = StringIO.StringIO() canv = canvas.init(fname=io, format='pdf') === modified file 'scrum/report/task_burndown.py' --- scrum/report/task_burndown.py 2010-02-24 10:55:29 +0000 +++ scrum/report/task_burndown.py 2010-03-10 10:58:49 +0000 @@ -68,7 +68,7 @@ return result class report_tasks(report_int): - def create(self, cr, uid, ids, datas, context={}): + def create(self, cr, uid, ids, datas, context=None): io = StringIO.StringIO() if 'date_start' not in datas: === modified file 'scrum/scrum.py' --- scrum/scrum.py 2010-02-28 10:57:24 +0000 +++ scrum/scrum.py 2010-03-10 10:58:49 +0000 @@ -76,19 +76,19 @@ for bl in sprint.backlog_ids: res[sprint.id] += bl.expected_hours return res - def button_cancel(self, cr, uid, ids, context={}): + def button_cancel(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'cancel'}, context=context) return True def button_draft(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'draft'}, context=context) return True - def button_open(self, cr, uid, ids, context={}): + def button_open(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'open'}, context=context) return True def button_close(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'done'}, context=context) return True - def button_pending(self, cr, uid, ids, context={}): + def button_pending(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'pending'}, context=context) return True _columns = { @@ -165,19 +165,19 @@ res[bl.id] += task.planned_hours return res - def button_cancel(self, cr, uid, ids, context={}): + def button_cancel(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'cancel'}, context=context) return True def button_draft(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'draft'}, context=context) return True - def button_open(self, cr, uid, ids, context={}): + def button_open(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'open'}, context=context) return True def button_close(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state':'done'}, context=context) return True - def button_pending(self, cr, uid, ids, context={}): + def button_pending(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'pending'}, context=context) return True @@ -206,7 +206,7 @@ class scrum_task(osv.osv): _name = 'project.task' _inherit = 'project.task' - def _get_task(self, cr, uid, ids, context={}): + def _get_task(self, cr, uid, ids, context=None): result = {} for line in self.pool.get('scrum.product.backlog').browse(cr, uid, ids, context=context): for task in line.tasks_id: === modified file 'stock/product.py' --- stock/product.py 2010-02-24 10:55:29 +0000 +++ stock/product.py 2010-03-10 10:58:58 +0000 @@ -32,7 +32,7 @@ return _('Products: ')+self.pool.get('stock.location').browse(cr, user, context['location'], context).name return res - def get_product_available(self,cr,uid,ids,context=None): + def get_product_available(self, cr, uid, ids, context=None): if not context: context = {} states=context.get('states',[]) @@ -136,7 +136,9 @@ res[prod_id] -= amount return res - def _product_available(self, cr, uid, ids, field_names=None, arg=False, context={}): + def _product_available(self, cr, uid, ids, field_names=None, arg=False, context=None): + if context is None: + context = {} if not field_names: field_names=[] res = {} === modified file 'stock/report/lot_location.py' --- stock/report/lot_location.py 2010-02-24 10:55:29 +0000 +++ stock/report/lot_location.py 2010-03-10 10:58:58 +0000 @@ -33,7 +33,7 @@ 'qty_total':self._qty_total, }) - def process(self,location_id): + def process(self, location_id): location_obj = pooler.get_pool(self.cr.dbname).get('stock.location') data = location_obj._product_get_report(self.cr,self.uid, [location_id]) data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['name'])[0]['name'] === modified file 'stock/report/lot_overview.py' --- stock/report/lot_overview.py 2010-02-24 10:55:29 +0000 +++ stock/report/lot_overview.py 2010-03-10 10:58:58 +0000 @@ -34,7 +34,7 @@ 'grand_total_price':self._grand_total, }) - def process(self,location_id): + def process(self, location_id): location_obj = pooler.get_pool(self.cr.dbname).get('stock.location') data = location_obj._product_get_report(self.cr,self.uid, [location_id]) data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['name'])[0]['name'] === modified file 'stock/report/lot_overview_all.py' --- stock/report/lot_overview_all.py 2010-02-24 10:55:29 +0000 +++ stock/report/lot_overview_all.py 2010-03-10 10:58:58 +0000 @@ -34,7 +34,7 @@ 'grand_total_price':self._grand_total, }) - def process(self,location_id): + def process(self, location_id): location_obj = pooler.get_pool(self.cr.dbname).get('stock.location') data = location_obj._product_get_all_report(self.cr,self.uid, [location_id]) data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['name'])[0]['name'] === modified file 'stock/report/product_stock.py' --- stock/report/product_stock.py 2010-03-01 05:05:14 +0000 +++ stock/report/product_stock.py 2010-03-10 10:58:58 +0000 @@ -42,7 +42,9 @@ class report_stock(report_int): - def create(self, cr, uid, ids, datas, context={}): + def create(self, cr, uid, ids, datas, context=None): + if context is None: + context = {} product_ids = ids if 'location_id' in context: location_id = context['location_id'] === modified file 'stock/report/stock_by_location.py' --- stock/report/stock_by_location.py 2010-02-24 10:55:29 +0000 +++ stock/report/stock_by_location.py 2010-03-10 10:58:58 +0000 @@ -26,7 +26,7 @@ #FIXME: we should use toxml class report_custom(report_rml): - def create_xml(self, cr, uid, ids, datas, context={}): + def create_xml(self, cr, uid, ids, datas, context=None): config = """ 09/09/2005 === modified file 'stock/stock_wizard.py' --- stock/stock_wizard.py 2010-03-05 10:08:13 +0000 +++ stock/stock_wizard.py 2010-03-10 10:58:58 +0000 @@ -35,7 +35,7 @@ 'quantity': lambda *x: 1 } - def track_lines(self, cr, uid, ids, context={}): + def track_lines(self, cr, uid, ids, context=None): datas = self.read(cr, uid, ids)[0] move_obj = self.pool.get('stock.move') move_obj._track_lines(cr, uid, context['active_id'], datas, context=context) @@ -77,7 +77,9 @@ 'location_id': _get_location_id } - def do_move_consume(self, cr, uid, ids, context={}): + def do_move_consume(self, cr, uid, ids, context=None): + if context is None: + context = {} move_obj = self.pool.get('stock.move') move_ids = context['active_ids'] for data in self.read(cr, uid, ids): @@ -98,7 +100,9 @@ 'location_id': lambda *x: False } - def move_scrap(self, cr, uid, ids, context={}): + def move_scrap(self, cr, uid, ids, context=None): + if context is None: + context = {} move_obj = self.pool.get('stock.move') move_ids = context['active_ids'] for data in self.read(cr, uid, ids): === modified file 'stock/wizard/wizard_location_product.py' (properties changed: +x to -x) === modified file 'stock/wizard/wizard_split_inventory_lots.py' --- stock/wizard/wizard_split_inventory_lots.py 2010-02-24 18:46:21 +0000 +++ stock/wizard/wizard_split_inventory_lots.py 2010-03-10 10:58:58 +0000 @@ -95,4 +95,4 @@ } } -wizard_split_inventory_lots('stock.inventory.line.split') \ No newline at end of file +wizard_split_inventory_lots('stock.inventory.line.split') === modified file 'stock_location/stock.py' --- stock_location/stock.py 2010-02-24 10:55:29 +0000 +++ stock_location/stock.py 2010-03-10 10:58:50 +0000 @@ -60,7 +60,7 @@ class stock_location(osv.osv): _inherit = 'stock.location' - def chained_location_get(self, cr, uid, location, partner=None, product=None, context={}): + def chained_location_get(self, cr, uid, location, partner=None, product=None, context=None): if product: for path in product.path_ids: if path.location_from_id.id == location.id: === modified file 'subscription/subscription.py' --- subscription/subscription.py 2010-02-24 10:55:29 +0000 +++ subscription/subscription.py 2010-03-10 10:59:01 +0000 @@ -59,7 +59,7 @@ _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() @@ -91,7 +91,7 @@ 'state': lambda *a: 'draft' } - def set_process(self, cr, uid, ids, context={}): + def set_process(self, cr, uid, ids, context=None): for row in self.read(cr, uid, ids): 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]} @@ -101,7 +101,7 @@ self.write(cr, uid, [row['id']], {'cron_id':id, 'state':'running'}) return True - def model_copy(self, cr, uid, ids, context={}): + def model_copy(self, cr, uid, ids, context=None): for row in self.read(cr, uid, ids): if not row.get('cron_id',False): continue @@ -136,14 +136,14 @@ self.write(cr, uid, [row['id']], {'state':state}) return True - def set_done(self, cr, uid, ids, context={}): + def set_done(self, cr, uid, ids, context=None): res = self.read(cr,uid, ids, ['cron_id']) ids2 = [x['cron_id'][0] for x in res if x['id']] self.pool.get('ir.cron').write(cr, uid, ids2, {'active':False}) self.write(cr, uid, ids, {'state':'done'}) return True - def set_draft(self, cr, uid, ids, context={}): + def set_draft(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'draft'}) return True subscription_subscription() === modified file 'survey/report/__init__.py' (properties changed: +x to -x) === modified file 'survey/report/survey_analysis_report.py' (properties changed: +x to -x) === modified file 'survey/survey.py' --- survey/survey.py 2010-03-05 12:21:31 +0000 +++ survey/survey.py 2010-03-10 10:58:46 +0000 @@ -47,7 +47,7 @@ _description = 'Survey' _rec_name = 'title' - def default_get(self, cr, uid, fields, context={}): + def default_get(self, cr, uid, fields, context=None): data = super(survey, self).default_get(cr, uid, fields, context) return data @@ -93,7 +93,7 @@ self.write(cr, uid, ids, { 'state' : 'cancel' }) return True - def copy(self, cr, uid, id, default=None,context={}): + def copy(self, cr, uid, id, default=None, context=None): raise osv.except_osv(_('Error !'),_('You cannot duplicate the resource!')) @@ -130,7 +130,9 @@ 'sequence' : lambda * a: 1 } - def default_get(self, cr, uid, fields, context={}): + def default_get(self, cr, uid, fields, context=None): + if context is None: + context = {} data = super(survey_page, self).default_get(cr, uid, fields, context) if context.has_key('line_order') and context['line_order']: if len(context['line_order'][-1]) > 2 and type(context['line_order'][-1][2]) == type({}) and context['line_order'][-1][2].has_key('sequence'): @@ -154,7 +156,7 @@ 'context': context } - def copy(self, cr, uid, id, default=None,context={}): + def copy(self, cr, uid, id, default=None, context=None): raise osv.except_osv(_('Error !'),_('You cannot duplicate the resource!')) survey_page() @@ -405,7 +407,9 @@ 'context': context } - def default_get(self, cr, uid, fields, context={}): + def default_get(self, cr, uid, fields, context=None): + if context is None: + context = {} data = super(survey_question, self).default_get(cr, uid, fields, context) if context.has_key('line_order') and context['line_order']: @@ -423,7 +427,9 @@ _description = 'Survey Question Column Heading' _rec_name = 'title' - def _get_in_visible_rating_weight(self,cr, uid, context={}): + def _get_in_visible_rating_weight(self, cr, uid, context=None): + if context is None: + context = {} if context.get('in_visible_rating_weight',False): return context['in_visible_rating_weight'] return False @@ -473,7 +479,9 @@ } return val - def _get_in_visible_answer_type(self,cr, uid, context={}): + def _get_in_visible_answer_type(self, cr, uid, context=None): + if context is None: + context = {} if context.get('in_visible_answer_type',False): return context['in_visible_answer_type'] return False @@ -494,7 +502,9 @@ 'in_visible_answer_type':_get_in_visible_answer_type, } - def default_get(self, cr, uid, fields, context={}): + def default_get(self, cr, uid, fields, context=None): + if context is None: + context = {} data = super(survey_answer, self).default_get(cr, uid, fields, context) if context.has_key('line_order') and context['line_order']: if len(context['line_order'][-1]) > 2 and type(context['line_order'][-1][2]) == type({}) and context['line_order'][-1][2].has_key('sequence'): @@ -529,7 +539,7 @@ res.append((record['id'], name)) return res - def copy(self, cr, uid, id, default=None,context={}): + def copy(self, cr, uid, id, default=None, context=None): raise osv.except_osv(_('Error !'),_('You cannot duplicate the resource!')) survey_response() @@ -586,7 +596,9 @@ class survey_name_wiz(osv.osv_memory): _name = 'survey.name.wiz' - def default_get(self, cr, uid, fields, context={}): + def default_get(self, cr, uid, fields, context=None): + if context is None: + context = {} if not context: context = {} data = super(survey_name_wiz, self).default_get(cr, uid, fields, context) @@ -666,7 +678,7 @@ 'name': fields.integer('Number'), } - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False): + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): result = super(survey_question_wiz, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu) surv_name_wiz = self.pool.get('survey.name.wiz') if view_type in ['form']: @@ -1462,7 +1474,7 @@ raise osv.except_osv(_('Error re !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['req_error_msg']))) return True - def action_new_question(self,cr, uid, ids, context): + def action_new_question(self, cr, uid, ids, context): for key,val in context.items(): if type(key) == type(True): context.pop(key) @@ -1492,7 +1504,7 @@ 'context': context } - def action_edit_page(self,cr, uid, ids, context): + def action_edit_page(self, cr, uid, ids, context): for key,val in context.items(): if type(key) == type(True): context.pop(key) @@ -1508,7 +1520,7 @@ 'context': context } - def action_delete_page(self,cr, uid, ids, context): + def action_delete_page(self, cr, uid, ids, context): for key,val in context.items(): if type(key) == type(True): context.pop(key) @@ -1526,7 +1538,7 @@ 'context': context } - def action_edit_question(self,cr, uid, ids, context): + def action_edit_question(self, cr, uid, ids, context): for key,val in context.items(): if type(key) == type(True): context.pop(key) @@ -1542,7 +1554,7 @@ 'context': context } - def action_delete_question(self,cr, uid, ids, context): + def action_delete_question(self, cr, uid, ids, context): for key,val in context.items(): if type(key) == type(True): context.pop(key) === modified file 'survey/wizard/__init__.py' (properties changed: +x to -x) --- survey/wizard/__init__.py 2010-03-04 09:16:44 +0000 +++ survey/wizard/__init__.py 2010-03-10 10:58:46 +0000 @@ -25,4 +25,4 @@ import wizard_browse_answer import wizard_print_survey_statistics -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'survey/wizard/wizard_survey.py' (properties changed: +x to -x) === modified file 'thunderbird/partner/partner.py' --- thunderbird/partner/partner.py 2010-02-24 10:55:29 +0000 +++ thunderbird/partner/partner.py 2010-03-10 10:58:51 +0000 @@ -55,7 +55,7 @@ class tinythunderbird_partner(osv.osv): - def _links_get(self, cr, uid, context={}): + def _links_get(self, cr, uid, context=None): obj = self.pool.get('res.request.link') ids = obj.search(cr, uid, []) res = obj.read(cr, uid, ids, ['object', 'name'], context) @@ -81,7 +81,7 @@ 'date': lambda *a: time.strftime('%Y-%m-%d') } - def thunderbird_mailcreate(self,cr,user,vals): + def thunderbird_mailcreate(self, cr, user, vals): dictcreate = dict(vals) import email header_name = email.Header.decode_header(dictcreate['name']) @@ -100,12 +100,12 @@ case_pool._history(cr, user, cases, _('Archive'), history=True, email=False) return create_id - def thunderbird_createcontact(self,cr,user,vals): + def thunderbird_createcontact(self, cr, user, vals): dictcreate = dict(vals) create_id = self.pool.get('res.partner.address').create(cr, user, dictcreate) return create_id - def thunderbird_createpartner(self,cr,user,vals): + def thunderbird_createpartner(self, cr, user, vals): dictcreate = dict(vals) search_id = self.pool.get('res.partner').search(cr, user,[('name','=',dictcreate['name'])]) if search_id: @@ -113,12 +113,12 @@ create_id = self.pool.get('res.partner').create(cr, user, dictcreate) return create_id - def thunderbird_searchobject(self,cr,user,vals): + def thunderbird_searchobject(self, cr, user, vals): dictcreate = dict(vals) search_id = self.pool.get('ir.model').search(cr, user,[('model','=',dictcreate['model'])]) return (search_id and search_id[0]) or 0 - def thunderbird_searchcontact(self,cr,user,vals): + def thunderbird_searchcontact(self, cr, user, vals): search_id1 = self.pool.get('res.partner.address').search(cr,user,[('name','ilike',vals)]) search_id2 = self.pool.get('res.partner.address').search(cr,user,[('email','=',vals)]) if search_id1: @@ -127,7 +127,7 @@ return self.pool.get('res.partner.address').name_get(cr, user, search_id2) return [] - def thunderbird_tempsearch(self,cr,user,vals): + def thunderbird_tempsearch(self, cr, user, vals): if vals[0]: value = vals[0][0] if vals[1]: @@ -158,7 +158,7 @@ name_get.append(er_val) return name_get - def thunderbird_attachment(self,cr,user,vals): + def thunderbird_attachment(self, cr, user, vals): dictcreate = dict(vals) datas = [dictcreate['datas']] name = [dictcreate['name']] @@ -171,13 +171,13 @@ create_id = self.pool.get('ir.attachment').create(cr,user,dictcreate) return 0 - def thunderbird_login(self,cr,user,vals): + def thunderbird_login(self, cr, user, vals): dictcreate = dict(vals) service = netsvc.LocalService('common') res = service.login(dictcreate['db'],dictcreate['login'],dictcreate['passwd']) return res or 0 - def read(self, cr, user, ids, fields=None, context={}, load='_classic_read'): + def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): ret_read = super(tinythunderbird_partner, self).read(cr, user, ids,fields,context,load) for read_data in ret_read: attachments = self.pool.get('ir.attachment').search(cr,user,[('res_model','=',self._name),('res_id','=',read_data['id'])]) @@ -187,9 +187,9 @@ read_data['attachments'] = text_atteched return ret_read - def unlink(self, cr, uid, ids, context={}): + def unlink(self, cr, uid, ids, context=None): attachments = self.pool.get('ir.attachment').search(cr,uid,[('res_model','=',self._name),('res_id','in',ids)]) self.pool.get('ir.attachment').unlink(cr,uid,attachments) return super(tinythunderbird_partner, self).unlink(cr, uid, ids,context) -tinythunderbird_partner() \ No newline at end of file +tinythunderbird_partner() === modified file 'wiki/wiki.py' --- wiki/wiki.py 2010-02-24 10:55:29 +0000 +++ wiki/wiki.py 2010-03-10 10:58:48 +0000 @@ -87,7 +87,7 @@ 'child_ids':fields.one2many('wiki.wiki', 'parent_id', 'Child Pages'), } - def onchange_group_id(self, cr, uid, ids, group_id, content, context={}): + def onchange_group_id(self, cr, uid, ids, group_id, content, context=None): if (not group_id) or content: return {} grp = self.pool.get('wiki.groups').browse(cr, uid, group_id) @@ -157,7 +157,7 @@ _defaults = { 'write_uid': lambda obj,cr,uid,context: uid, } - def getDiff(self, cr, uid, v1, v2, context={}): + def getDiff(self, cr, uid, v1, v2, context=None): import difflib history_pool = self.pool.get('wiki.wiki.history') text1 = history_pool.read(cr, uid, [v1], ['text_area'])[0]['text_area']