[REF]: Replace the condition 'if not context' with 'if context is None'.

bzr revid: uco@tinyerp.com-20101123070505-9i2lrqhgxzaii3zn
This commit is contained in:
uco (OpenERP) 2010-11-23 12:35:05 +05:30
parent 8035df3e11
commit 6dd290e824
220 changed files with 306 additions and 1255 deletions

View File

@ -182,7 +182,7 @@ class account_account(osv.osv):
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
if not context:
if context is None:
context = {}
pos = 0
@ -215,8 +215,6 @@ class account_account(osv.osv):
order, context=context, count=count)
def _get_children_and_consol(self, cr, uid, ids, context=None):
if not context:
context = {}
#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 = []
@ -310,16 +308,12 @@ class account_account(osv.osv):
return res
def _get_company_currency(self, cr, uid, ids, field_name, arg, context=None):
if not context:
context = {}
result = {}
for rec in self.browse(cr, uid, ids, context=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=None):
if not context:
context = {}
result = {}
for record in self.browse(cr, uid, ids, context=context):
if record.child_parent_ids:
@ -335,8 +329,6 @@ class account_account(osv.osv):
return result
def _get_level(self, cr, uid, ids, field_name, arg, context=None):
if not context:
context = {}
res={}
accounts = self.browse(cr, uid, ids, context=context)
for account in accounts:
@ -403,8 +395,6 @@ class account_account(osv.osv):
}
def _check_recursion(self, cr, uid, ids, context=None):
if not context:
context = {}
obj_self = self.browse(cr, uid, ids[0], context=context)
p_id = obj_self.parent_id and obj_self.parent_id.id
if (obj_self in obj_self.child_consol_ids) or (p_id and (p_id is obj_self.id)):
@ -434,8 +424,6 @@ class account_account(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
if not context:
context = {}
args = args[:]
ids = []
try:
@ -499,8 +487,6 @@ class account_account(osv.osv):
return super(account_account, self).copy(cr, uid, id, default, context=context)
def _check_moves(self, cr, uid, ids, method, context=None):
if not context:
context = {}
line_obj = self.pool.get('account.move.line')
account_ids = self.search(cr, uid, [('id', 'child_of', ids)])
@ -517,8 +503,6 @@ class account_account(osv.osv):
return True
def _check_allow_type_change(self, cr, uid, ids, new_type, context=None):
if not context:
context = {}
group1 = ['payable', 'receivable', 'other']
group2 = ['consolidation','view']
line_obj = self.pool.get('account.move.line')
@ -535,7 +519,7 @@ class account_account(osv.osv):
return True
def write(self, cr, uid, ids, vals, context=None):
if not context:
if context is None:
context = {}
if 'company_id' in vals:
@ -709,7 +693,7 @@ class account_journal(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
if not context:
if context is None:
context = {}
ids = []
if context.get('journal_type', False):
@ -791,8 +775,6 @@ class account_fiscalyear(osv.osv):
return True
def _check_duration(self, cr, uid, ids, context=None):
if not context:
context = {}
obj_fy = self.browse(cr, uid, ids[0], context=context)
if obj_fy.date_stop < obj_fy.date_start:
return False
@ -839,7 +821,7 @@ class account_fiscalyear(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if args is None:
args = []
if not context:
if context is None:
context = {}
ids = []
if name:
@ -871,16 +853,12 @@ class account_period(osv.osv):
_order = "date_start"
def _check_duration(self,cr,uid,ids,context=None):
if not context:
context = {}
obj_period = self.browse(cr, uid, ids[0], context=context)
if obj_period.date_stop < obj_period.date_start:
return False
return True
def _check_year_limit(self,cr,uid,ids,context=None):
if not context:
context = {}
for obj_period in self.browse(cr, uid, ids, context=context):
if obj_period.special:
continue
@ -903,16 +881,12 @@ class account_period(osv.osv):
]
def next(self, cr, uid, period, step, context=None):
if not context:
context = {}
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=None):
if not context:
context = {}
if not dt:
dt = time.strftime('%Y-%m-%d')
#CHECKME: shouldn't we check the state of the period?
@ -931,8 +905,6 @@ class account_period(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if args is None:
args = []
if not context:
context = {}
ids = []
if name:
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
@ -941,8 +913,6 @@ class account_period(osv.osv):
return self.name_get(cr, user, ids, context=context)
def write(self, cr, uid, ids, vals, context=None):
if not context:
context = {}
if 'company_id' in vals:
move_lines = self.pool.get('account.move.line').search(cr, uid, [('period_id', 'in', ids)])
if move_lines:
@ -969,8 +939,6 @@ class account_journal_period(osv.osv):
_description = "Journal Period"
def _icon_get(self, cr, uid, ids, field_name, arg=None, context=None):
if not context:
context = {}
result = {}.fromkeys(ids, 'STOCK_NEW')
for r in self.read(cr, uid, ids, ['state']):
result[r['id']] = {
@ -993,8 +961,6 @@ class account_journal_period(osv.osv):
}
def _check(self, cr, uid, ids, context=None):
if not context:
context = {}
for obj in self.browse(cr, uid, ids, context=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()
@ -1007,8 +973,6 @@ class account_journal_period(osv.osv):
return super(account_journal_period, self).write(cr, uid, ids, vals, context=context)
def create(self, cr, uid, vals, context=None):
if not context:
context = {}
period_id=vals.get('period_id',False)
if period_id:
period = self.pool.get('account.period').browse(cr, uid, period_id, context=context)
@ -1068,8 +1032,6 @@ class account_move(osv.osv):
if not args:
args = []
if not context:
context = {}
ids = []
if name:
ids += self.search(cr, user, [('name','ilike',name)]+args, limit=limit, context=context)
@ -1087,8 +1049,6 @@ class account_move(osv.osv):
ids = [ids]
if not ids:
return []
if not context:
context = {}
res = []
data_move = self.pool.get('account.move').browse(cursor, user, ids, context=context)
for move in data_move:
@ -1100,8 +1060,6 @@ class account_move(osv.osv):
return res
def _get_period(self, cr, uid, context=None):
if not context:
context = {}
periods = self.pool.get('account.period').find(cr, uid)
if periods:
return periods[0]
@ -1163,7 +1121,6 @@ class account_move(osv.osv):
}
def _check_centralisation(self, cursor, user, ids, context=None):
if not context: context = {}
for move in self.browse(cursor, user, ids, context=context):
if move.journal_id.centralisation:
move_ids = self.search(cursor, user, [
@ -1175,7 +1132,6 @@ class account_move(osv.osv):
return True
def _check_period_journal(self, cursor, user, ids, context=None):
if not context: context = {}
for move in self.browse(cursor, user, ids, context=context):
for line in move.line_id:
if line.period_id.id != move.period_id.id:
@ -1194,7 +1150,7 @@ class account_move(osv.osv):
]
def post(self, cr, uid, ids, context=None):
if not context:
if context is None:
context = {}
invoice = context.get('invoice', False)
valid_moves = self.validate(cr, uid, ids, context)
@ -1227,8 +1183,6 @@ class account_move(osv.osv):
return True
def button_validate(self, cursor, user, ids, context=None):
if not context:
context = {}
for move in self.browse(cursor, user, ids, context=context):
top = None
for line in move.line_id:
@ -1253,7 +1207,7 @@ class account_move(osv.osv):
return True
def write(self, cr, uid, ids, vals, context=None):
if not context:
if context is None:
context = {}
c = context.copy()
c['novalidate'] = True
@ -1317,7 +1271,6 @@ class account_move(osv.osv):
return super(account_move, self).copy(cr, uid, id, default, context)
def unlink(self, cr, uid, ids, context=None, check=True):
context = context or {}
toremove = []
obj_move_line = self.pool.get('account.move.line')
for move in self.browse(cr, uid, ids, context=context):
@ -1335,7 +1288,6 @@ class account_move(osv.osv):
return result
def _compute_balance(self, cr, uid, id, context=None):
context = context or {}
move = self.browse(cr, uid, [id], context=context)[0]
amount = 0
for line in move.line_id:
@ -1767,7 +1719,7 @@ class account_tax(osv.osv):
"""
if not args:
args = []
if not context:
if context is None:
context = {}
ids = []
if name:

View File

@ -519,7 +519,7 @@ class account_analytic_account_summary_user(osv.osv):
')')
def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'):
if not context:
if context is None:
context = {}
if not ids:
return []
@ -695,7 +695,7 @@ class account_analytic_account_summary_month(osv.osv):
')')
def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'):
if not context:
if context is None:
context = {}
if not ids:
return []

View File

@ -28,7 +28,7 @@ from tools.translate import _
class one2many_mod2(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
if not context:
if context is None:
context = {}
res = {}
for id in ids:
@ -115,7 +115,7 @@ class account_analytic_plan_instance(osv.osv):
return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context=context)
def _default_journal(self, cr, uid, context=None):
if not context:
if context is None:
context = {}
journal_obj = self.pool.get('account.journal')
if context.has_key('journal_id') and context['journal_id']:

View File

@ -31,7 +31,7 @@ class stock_picking(osv.osv):
def action_invoice_create(self, cr, uid, ids, journal_id=False,
group=False, type='out_invoice', context=None):
'''Return ids of created invoices for the pickings'''
if not context: context = {}
if context is None: context = {}
res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context=context)
if type == 'in_refund':
for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context):

View File

@ -111,7 +111,7 @@ class crossovered_budget_lines(osv.osv):
def _prac_amt(self, cr, uid, ids, context=None):
res = {}
result = 0.0
if not context: context = {}
if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
acc_ids = [x.id for x in line.general_budget_id.account_ids]
if not acc_ids:
@ -134,14 +134,14 @@ class crossovered_budget_lines(osv.osv):
def _prac(self, cr, uid, ids, name, args, context=None):
res={}
if not context: context = {}
if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = self._prac_amt(cr, uid, [line.id], context=context)[line.id]
return res
def _theo_amt(self, cr, uid, ids, context=None):
res = {}
if not context: context = {}
if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
today = datetime.datetime.today()
date_to = today.strftime("%Y-%m-%d")
@ -172,7 +172,7 @@ class crossovered_budget_lines(osv.osv):
def _theo(self, cr, uid, ids, name, args, context=None):
res = {}
if not context: context = {}
if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = self._theo_amt(cr, uid, [line.id], context=context)[line.id]
return res

View File

@ -43,7 +43,7 @@ class account_coda(osv.osv):
}
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
if not context: context = {}
if context is None: context = {}
res = super(account_coda, self).search(cr, user, args=args, offset=offset, limit=limit, order=order,
context=context, count=count)
if context.get('bank_statement', False) and not res:

View File

@ -66,7 +66,7 @@ class account_coda_import(osv.osv_memory):
mod_obj = self.pool.get('ir.model.data')
line_obj = self.pool.get('account.move.line')
if not context:
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
@ -321,7 +321,7 @@ class account_coda_import(osv.osv_memory):
}
def action_open_window(self, cr, uid, data, context=None):
if not context:
if context is None:
context = {}
return {

View File

@ -127,13 +127,13 @@ class account_invoice_line(osv.osv):
def copy_data(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
if not context: context = {}
if context is None: context = {}
default['state'] = self.browse(cr, uid, id, context=context).state
return super(account_invoice_line, self).copy_data(cr, uid, id, default, context)
def _fnct(self, cr, uid, ids, name, args, context=None):
res = {}
if not context: context = {}
if context is None: context = {}
lines = self.browse(cr, uid, ids, context=context)
account_ids = [line.account_id.id for line in lines]
account_names = dict(self.pool.get('account.account').name_get(cr, uid, account_ids, context=context))
@ -181,7 +181,7 @@ account_invoice_line()
class one2many_mod2(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
if not context:
if context is None:
context = {}
if not values:
values = {}

View File

@ -31,7 +31,7 @@ class Invoice(osv.osv):
if not ids:
return {}
res = {}
if not context: context = {}
if context is None: context = {}
for invoice in self.browse(cursor, user, ids, context=context):
res[invoice.id] = 0.0
if invoice.move_id:

View File

@ -50,7 +50,7 @@ class account_move_line(osv.osv):
def _to_pay_search(self, cr, uid, obj, name, args, context=None):
if not args:
return []
if not context: context = {}
if context is None: context = {}
line_obj = self.pool.get('account.move.line')
query = line_obj._query_get(cr, uid, context={})
where = ' and '.join(map(lambda x: '''(SELECT
@ -89,7 +89,7 @@ class account_move_line(osv.osv):
"""
payment_mode_obj = self.pool.get('payment.mode')
line2bank = {}
if not context: context = {}
if context is None: context = {}
if not ids:
return {}
bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,

View File

@ -67,7 +67,7 @@ class payment_order(osv.osv):
if not ids:
return {}
res = {}
if not context: context = {}
if context is None: context = {}
for order in self.browse(cursor, user, ids, context=context):
if order.line_ids:
res[order.id] = reduce(lambda x, y: x + y.amount, order.line_ids, 0.0)
@ -128,7 +128,7 @@ class payment_order(osv.osv):
return True
def copy(self, cr, uid, id, default={}, context=None):
if not context: context = {}
if context is None: context = {}
default.update({
'state': 'draft',
'line_ids': [],
@ -272,7 +272,7 @@ class payment_line(osv.osv):
def _get_currency(self, cr, uid, context=None):
user_obj = self.pool.get('res.users')
currency_obj = self.pool.get('res.currency')
if not context: context = {}
if context is None: context = {}
user = user_obj.browse(cr, uid, uid, context=context)
if user.company_id:
@ -410,7 +410,7 @@ class payment_line(osv.osv):
def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
data = {}
if not context: context = {}
if context is None: context = {}
partner_zip_obj = self.pool.get('res.partner.zip')
partner_obj = self.pool.get('res.partner')
payment_mode_obj = self.pool.get('payment.mode')

View File

@ -30,7 +30,7 @@ class account_move(osv.osv):
}
def post(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
obj_sequence = self.pool.get('ir.sequence')
res = super(account_move, self).post(cr, uid, ids, context=context)
seq_no = False

View File

@ -32,7 +32,7 @@ class account_move_line(osv.osv):
def _unreconciled(self, cr, uid, ids, prop, unknow_none, context=None):
res = {}
if not context: context = {}
if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = line.debit - line.credit
if line.reconcile_partial_id:
@ -51,18 +51,18 @@ account_move_line()
class account_voucher(osv.osv):
def _get_type(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
return context.get('type', False)
def _get_period(self, cr, uid, context=None):
if not context: context = {}
if context is None: context = {}
if context.get('period_id', False):
return context.get('period_id')
periods = self.pool.get('account.period').find(cr, uid)
return periods and periods[0] or False
def _get_journal(self, cr, uid, context=None):
if not context: context = {}
if context is None: context = {}
journal_pool = self.pool.get('account.journal')
if context.get('journal_id', False):
return context.get('journal_id')
@ -76,7 +76,7 @@ class account_voucher(osv.osv):
return res and res[0] or False
def _get_tax(self, cr, uid, context=None):
if not context: context = {}
if context is None: context = {}
journal_pool = self.pool.get('account.journal')
journal_id = context.get('journal_id', False)
if not journal_id:
@ -96,7 +96,7 @@ class account_voucher(osv.osv):
return False
def _get_currency(self, cr, uid, context=None):
if not context: context = {}
if context is None: context = {}
journal_pool = self.pool.get('account.journal')
journal_id = context.get('journal_id', False)
if journal_id:
@ -107,26 +107,26 @@ class account_voucher(osv.osv):
return False
def _get_partner(self, cr, uid, context=None):
if not context: context = {}
if context is None: context = {}
return context.get('partner_id', False)
def _get_reference(self, cr, uid, context=None):
if not context: context = {}
if context is None: context = {}
return context.get('reference', False)
def _get_narration(self, cr, uid, context=None):
if not context: context = {}
if context is None: context = {}
return context.get('narration', False)
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
if not context: context = {}
if context is None: context = {}
return [(r['id'], (str("%.2f" % r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
mod_obj = self.pool.get('ir.model.data')
if not context: context = {}
if context is None: context = {}
if not view_id and context.get('invoice_type', False):
if context.get('invoice_type', False) in ('out_invoice', 'out_refund'):
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
@ -224,7 +224,7 @@ class account_voucher(osv.osv):
position_pool = self.pool.get('account.fiscal.position')
voucher_line_pool = self.pool.get('account.voucher.line')
voucher_pool = self.pool.get('account.voucher')
if not context: context = {}
if context is None: context = {}
for voucher in voucher_pool.browse(cr, uid, ids, context=context):
voucher_amount = 0.0
@ -274,7 +274,7 @@ class account_voucher(osv.osv):
}
voucher_total = 0.0
voucher_line_ids = []
if not context: context = {}
if context is None: context = {}
total = 0.0
total_tax = 0.0
@ -333,7 +333,7 @@ class account_voucher(osv.osv):
default = {
'value':{},
}
if not context: context = {}
if context is None: context = {}
if not partner_id or not journal_id:
return default
@ -505,7 +505,7 @@ class account_voucher(osv.osv):
def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
if not journal_id:
return False
if not context: context = {}
if context is None: context = {}
journal_pool = self.pool.get('account.journal')
journal = journal_pool.browse(cr, uid, journal_id, context=context)
account_id = journal.default_credit_account_id or journal.default_debit_account_id
@ -535,7 +535,7 @@ class account_voucher(osv.osv):
def cancel_voucher(self, cr, uid, ids, context=None):
reconcile_pool = self.pool.get('account.move.reconcile')
move_pool = self.pool.get('account.move')
if not context: context = {}
if context is None: context = {}
for voucher in self.browse(cr, uid, ids, context=context):
recs = []
@ -591,7 +591,7 @@ class account_voucher(osv.osv):
terms = term_pool.compute(cr, uid, term_id, amount)
return terms
return False
if not context:
if context is None:
context = {}
move_pool = self.pool.get('account.move')
move_line_pool = self.pool.get('account.move.line')
@ -769,7 +769,7 @@ class account_voucher_line(osv.osv):
def _compute_balance(self, cr, uid, ids, name, args, context=None):
currency_pool = self.pool.get('res.currency')
rs_data = {}
if not context: context = {}
if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
res = {}
company_currency = line.voucher_id.journal_id.company_id.currency_id.id
@ -821,7 +821,7 @@ class account_voucher_line(osv.osv):
@return: Returns a dict which contains new values, and context
"""
res = {}
if not context: context = {}
if context is None: context = {}
move_line_pool = self.pool.get('account.move.line')
if move_line_id:
move_line = move_line_pool.browse(cr, user, move_line_id, context=context)
@ -846,7 +846,7 @@ class account_voucher_line(osv.osv):
@return: Returns a dict that contains default values for fields
"""
if not context: context = {}
if context is None: context = {}
journal_id = context.get('journal_id', False)
partner_id = context.get('partner_id', False)
journal_pool = self.pool.get('account.journal')
@ -883,7 +883,7 @@ class account_bank_statement(osv.osv):
def button_cancel(self, cr, uid, ids, context=None):
voucher_obj = self.pool.get('account.voucher')
if not context: context = {}
if context is None: context = {}
for st in self.browse(cr, uid, ids, context=context):
voucher_ids = []
for line in st.line_ids:
@ -897,7 +897,7 @@ class account_bank_statement(osv.osv):
wf_service = netsvc.LocalService("workflow")
move_line_obj = self.pool.get('account.move.line')
bank_st_line_obj = self.pool.get('account.bank.statement.line')
if not context: context = {}
if context is None: context = {}
st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
if st_line.voucher_id:
voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
@ -923,7 +923,7 @@ class account_bank_statement_line(osv.osv):
return {}
res = {}
if not context: context = {}
if context is None: context = {}
# company_currency_id = False
for line in self.browse(cursor, user, ids, context=context):
# if not company_currency_id:
@ -945,7 +945,7 @@ class account_bank_statement_line(osv.osv):
}
def unlink(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
voucher_obj = self.pool.get('account.voucher')
statement_line = self.browse(cr, uid, ids, context=context)
unlink_ids = []

View File

@ -27,7 +27,7 @@ class invoice(osv.osv):
def invoice_pay_customer(self, cr, uid, ids, context=None):
if not ids: return []
if not context: context = {}
if context is None: context = {}
inv = self.browse(cr, uid, ids[0], context=context)
return {
'name':_("Pay Invoice"),

View File

@ -35,7 +35,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
}
def populate_statement(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
statement_id = context.get('statement_id', False)
if not statement_id:
return {}
@ -134,7 +134,7 @@ class account_statement_from_invoice(osv.osv_memory):
}
def search_invoices(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
line_obj = self.pool.get('account.move.line')
statement_obj = self.pool.get('account.bank.statement')
journal_obj = self.pool.get('account.journal')

View File

@ -29,7 +29,6 @@ class account_analytic_account(osv.osv):
_description = 'Analytic Account'
def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):
if not context: context = {}
def recursive_computation(account_id, res):
account = self.browse(cr, uid, account_id)
for son in account.child_ids:
@ -93,7 +92,6 @@ class account_analytic_account(osv.osv):
if not ids:
return []
res = []
if not context: context = {}
for account in self.browse(cr, uid, ids, context=context):
data = []
acc = account
@ -139,7 +137,6 @@ class account_analytic_account(osv.osv):
}
def _default_company(self, cr, uid, context=None):
if not context: context = {}
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
@ -166,7 +163,6 @@ class account_analytic_account(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
if not context: context = {}
default['code'] = False
default['line_ids'] = []
return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
@ -187,7 +183,7 @@ class account_analytic_account(osv.osv):
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args=[]
if not context:
if context is None:
context={}
account = self.search(cr, uid, [('code', '=', name)]+args, limit=limit, context=context)
if not account:

View File

@ -57,8 +57,6 @@ class auction_dates(osv.osv):
return res
def name_get(self, cr, uid, ids, context=None):
if not context:
context={}
if not ids:
return []
reads = self.read(cr, uid, ids, ['name', 'auction1'], context)
@ -68,8 +66,6 @@ class auction_dates(osv.osv):
def _get_invoice(self, cr, uid, ids, name, arg, context=None):
lots_obj = self.pool.get('auction.lots')
result = {}
if not context:
context={}
for data in self.browse(cr, uid, ids, context=context):
buyer_inv_ids = []
seller_inv_ids = []
@ -122,8 +118,6 @@ class auction_dates(osv.osv):
RETURN: True
"""
if not context:
context={}
lots_obj = self.pool.get('auction.lots')
lots_ids = lots_obj.search(cr, uid, [('auction_id', 'in', ids), ('state', '=', 'draft'), ('obj_price', '>', 0)])
lots_obj.lots_invoice(cr, uid, lots_ids, {}, None)
@ -196,8 +190,6 @@ class aie_category(osv.osv):
}
def name_get(self, cr, uid, ids, context=None):
if not context:
context = {}
res = []
if not ids:
return res
@ -231,8 +223,6 @@ auction_lot_category()
# Lots
#----------------------------------------------------------
def _type_get(self, cr, uid, context=None):
if not context:
context = {}
obj = self.pool.get('auction.lot.category')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['name'], context)
@ -247,23 +237,15 @@ class auction_lots(osv.osv):
_description=__doc__
def button_not_bought(self, cr, uid, ids, context=None):
if not context:
context={}
return self.write(cr, uid, ids, {'state':'unsold'})
def button_taken_away(self, cr, uid, ids, context=None):
if not context:
context={}
return self.write(cr, uid, ids, {'state':'taken_away', 'ach_emp': True})
def button_unpaid(self, cr, uid, ids, context=None):
if not context:
context={}
return self.write(cr, uid, ids, {'state':'draft'})
def button_bought(self, cr, uid, ids, context=None):
if not context:
context={}
return self.write(cr, uid, ids, {'state':'sold'})
def _getprice(self, cr, uid, ids, fields, args, context=None):
@ -273,12 +255,10 @@ class auction_lots(osv.osv):
@param context: A standard dictionary for contextual values
@return: Dictionary of function fields value.
"""
if not context:
context = {}
res = {}
account_analytic_line_obj = self.pool.get('account.analytic.line')
lots = self.browse(cr, uid, ids, context)
lots = self.browse(cr, uid, ids, context=context)
pt_tax = self.pool.get('account.tax')
for lot in lots:
taxes = []
@ -364,8 +344,6 @@ class auction_lots(osv.osv):
return res
def onchange_obj_ret(self, cr, uid, ids, obj_ret, context=None):
if not context:
context={}
if obj_ret:
return {'value': {'obj_price': 0}}
return {}
@ -432,16 +410,12 @@ class auction_lots(osv.osv):
}
def name_get(self, cr, user, ids, context=None):
if not context:
context={}
if not 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=None, operator='ilike', context=None):
if not context:
context={}
if not args:
args = []
ids = []
@ -585,14 +559,12 @@ class auction_lots(osv.osv):
def buyer_proforma(self, cr, uid, ids, context=None):
if not context:
context={}
invoices = {}
inv_ref = self.pool.get('account.invoice')
res_obj = self.pool.get('res.partner')
inv_line_obj = self.pool.get('account.invoice.line')
wf_service = netsvc.LocalService('workflow')
for lot in self.browse(cr, uid, ids, context):
for lot in self.browse(cr, uid, ids, context=context):
if not lot.obj_price>0:
continue
if not lot.ach_uid.id:
@ -645,12 +617,10 @@ class auction_lots(osv.osv):
"""
# use each list of object in turn
invoices = {}
if not context:
context={}
inv_ref=self.pool.get('account.invoice')
inv_line_obj = self.pool.get('account.invoice.line')
wf_service = netsvc.LocalService('workflow')
for lot in self.browse(cr, uid, ids, context):
for lot in self.browse(cr, uid, ids, context=context):
if not lot.auction_id.id:
continue
if lot.bord_vnd_id.id in invoices:
@ -686,7 +656,7 @@ class auction_lots(osv.osv):
}
inv_line_obj.create(cr, uid, inv_line, context)
inv_ref.button_compute(cr, uid, invoices.values())
for inv in inv_ref.browse(cr, uid, invoices.values(), context):
for inv in inv_ref.browse(cr, uid, invoices.values(), context=context):
inv_ref.write(cr, uid, [inv.id], {
'check_total': inv.amount_total
})

View File

@ -28,8 +28,6 @@ import time
import tools
def _type_get(self, cr, uid, context=None):
if not context:
context = {}
obj = self.pool.get('auction.lot.category')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['name'], context)

View File

@ -60,7 +60,7 @@ class auction_lots_send_aie(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context: context = {}
if context is None: context = {}
res = super(auction_lots_send_aie, self).default_get(cr, uid, fields, context=context)
if 'uname' in fields and context.get('uname',False):
res['uname'] = context.get('uname')
@ -149,7 +149,7 @@ class auction_lots_send_aie(osv.osv_memory):
self._photo_bin_send(uname, passwd, ref, did, fname, bin)
def get_dates(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
import httplib
data_obj = self.pool.get('ir.model.data')
conn = httplib.HTTPConnection('www.auction-in-europe.com')
@ -177,7 +177,6 @@ class auction_lots_send_aie(osv.osv_memory):
}
def _send(self, cr, uid, ids, context=None):
if not context: context = {}
import pickle, thread, sql_db
cr.execute('select name,aie_categ from auction_lot_category')
vals = dict(cr.fetchall())
@ -215,7 +214,6 @@ class auction_lots_send_aie(osv.osv_memory):
return {}
def send_pdf(self, cr, uid, ids, context=None):
if not context: context = {}
threaded_calculation = threading.Thread(target=self._send, args=(cr, uid, ids, context))
threaded_calculation.start()
return {}

View File

@ -55,7 +55,7 @@ class auction_lots_pay(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context: context = {}
if context is None: context = {}
res = super(auction_lots_pay, self).default_get(cr, uid, fields, context=context)
if 'uname' in fields and context.get('uname',False):
res['uname'] = context.get('uname')
@ -98,7 +98,7 @@ class auction_lots_pay(osv.osv_memory):
return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),))
def get_dates(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
import httplib
conn = httplib.HTTPConnection('www.auction-in-europe.com')
data_obj = self.pool.get('ir.model.data')
@ -127,7 +127,7 @@ class auction_lots_pay(osv.osv_memory):
}
def send(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
import pickle
service = netsvc.LocalService("object_proxy")
datas = self.read(cr, uid, ids[0],['uname','password','dates'])

View File

@ -36,7 +36,6 @@ class auction_catalog_flagey(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context: context = {}
res = super(auction_catalog_flagey, self).default_get(cr, uid, fields, context=context)
return res
@ -53,7 +52,7 @@ class auction_catalog_flagey(osv.osv_memory):
"""
lots_obj = self.pool.get('auction.lots')
auc_dates_obj = self.pool.get('auction.dates')
if not context: context = {}
if context is None: context = {}
current_auction = auc_dates_obj.browse(cr, uid, context.get('active_ids', []))
v_lots = lots_obj.search(cr, uid, [('auction_id','=',current_auction.id)])
v_ids = lots_obj.browse(cr, uid, v_lots, context=context)
@ -72,7 +71,7 @@ class auction_catalog_flagey(osv.osv_memory):
@param context: A standard dictionary
@return: Report
"""
if not context: context = {}
if context is None: context = {}
datas = {'ids': context.get('active_ids',[])}
return {
'type': 'ir.actions.report.xml',

View File

@ -38,7 +38,7 @@ class auction_lots_able(osv.osv_memory):
@param uid: the current users ID for security checks,
@param ids: List of auction lots ables IDs.
"""
if not context: context = {}
if context is None: context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'ach_emp':True})
return {}

View File

@ -44,7 +44,7 @@ class auction_lots_auction_move(osv.osv_memory):
@param uid: the current users ID for security checks,
@param ids: List of auction lots auction moves IDs.
"""
if not context:
if context is None:
context={}
auction_bid_line_obj = self.pool.get('auction.bid_line')
auction_lot_history_obj = self.pool.get('auction.lot.history')

View File

@ -42,7 +42,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context: context = {}
if context is None: context = {}
res = super(wiz_auc_lots_buyer_map,self).default_get(cr, uid, fields, context=context)
auction_lots_obj = self.pool.get('auction.lots')
lots_ids = auction_lots_obj.search(cr, uid, [('ach_uid', '=', ''), ('ach_login', '!=', '')])
@ -63,8 +63,6 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
@param context: A standard dictionary
@return: login field from current record.
"""
if not context:
context={}
lots_obj = self.pool.get('auction.lots')
for rec in lots_obj.browse(cr, uid, ids, context=context):
if (len(ids)==1) and (not rec.ach_uid and not rec.ach_login):
@ -82,7 +80,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
@param ids: List of ids
@param context: A standard dictionary
"""
if not context:
if context is None:
context={}
rec_ids = context and context.get('active_ids',[]) or []
assert rec_ids, _('Active IDs not Found')
@ -103,7 +101,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view.
"""
if not context:
if context is None:
context={}
record_ids = context and context.get('active_ids', []) or []
res = super(wiz_auc_lots_buyer_map, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)

View File

@ -40,7 +40,7 @@ class auction_lots_cancel(osv.osv):
@param context: A standard dictionary
@return:
"""
if not context:
if context is None:
context={}
lots_obj = self.pool.get('auction.lots')
invoice_obj = self.pool.get('account.invoice')

View File

@ -35,7 +35,7 @@ class auction_lots_enable(osv.osv_memory):
@param uid: the current users ID for security checks,
@param ids: List of auction lots enables IDs.
"""
if not context: context = {}
if context is None: context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_id',False), {'ach_emp':False})
return {}

View File

@ -46,7 +46,7 @@ class auction_lots_invoice(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context: context = {}
if context is None: context = {}
res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context)
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids', []))
@ -102,7 +102,7 @@ class auction_lots_invoice(osv.osv_memory):
@param ids: List of Auction lots make invoice buyers IDs
@return: dictionary of account invoice form.
"""
if not context: context = {}
if context is None: context = {}
service = netsvc.LocalService("object_proxy")
datas = {'ids' : context.get('active_ids',[])}
res = self.read(cr, uid, ids, ['number','ach_uid'])

View File

@ -50,7 +50,7 @@ class auction_lots_make_invoice(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context:
if context is None:
context={}
res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context)
lots_obj = self.pool.get('auction.lots')
@ -69,7 +69,7 @@ class auction_lots_make_invoice(osv.osv_memory):
@param ids: List of Auction lots make invoices IDs
@return: dictionary of account invoice form.
"""
if not context:
if context is None:
context={}
order_obj = self.pool.get('auction.lots')
mod_obj = self.pool.get('ir.model.data')

View File

@ -45,7 +45,7 @@ class auction_lots_make_invoice_buyer(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context:
if context is None:
context={}
res = super(auction_lots_make_invoice_buyer, self).default_get(cr, uid, fields, context=context)
lots_obj=self.pool.get('auction.lots')

View File

@ -48,7 +48,7 @@ class auction_lots_numerotate_per_lot(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context: context = {}
if context is None: context = {}
res = super(auction_lots_numerotate_per_lot, self).default_get(cr, uid, fields, context=context)
active_id = context.get('active_id',False)
active_model = context.get('active_model')
@ -91,6 +91,7 @@ class auction_lots_numerotate_per_lot(osv.osv_memory):
}
def numerotate(self, cr, uid, ids, context=None):
if context is None: context = {}
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num','obj_num'])
@ -133,6 +134,7 @@ class auction_lots_numerotate_per_lot(osv.osv_memory):
return lots_datas[0]
def test_exist(self, cr, uid, ids, context=None):
if context is None: context = {}
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
data_obj = self.pool.get('ir.model.data')

View File

@ -44,7 +44,7 @@ class auction_lots_sms_send(osv.osv_memory):
@param context: A standard dictionary
@return: number indicating the acknowledgement
"""
if not context: context = {}
if context is None: context = {}
lot_obj = self.pool.get('auction.lots')
partner_obj = self.pool.get('res.partner')
partner_address_obj = self.pool.get('res.partner.address')

View File

@ -48,7 +48,7 @@ class auction_pay_buy(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context:
if context is None:
context={}
res = super(auction_pay_buy, self).default_get(cr, uid, fields, context=context)
auction_lots_obj= self.pool.get('auction.lots')
@ -70,7 +70,7 @@ class auction_pay_buy(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
if not context: context = {}
if context is None: context = {}
lot_obj = self.pool.get('auction.lots')
bank_statement_line_obj = self.pool.get('account.bank.statement.line')

View File

@ -42,7 +42,7 @@ class auction_pay_sel(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
if not context: context = {}
if context is None: context = {}
lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context=context)
invoice_obj = self.pool.get('account.invoice')
for datas in self.read(cr, uid, ids, context=context):

View File

@ -26,7 +26,7 @@ class auction_payer(osv.osv_memory):
_description = "Auction payer"
def payer(self, cr, uid, ids, context=None):
if not context: context = {}
if context is None: context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'is_ok':True, 'state':'paid'})
return {}
@ -46,7 +46,7 @@ class auction_payer_sel(osv.osv_memory):
@param uid: the current users ID for security checks,
@param ids: List of auction payer sels IDs.
"""
if not context: context = {}
if context is None: context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'paid_vnd':True})
return {}

View File

@ -42,7 +42,7 @@ class auction_taken(osv.osv_memory):
@param ids: List of Auction takens IDs
@return: dictionary of lot_ids fields with empty list
"""
if not context:
if context is None:
context={}
lot_obj = self.pool.get('auction.lots')
for current in self.browse(cr, uid, ids, context=context):

View File

@ -63,7 +63,7 @@ class auction_transfer_unsold_object(osv.osv):
@param context: A standard dictionary
@return:
"""
if not context: context = {}
if context is None: context = {}
bid_line_obj = self.pool.get('auction.bid_line')
lots_obj = self.pool.get('auction.lots')
lot_history_obj = self.pool.get('auction.lot.history')

View File

@ -196,8 +196,6 @@ class audittrail_objects_proxy(osv_pool):
@param values: Values for field to be converted into textual values
@return: values: List of textual values for given fields
"""
if not context:
context = {}
pool = pooler.get_pool(cr.dbname)
field_pool = pool.get('ir.model.fields')
model_pool = pool.get('ir.model')

View File

@ -42,8 +42,6 @@ class audittrail_view_log(osv.osv_memory):
@param ids: List of audittrail view logs IDs.
@return: Dictionary of audittrail log form on given date range.
"""
if not context:
context = {}
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')

View File

@ -157,7 +157,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
return True
def _create(self, old_create, model, context=None):
if not context:
if context is None:
context = {}
def make_call_old(cr, uid, vals, context=context):
new_id = old_create(cr, uid, vals, context=context)
@ -167,7 +167,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
return make_call_old
def _write(self, old_write, model, context=None):
if not context:
if context is None:
context = {}
def make_call_old(cr, uid, ids, vals, context=context):
if isinstance(ids, (str, int, long)):
@ -178,7 +178,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
return make_call_old
def _register_hook(self, cr, uid, ids, context=None):
if not context:
if context is None:
context = {}
for action_rule in self.browse(cr, uid, ids, context=context):
model = action_rule.model_id.model

View File

@ -106,7 +106,6 @@ def _links_get(self, cr, uid, context=None):
@param context: A standard dictionary for contextual values
@return: list of dictionary which contain object and name and id.
"""
if not context: context = {}
obj = self.pool.get('res.request.link')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['object', 'name'], context=context)
@ -234,7 +233,6 @@ class calendar_attendee(osv.osv):
"""
name = name[0]
result = {}
if not context: context = {}
for attdata in self.browse(cr, uid, ids, context=context):
id = attdata.id
result[id] = {}
@ -301,7 +299,6 @@ class calendar_attendee(osv.osv):
@param context: A standard dictionary for contextual values
@return: list of dictionary which contain object and name and id.
"""
if not context: context = {}
obj = self.pool.get('res.request.link')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['object', 'name'], context=context)
@ -315,7 +312,6 @@ class calendar_attendee(osv.osv):
@param context: A standard dictionary for contextual values
@return: list of dictionary which contain code and name and id.
"""
if not context: context = {}
obj = self.pool.get('res.lang')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['code', 'name'], context=context)
@ -1595,7 +1591,6 @@ true, it will allow you to hide the event alarm information without removing it.
@return: True
"""
res = False
if not context: context = {}
for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context):
event_id = event_datas['id']
if isinstance(event_id, (int, long)):
@ -1700,7 +1695,6 @@ class calendar_todo(osv.osv):
"""
res = {}
if not context: context = {}
for event in self.browse(cr, uid, ids, context=context):
res[event.id] = event.date_start
return res

View File

@ -62,7 +62,7 @@ send an Email to Invited Person')
@return: Dictionary of {}.
"""
if not context:
if context is None:
context = {}
model = False

View File

@ -82,7 +82,7 @@ class base_calendar_set_exrule(osv.osv_memory):
@param fields: List of fields for default value
@param context: A standard dictionary for contextual values
"""
if not context: context = {}
if context is None: context = {}
event_obj = self.pool.get(context.get('active_model'))
for event in event_obj.browse(cr, uid, context.get('active_ids', []), context=context):
if not event.rrule:
@ -103,7 +103,7 @@ class base_calendar_set_exrule(osv.osv_memory):
weekstring = ''
monthstring = ''
yearstring = ''
if not context: context = {}
if context is None: context = {}
ex_id = base_calendar.base_calendar_id2real_id(context.get('active_id', False))
model = context.get('model', False)
model_obj = self.pool.get(model)

View File

@ -69,7 +69,7 @@ class calendar_event_edit_all(osv.osv_memory):
@param ids: List of calendar event edit alls IDs
@return: dictionary {}
"""
if not context:
if context is None:
context = {}
context_id = context and context.get('active_id', False) or False

View File

@ -36,7 +36,6 @@ class res_partner_contact(osv.osv):
@fields: Get Fields
@param context: A standard dictionary for contextual values
@param arg: list of tuples of form [(name_of_the_field, operator, value), ...]. """
if not context: context = {}
res = dict.fromkeys(ids, False)
res_partner_job_obj = self.pool.get('res.partner.job')
@ -92,7 +91,6 @@ class res_partner_contact(osv.osv):
if not len(ids):
return []
res = []
if not context: context = {}
for contact in self.browse(cr, user, ids, context=context):
_contact = ""
if contact.title:
@ -133,7 +131,7 @@ class res_partner_address(osv.osv):
if not len(ids):
return []
res = []
if not context: context = {}
if context is None: context = {}
for r in self.read(cr, user, ids, ['zip', 'city', 'partner_id', 'street']):
if context.get('contact_display', 'contact')=='partner' and r['partner_id']:
res.append((r['id'], r['partner_id'][1]))
@ -238,7 +236,6 @@ class res_partner_job(osv.osv):
@address_id : ID of the Address selected,
@param context: A standard dictionary for contextual values
"""
if not context: context = {}
partner_id = False
if address_id:
address = self.pool.get('res.partner.address')\

View File

@ -35,7 +35,6 @@ class base_contact_installer(osv.osv_memory):
"""
This function is used to create contact and address from existing partner address
"""
if not context: context = {}
obj = self.pool.get("base.contact.installer").browse(cr, uid, uid, context=context)
if obj.migrate:
cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact;

View File

@ -75,14 +75,12 @@ class res_partner_bank(osv.osv):
def create(self, cr, uid, vals, context=None):
#overwrite to format the iban number correctly
if not context: context = {}
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=None):
#overwrite to format the iban number correctly
if not context: context = {}
if 'iban' in vals and vals['iban']:
vals['iban'] = _format_iban(vals['iban'])
return super(res_partner_bank, self).write(cr, uid, ids, vals, context)
@ -91,7 +89,6 @@ class res_partner_bank(osv.osv):
'''
Check the IBAN number
'''
if not context: context = {}
for bank_acc in self.browse(cr, uid, ids, context=context):
if not bank_acc.iban:
continue
@ -126,7 +123,6 @@ class res_partner_bank(osv.osv):
def name_get(self, cr, uid, ids, context=None):
res = []
to_check_ids = []
if not context: context = {}
for id in self.browse(cr, uid, ids, context=context):
if id.state=='iban':
res.append((id.id,id.iban))
@ -137,7 +133,6 @@ class res_partner_bank(osv.osv):
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
#overwrite the search method in order to search not only on bank type == basic account number but also on type == iban
if not context: context = {}
res = super(res_partner_bank,self).search(cr, uid, args, offset, limit, order, context=context, count=count)
if filter(lambda x:x[0]=='acc_number' ,args):
#get the value of the search
@ -156,7 +151,6 @@ class res_partner_bank(osv.osv):
This function returns the bank account number computed from the iban account number, thanks to the mapping_list dictionary that contains the rules associated to its country.
'''
res = {}
if not context: context = {}
mapping_list = {
#TODO add rules for others countries
'be': lambda x: x[4:],

View File

@ -37,7 +37,6 @@ class module(osv.osv):
def _get_graphical_representation(self, cr, uid, model_ids, level=1, context=None):
obj_model = self.pool.get('ir.model')
if not context: context = {}
if level == 0:
return tuple()
relation = []
@ -100,7 +99,7 @@ class module(osv.osv):
return obj_ids
def get_relation_graph(self, cr, uid, module_name, context=None):
if not context: context = {}
if context is None: context = {}
object_ids = self._get_module_objects(cr, uid, module_name, context=context)
if not object_ids:
return {'module_file': False}

View File

@ -30,7 +30,6 @@ form_rep = '''<?xml version="1.0"?>
def _get_graph(self, cr, uid, datas, context=None):
mod_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
if not context: context = {}
modules = mod_obj.browse(cr, uid, datas['ids'], context=context)
for module in modules:
module_data = mod_obj.get_relation_graph(cr, uid, module.name, context=context)

View File

@ -363,7 +363,6 @@ class report_creator(osv.osv):
@return: Dictionary of sql query.
"""
result = {}
if not context: context = {}
for obj in self.browse(cr, uid, ids, context=context):
fields = []
groupby = []
@ -452,7 +451,7 @@ class report_creator(osv.osv):
@param context: A standard dictionary for contextual values
@return : Dictionary value for base creator report form
"""
if not context:
if context is None:
context = {}
rep = self.browse(cr, uid, ids, context=context)
@ -487,7 +486,6 @@ class report_creator(osv.osv):
@return: True if display field which are stored in database.
or false if display field which are not store in dtabase.
"""
if not context: context = {}
this_objs = self.browse(cr, uid, ids, context=context)
for obj in this_objs:
for fld in obj.field_ids:
@ -509,7 +507,6 @@ class report_creator(osv.osv):
@return: True if model colume type is in integer or float.
or false model colume type is not in integer or float.
"""
if not context: context = {}
aggregate_columns = ('integer', 'float')
apply_functions = ('sum', 'min', 'max', 'avg', 'count')
this_objs = self.browse(cr, uid, ids, context=context)
@ -525,7 +522,6 @@ class report_creator(osv.osv):
def _calander_view_error(self, cr, uid, ids, context=None):
required_types = []
if not context: context = {}
this_objs = self.browse(cr, uid, ids, context=context)
for obj in this_objs:
if obj.view_type1 == 'calendar' or obj.view_type2 == 'calendar' or obj.view_type3 == 'calendar':

View File

@ -40,7 +40,7 @@ class report_menu_create(osv.osv_memory):
@param ids: List of Report Menu Create's IDs
@return: Dictionary {}.
"""
if not context:
if context is None:
context = {}
context_id = context and context.get('active_id', False) or False
obj_menu = self.pool.get('ir.ui.menu')

View File

@ -46,7 +46,6 @@ class report_xml(osv.osv):
'''
Untested function
'''
if not context: context = {}
pool = pooler.get_pool(cr.dbname)
sxwval = StringIO(base64.decodestring(file_sxw))
if file_type=='sxw':
@ -61,7 +60,6 @@ class report_xml(osv.osv):
return True
def report_get(self, cr, uid, report_id, context=None):
if not context: context = {}
report = self.browse(cr, uid, report_id, context=context)
return {
'file_type' : report.report_type,

View File

@ -30,7 +30,6 @@ class base_report_designer_installer(osv.osv_memory):
_inherit = 'res.config.installer'
def default_get(self, cr, uid, fields, context=None):
if not context: context = {}
data = super(base_report_designer_installer, self).default_get(cr, uid, fields, context=context)
plugin_file = open(addons.get_module_resource('base_report_designer','plugin', 'openerp_report_designer.zip'),'rb')
data['plugin_file'] = base64.encodestring(plugin_file.read())

View File

@ -39,7 +39,6 @@ class base_report_sxw(osv.osv_memory):
def get_report(self, cr, uid, ids, context=None):
if not context: context = {}
data = self.read(cr,uid,ids)[0]
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'base_report_designer', 'view_base_report_file_sxw')
@ -75,12 +74,11 @@ class base_report_file_sxw(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
if not context: context = {}
res = super(base_report_file_sxw, self).default_get(cr, uid, fields, context=context)
report_id1 = self.pool.get('base.report.sxw').search(cr,uid,[])
data=self.pool.get('base.report.sxw').read(cr,uid,report_id1)[0]
report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
if not context:
if context is None:
context={}
if 'report_id' in fields:
res['report_id'] = data['report_id']
@ -96,7 +94,6 @@ class base_report_file_sxw(osv.osv_memory):
def upload_report(self, cr, uid, ids, context=None):
from base_report_designer import openerp_sxw2rml
import StringIO
if not context: context = {}
data=self.read(cr,uid,ids)[0]
sxwval = StringIO.StringIO(base64.decodestring(data['file_sxw_upload']))
fp = tools.file_open('normalized_oo2rml.xsl',subdir='addons/base_report_designer/openerp_sxw2rml')
@ -137,8 +134,6 @@ class base_report_rml_save(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
if not context:
context = {}
res = super(base_report_rml_save, self).default_get(cr, uid, fields, context=context)
report_id = self.pool.get('base.report.sxw').search(cr,uid,[])

View File

@ -66,8 +66,6 @@ class base_synchro(osv.osv_memory):
report_write = 0
def synchronize(self, cr, uid, server, object, context=None):
if not context:
context = {}
pool = pooler.get_pool(cr.dbname)
self.meta = {}
ids = []
@ -139,8 +137,6 @@ class base_synchro(osv.osv_memory):
return True
def get_id(self, cr, uid, object_id, id, action, context=None):
if not context:
context = {}
pool = pooler.get_pool(cr.dbname)
line_pool = pool.get('base.synchro.obj.line')
field_src = (action=='u') and 'local_id' or 'remote_id'
@ -154,8 +150,6 @@ class base_synchro(osv.osv_memory):
def relation_transform(self, cr, uid, pool_src, pool_dest, object, id, action, context=None):
if not id:
return False
if not context:
context = {}
pool = pooler.get_pool(cr.dbname)
cr.execute('''select o.id from base_synchro_obj o left join ir_model m on (o.model_id =m.id) where
m.model=%s and
@ -189,8 +183,6 @@ class base_synchro(osv.osv_memory):
def data_transform(self, cr, uid, pool_src, pool_dest, object, data, action='u', context=None):
self.meta.setdefault(pool_src, {})
if not context:
context = {}
if not object in self.meta[pool_src]:
self.meta[pool_src][object] = pool_src.get(object).fields_get(cr, uid, context=context)
fields = self.meta[pool_src][object]
@ -221,8 +213,6 @@ class base_synchro(osv.osv_memory):
def upload_download(self, cr, uid, ids, context=None):
if not context:
context = {}
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
syn_obj = self.browse(cr, uid, ids, context=context)[0]
pool = pooler.get_pool(cr.dbname)
@ -260,8 +250,6 @@ Exceptions:
return True
def upload_download_multi_thread(self, cr, uid, data, context=None):
if not context:
context = {}
threaded_synchronization = threading.Thread(target=self.upload_download, args=(cr, uid, data, context))
threaded_synchronization.run()
data_obj = self.pool.get('ir.model.data')

View File

@ -38,8 +38,6 @@ class board_board(osv.osv):
@param ids: List of Board's IDs
@return: arch of xml view.
"""
if not context:
context = {}
board = self.pool.get('board.board').browse(cr, uid, ids, context=context)
left = []
right = []
@ -81,8 +79,6 @@ class board_board(osv.osv):
dictionary must be with the form: {name_of_the_field: value, ...}.
@return: True
"""
if not context:
context = {}
result = super(board_board, self).write(cr, uid, ids, vals, context=context)
board = self.pool.get('board.board').browse(cr, uid, ids[0], context=context)
@ -101,8 +97,6 @@ class board_board(osv.osv):
@return: id of new created record of board.board.
"""
if not context:
context = {}
if not 'name' in vals:
return False
@ -126,8 +120,6 @@ class board_board(osv.osv):
@return: Dictionary of Fields, arch and toolbar.
"""
if not context:
context = {}
res = {}
res = super(board_board, self).fields_view_get(cr, user, view_id, view_type,\

View File

@ -55,7 +55,7 @@ class board_menu_create(osv.osv_memory):
@param ids: List of Board Menu Create's IDs
@return: Dictionary {}.
"""
if not context:
if context is None:
context = {}
context_id = context and context.get('active_id', False) or False

View File

@ -149,7 +149,7 @@ def get_attribute_mapping(cr, uid, calname, context=None):
@param calname: Get Calendar name
@param context: A standard dictionary for contextual values """
if not context:
if context is None:
context = {}
pool = pooler.get_pool(cr.dbname)
field_obj = pool.get('basic.calendar.fields')
@ -470,7 +470,7 @@ class CalDAV(object):
@param vals: Get Values
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
ids = []
model_obj = self.pool.get(context.get('model'))
@ -592,7 +592,7 @@ class Calendar(CalDAV, osv.osv):
}
def get_calendar_objects(self, cr, uid, ids, parent=None, domain=None, context=None):
if not context:
if context is None:
context = {}
if not domain:
domain = []
@ -622,7 +622,7 @@ class Calendar(CalDAV, osv.osv):
def get_cal_max_modified(self, cr, uid, ids, parent=None, domain=None, context=None):
if not context:
if context is None:
context = {}
if not domain:
domain = []
@ -652,7 +652,7 @@ class Calendar(CalDAV, osv.osv):
@param vobj: the type of object to export
@return the ical data.
"""
if not context:
if context is None:
context = {}
ctx_model = context.get('model', None)
ctx_res_id = context.get('res_id', None)
@ -684,7 +684,7 @@ class Calendar(CalDAV, osv.osv):
@param data_id: Get Datas ID or False
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
vals = []
ical_data = content
@ -1066,7 +1066,7 @@ class Timezone(CalDAV, osv.osv_memory):
@param model: Get Model's name
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
ctx = context.copy()
ctx.update({'model': model})
@ -1125,7 +1125,7 @@ class Alarm(CalDAV, osv.osv_memory):
@param alarm_id: Get Alarm's Id
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
valarm = vevent.add('valarm')
alarm_object = self.pool.get(model)
@ -1246,7 +1246,7 @@ class Attendee(CalDAV, osv.osv_memory):
@param attendee_ids: Get Attendee's Id
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
attendee_object = self.pool.get(model)
ctx = context.copy()

View File

@ -35,8 +35,6 @@ class calendar_collection(osv.osv):
}
def _get_root_calendar_directory(self, cr, uid, context=None):
if not context:
context = {}
objid = self.pool.get('ir.model.data')
try:
mid = objid._get_id(cr, uid, 'document', 'dir_calendars')
@ -52,8 +50,6 @@ class calendar_collection(osv.osv):
return False
def get_node_class(self, cr, uid, ids, dbro=None, dynamic=False, context=None):
if not context:
context = {}
if dbro is None:
dbro = self.browse(cr, uid, ids, context=context)
@ -69,13 +65,9 @@ class calendar_collection(osv.osv):
def get_description(self, cr, uid, ids, context=None):
#TODO : return description of all calendars
if not context:
context = {}
return False
def get_schedule_inbox_URL(self, cr, uid, ids, context=None):
if not context:
context = {}
calendar_obj = self.pool.get('basic.calendar')
calendar_ids = calendar_obj.search(cr, uid, [

View File

@ -53,7 +53,7 @@ class crm_case(object):
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
if not context.get('portal', False):
return False
@ -66,7 +66,7 @@ class crm_case(object):
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
if not context.get('portal', False):
return False
@ -136,8 +136,6 @@ class crm_case(object):
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context:
context = {}
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return user.context_section_id.id or False
@ -149,8 +147,6 @@ class crm_case(object):
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
stage_pool = self.pool.get('crm.case.stage')
model = self._name
for case in self.browse(cr, uid, ids, context=context):
@ -183,8 +179,6 @@ class crm_case(object):
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
stage_pool = self.pool.get('crm.case.stage')
model = self._name
for case in self.browse(cr, uid, ids, context=context):
@ -384,8 +378,6 @@ class crm_case(object):
@param context: A standard dictionary for contextual values
"""
if not context:
context = {}
for case in self.browse(cr, uid, ids, context=context):
if not case.section_id.reply_to:
raise osv.except_osv(_('Error!'), ("Reply To is not specified in the sales team"))
@ -450,7 +442,7 @@ class crm_case(object):
return self._action(cr, uid, cases, False, context=context)
def _action(self, cr, uid, cases, state_to, scrit=None, context=None):
if not context:
if context is None:
context = {}
context['state_to'] = state_to
rule_obj = self.pool.get('base.action.rule')
@ -469,8 +461,6 @@ class crm_case(object):
""" Get a list of emails of the people following this thread
"""
res = {}
if not context:
context = {}
for case in self.browse(cr, uid, ids, context=context):
l=[]
if case.email_cc:
@ -587,7 +577,7 @@ class crm_case_section(osv.osv):
@param uid: the current users ID for security checks,
@param ids: List of sales team ids
"""
if not context:
if context is None:
context = {}
res = []
@ -661,8 +651,6 @@ def _links_get(self, cr, uid, context=None):
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
if not context:
context = {}
obj = self.pool.get('res.request.link')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['object', 'name'], context)

View File

@ -51,8 +51,6 @@ this if you want the rule to send an email to the partner."),
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from', False), context=None):
if not context:
context = {}
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:
@ -74,8 +72,6 @@ this if you want the rule to send an email to the partner."),
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context)
if hasattr(obj, 'section_id'):
@ -111,8 +107,6 @@ this if you want the rule to send an email to the partner."),
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values """
if not context:
context = {}
res = super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context)
write = {}
@ -150,8 +144,6 @@ this if you want the rule to send an email to the partner."),
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values """
if not context:
context = {}
res = super(base_action_rule, self).state_get(cr, uid, context=context)
return res + crm.AVAILABLE_STATES
@ -160,8 +152,6 @@ this if you want the rule to send an email to the partner."),
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values """
if not context:
context = {}
res = super(base_action_rule, self).priority_get(cr, uid, context=context)
return res + crm.AVAILABLE_PRIORITIES

View File

@ -40,8 +40,6 @@ class crm_installer(osv.osv_memory):
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if not context:
context = {}
res = super(crm_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
#Checking sale module is installed or not
cr.execute("SELECT * from ir_module_module where state='installed' and name = 'sale'")

View File

@ -53,8 +53,6 @@ class crm_lead(crm_case, osv.osv):
res_obj = self.pool.get('resource.resource')
res = {}
if not context:
context = {}
for lead in self.browse(cr, uid, ids, context=context):
for field in fields:
res[lead.id] = {}
@ -237,7 +235,7 @@ class crm_lead(crm_case, osv.osv):
@param context: A standard dictionary for contextual values
@return: Value of action in dict
"""
if not context:
if context is None:
context = {}
context.update({'active_ids': ids})
@ -321,8 +319,6 @@ class crm_lead(crm_case, osv.osv):
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks
"""
if not context:
context = {}
mailgate_pool = self.pool.get('email.server.tools')
subject = msg.get('subject')
@ -366,8 +362,6 @@ class crm_lead(crm_case, osv.osv):
@param uid: the current users ID for security checks,
@param ids: List of update mails IDs
"""
if not context:
context = {}
if isinstance(ids, (str, int, long)):
ids = [ids]

View File

@ -91,9 +91,6 @@ class crm_meeting(crm_case, osv.osv):
@return: Dictionary value which open Crm Meeting form.
"""
if not context:
context = {}
data_obj = self.pool.get('ir.model.data')
value = {}
@ -154,8 +151,6 @@ class calendar_attendee(osv.osv):
@param context: A standard dictionary for contextual values
"""
name = name[0]
if not context:
context = {}
result = super(calendar_attendee, self)._compute_data(cr, uid, ids, name, arg, context=context)
for attdata in self.browse(cr, uid, ids, context=context):

View File

@ -145,9 +145,6 @@ class crm_opportunity(osv.osv):
if not stage_id:
return {'value':{}}
if not context:
context = {}
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context=context)
if not stage.on_change:
@ -171,8 +168,6 @@ class crm_opportunity(osv.osv):
@return : Dictionary value for created Meeting view
"""
value = {}
if not context:
context = {}
for opp in self.browse(cr, uid, ids, context=context):
data_obj = self.pool.get('ir.model.data')

View File

@ -157,8 +157,6 @@ class crm_phonecall(crm_case, osv.osv):
@return : Dictionary value for created Meeting view
"""
value = {}
if not context:
context = {}
for phonecall in self.browse(cr, uid, ids, context=context):
data_obj = self.pool.get('ir.model.data')

View File

@ -19,7 +19,7 @@ class crm_add_note(osv.osv_memory):
}
def action_add(self, cr, uid, ids, context=None):
if not context:
if context is None:
context = {}
if not context.get('active_model'):

View File

@ -122,7 +122,7 @@ class crm_lead2opportunity(osv.osv_memory):
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
lead_obj = self.pool.get('crm.lead')
@ -177,7 +177,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
@return : Dictionary value for created Partner form.
"""
if not context:
if context is None:
context = {}
partner_ids = self._create_partner(cr, uid, ids, context=context)
@ -214,7 +214,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
@return : Dictionary value for Opportunity form
"""
value = {}
if not context:
if context is None:
context = {}
data_obj = self.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_create')
@ -247,7 +247,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
lead_obj = self.pool.get('crm.lead')
@ -282,7 +282,7 @@ class crm_lead2opportunity_action(osv.osv_memory):
@return : Dictionary value for Opportunity form
"""
value = {}
if not context:
if context is None:
context = {}
data_obj = self.pool.get('ir.model.data')
view_id = False

View File

@ -135,7 +135,7 @@ class crm_lead2partner(osv.osv_memory):
@return : Dictionary value for next form.
"""
if not context:
if context is None:
context = {}
view_obj = self.pool.get('ir.ui.view')
@ -163,7 +163,7 @@ class crm_lead2partner(osv.osv_memory):
@return : Dictionary {}.
"""
if not context:
if context is None:
context = {}
lead_obj = self.pool.get('crm.lead')
@ -226,7 +226,7 @@ class crm_lead2partner(osv.osv_memory):
@return : Dictionary value for created Partner form.
"""
if not context:
if context is None:
context = {}
partner_ids = self._create_partner(cr, uid, ids, context=context)

View File

@ -32,7 +32,7 @@ import pooler
class phonecall2meeting(wizard.interface):
def _makeMeeting(self, cr, uid, data, context=None):
if not context:
if context is None:
context = {}
pool = pooler.get_pool(cr.dbname)
phonecall_case_obj = pool.get('crm.phonecall')

View File

@ -63,7 +63,7 @@ class crm_phonecall2partner(osv.osv_memory):
@return : Partner id if any for selected phonecall.
"""
if not context:
if context is None:
context = {}
phonecall_obj = self.pool.get('crm.phonecall')
@ -99,8 +99,6 @@ class crm_phonecall2partner(osv.osv_memory):
@return : Dictionary value for next form.
"""
if not context:
context = {}
view_obj = self.pool.get('ir.ui.view')
view_id = view_obj.search(cr, uid, [('model', '=', 'crm.phonecall2partner'), \
@ -127,7 +125,7 @@ class crm_phonecall2partner(osv.osv_memory):
@return : Dictionary {}.
"""
if not context:
if context is None:
context = {}
phonecall_obj = self.pool.get('crm.phonecall')
@ -178,8 +176,6 @@ class crm_phonecall2partner(osv.osv_memory):
@return : Dictionary value for created Partner form.
"""
if not context:
context = {}
partner_ids = self._create_partner(cr, uid, ids, context=context)
mod_obj = self.pool.get('ir.model.data')

View File

@ -65,7 +65,7 @@ class crm_send_new_email(osv.osv_memory):
"""
hist_obj = self.pool.get('mailgate.message')
if not context:
if context is None:
context = {}
if not context.get('active_model'):
@ -162,7 +162,7 @@ class crm_send_new_email(osv.osv_memory):
"""
This function gets default values
"""
if not context:
if context is None:
context = {}
if not context.get('active_model'):
@ -263,7 +263,7 @@ class crm_send_new_email(osv.osv_memory):
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
if not context.get('active_model'):

View File

@ -25,8 +25,6 @@ import pooler
import time
def _open_history_event(self, cr, uid, data, context=None):
if not context:
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')

View File

@ -36,8 +36,7 @@ class crm_meeting(osv.osv):
@param ids: List of CRM Meetings IDs
@param context: A standard dictionary for contextual values
"""
if not context:
context = {}
if context is None: context = {}
ids = map(lambda x: base_calendar.base_calendar_id2real_id(x), ids)
event_data = self.read(cr, uid, ids, context=context)
event_obj = self.pool.get('basic.calendar.event')
@ -54,8 +53,6 @@ class crm_meeting(osv.osv):
@param data_id: calendar's Id
@param context: A standard dictionary for contextual values
"""
if not context:
context = {}
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)
@ -68,7 +65,7 @@ class crm_meeting(osv.osv):
@param vals: Get Values
@param context: A standard dictionary for contextual values
"""
if not context:
if context is None:
context = {}
ids = []
model_obj = self.pool.get(context.get('model'))

View File

@ -71,8 +71,6 @@ class res_partner(osv.osv):
'partner_weight': lambda *args: 0
}
def geo_localize(self, cr, uid, ids, context=None):
if not context:
context = {}
for partner in self.browse(cr, uid, ids, context=context):
if not partner.address:
continue
@ -111,8 +109,6 @@ class crm_lead(osv.osv):
def assign_partner(self, cr, uid, ids, context=None):
ok = False
if not context:
context = {}
for part in self.browse(cr, uid, ids, context=context):
if not part.country_id:
continue

View File

@ -169,7 +169,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
"""
Forward the lead to a partner
"""
if not context:
if context is None:
context = {}
this = self.browse(cr, uid, ids[0], context=context)
case_pool = self.pool.get(context.get('active_model'))
@ -202,8 +202,6 @@ class crm_lead_forward_to_partner(osv.osv_memory):
def get_lead_details(self, cr, uid, lead_id, context=None):
body = []
if not context:
context = {}
lead_proxy = self.pool.get('crm.lead')
lead = lead_proxy.browse(cr, uid, lead_id, context=context)
if not lead.type or lead.type == 'lead' or not lead.partner_address_id:

View File

@ -167,8 +167,6 @@ class questionnaire(osv.osv):
@param data: Get Data
@param context: A standard dictionary for contextual values """
if not context:
context = {}
query = """
select name, id
from crm_profiling_question
@ -221,8 +219,6 @@ class partner(osv.osv):
@param context: A standard dictionary for contextual values """
temp = []
if not context:
context = {}
for x in data['form']:
if x.startswith("quest_form") and data['form'][x] != 0 :
temp.append(data['form'][x])
@ -244,8 +240,6 @@ class partner(osv.osv):
@param ids: List of crm profilings IDs
@param context: A standard dictionary for contextual values """
if not context:
context={}
if 'answers_ids' in vals:
vals['category_id']=[[6, 0, _recompute_categ(self, cr, uid, ids[0], vals['answers_ids'][0][2])]]
return super(partner, self).write(cr, uid, ids, vals, context=context)

View File

@ -30,7 +30,7 @@ class delivery_carrier(osv.osv):
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
if not context:
if context is None:
context = {}
order_id = context.get('order_id',False)
if not order_id:
@ -42,7 +42,7 @@ class delivery_carrier(osv.osv):
return res
def get_price(self, cr, uid, ids, field_name, arg=None, context=None):
res={}
if not context:
if context is None:
context = {}
sale_obj=self.pool.get('sale.order')
grid_obj=self.pool.get('delivery.grid')
@ -70,8 +70,6 @@ class delivery_carrier(osv.osv):
'active': lambda *args:1
}
def grid_get(self, cr, uid, ids, contact_id, context=None):
if not context:
context = {}
contact = self.pool.get('res.partner.address').browse(cr, uid, [contact_id], context=context)[0]
for carrier in self.browse(cr, uid, ids, context=context):
for grid in carrier.grids_id:
@ -114,8 +112,6 @@ class delivery_grid(osv.osv):
total = 0
weight = 0
volume = 0
if not context:
context = {}
for line in order.order_line:
if not line.product_id:
continue

View File

@ -30,8 +30,6 @@ class stock_picking(osv.osv):
def _cal_weight(self, cr, uid, ids, name, args, context=None):
res = {}
if not context:
context = {}
uom_obj = self.pool.get('product.uom')
for picking in self.browse(cr, uid, ids, context=context):
total_weight = total_weight_net = 0.00
@ -78,9 +76,6 @@ class stock_picking(osv.osv):
grid_obj = self.pool.get('delivery.grid')
invoice_line_obj = self.pool.get('account.invoice.line')
if not context:
context = {}
result = super(stock_picking, self).action_invoice_create(cursor, user,
ids, journal_id=journal_id, group=group, type=type,
context=context)
@ -142,8 +137,6 @@ class stock_move(osv.osv):
def _cal_move_weight(self, cr, uid, ids, name, args, context=None):
res = {}
if not context:
context = {}
uom_obj = self.pool.get('product.uom')
for move in self.browse(cr, uid, ids, context=context):
weight = weight_net = 0.00

View File

@ -47,8 +47,6 @@ class make_delivery(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
if not context:
context = {}
res = super(make_delivery, self).default_get(cr, uid, fields, context=context)
order_obj = self.pool.get('sale.order')
for order in order_obj.browse(cr, uid, context.get('active_ids', []), context=context):
@ -60,7 +58,7 @@ class make_delivery(osv.osv_memory):
return res
def view_init(self, cr , uid , fields, context=None):
if not context:
if context is None:
context = {}
order_obj = self.pool.get('sale.order')
for order in order_obj.browse(cr, uid, context.get('active_ids', []), context=context):
@ -81,7 +79,7 @@ class make_delivery(osv.osv_memory):
@return:
"""
if not context:
if context is None:
context = {}
rec_ids = context and context.get('active_ids',[])
order_obj = self.pool.get('sale.order')

View File

@ -110,7 +110,7 @@ class document_directory_content(osv.osv):
return True
def process_read(self, cr, uid, node, context=None):
if not context:
if context is None:
context = {}
if node.extension != '.pdf':
raise Exception("Invalid content: %s" % node.extension)

View File

@ -28,8 +28,6 @@ class ir_action_report_xml(osv.osv):
def _model_get(self, cr, uid, ids, name, arg, context=None):
res = {}
if not context:
context = {}
model_pool = self.pool.get('ir.model')
for data in self.read(cr, uid, ids, ['model']):
model = data.get('model',False)

View File

@ -39,7 +39,7 @@ class document_file(osv.osv):
return os.path.join(DMS_ROOT_PATH, cr.dbname)
def _data_get(self, cr, uid, ids, name, arg, context=None):
if not context:
if context is None:
context = {}
fbrl = self.browse(cr, uid, ids, context=context)
nctx = nodes.get_node_context(cr, uid, context={})
@ -64,8 +64,6 @@ class document_file(osv.osv):
def _data_set(self, cr, uid, id, name, value, arg, context=None):
if not value:
return True
if not context:
context = {}
fbro = self.browse(cr, uid, id, context=context)
nctx = nodes.get_node_context(cr, uid, context={})
fnode = nodes.node_file(None, None, nctx, fbro)
@ -140,8 +138,6 @@ class document_file(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
if not context:
context = {}
if 'name' not in default:
name = self.read(cr, uid, [id])[0]['name']
default.update({'name': name + " (copy)"})
@ -233,8 +229,6 @@ class document_file(osv.osv):
It is a hack that will try to discover if the mentioned record is
clearly associated with a partner record.
"""
if not context:
context = {}
obj_model = self.pool.get(res_model)
if obj_model._name == 'res.partner':
return res_id
@ -249,8 +243,6 @@ class document_file(osv.osv):
def unlink(self, cr, uid, ids, context=None):
stor = self.pool.get('document.storage')
unres = []
if not context:
context = {}
# We have to do the unlink in 2 stages: prepare a list of actual
# files to be unlinked, update the db (safer to do first, can be
# rolled back) and then unlink the files. The list wouldn't exist

View File

@ -175,8 +175,6 @@ class document_directory(osv.osv):
""" Return a node object for the given uri.
This fn merely passes the call to node_context
"""
if not context:
context = {}
return nodes.get_node_context(cr, uid, context).get_uri(cr, uri)
@ -186,8 +184,6 @@ class document_directory(osv.osv):
This function can be overriden by inherited classes ;)
@param dbro The browse object, if caller already has it
"""
if not context:
context = {}
if dbro is None:
dbro = self.browse(cr, uid, ids, context=context)
@ -237,8 +233,6 @@ class document_directory(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default ={}
if not context:
context = {}
name = self.read(cr, uid, [id])[0]['name']
default.update({'name': name+ " (copy)"})
return super(document_directory,self).copy(cr, uid, id, default, context=context)

View File

@ -422,9 +422,7 @@ class document_storage(osv.osv):
optionally, fil_obj could point to the browse object of the file
(ir.attachment)
"""
if not context:
context = {}
boo = self.browse(cr, uid, id, context)
boo = self.browse(cr, uid, id, context=context)
if not boo.online:
raise IOError(errno.EREMOTE, 'medium offline')
@ -540,8 +538,6 @@ class document_storage(osv.osv):
This function MUST be used from an ir.attachment. It wouldn't make sense
to store things persistently for other types (dynamic).
"""
if not context:
context = {}
boo = self.browse(cr, uid, id, context=context)
if fil_obj:
ira = fil_obj
@ -688,8 +684,6 @@ class document_storage(osv.osv):
@return the dict of values that can safely be be stored in the db.
"""
if not context:
context = {}
sbro = self.browse(cr, uid, file_node.storage_id, context=context)
assert sbro, "The file #%d didn't provide storage" % file_node.file_id
@ -732,8 +726,6 @@ class document_storage(osv.osv):
file should move to.
@return the dict of values that can safely be be stored in the db.
"""
if not context:
context = {}
sbro = self.browse(cr, uid, file_node.storage_id, context=context)
assert sbro, "The file #%d didn't provide storage" % file_node.file_id

View File

@ -33,8 +33,6 @@ class document_configuration(osv.osv_memory):
def execute(self, cr, uid, ids, context=None):
if not context:
context = {}
conf_id = ids and ids[0] or False
conf = self.browse(cr, uid, conf_id, context=context)
dir_pool = self.pool.get('document.directory')

View File

@ -33,8 +33,6 @@ class document_ftp_browse(osv.osv_memory):
def default_get(self, cr, uid, fields, context=None):
res = {}
if not context:
context = {}
if 'url' in fields:
user_pool = self.pool.get('res.users')
current_user = user_pool.browse(cr, uid, uid, context=context)
@ -52,8 +50,6 @@ class document_ftp_browse(osv.osv_memory):
def browse_ftp(self, cr, uid, ids, context=None):
data_id = ids and ids[0] or False
if not context:
context = {}
data = self.browse(cr, uid, data_id, context=context)
final_url = data.url
return {

View File

@ -39,8 +39,6 @@ class document_ftp_configuration(osv.osv_memory):
}
def execute(self, cr, uid, ids, context=None):
if not context:
context = {}
conf = self.browse(cr, uid, ids[0], context=context)
data_pool = self.pool.get('ir.model.data')
# Update the action for FTP browse.

View File

@ -347,7 +347,7 @@ class crm_meeting(osv.osv):
"""
if not default: default = {}
if not context: context = {}
if context is None: context = {}
default.update({'code': self.pool.get('ir.sequence').get(cr, uid, 'crm.meeting'), 'id': False})
return super(crm_meeting, self).copy(cr, uid, id, default, context)

View File

@ -46,8 +46,6 @@ class document_davdir(osv.osv):
raise ValueError("dir node for %s type", dbro.type)
def _prepare_context(self, cr, uid, nctx, context=None):
if not context:
context = {}
nctx.node_file_class = nodes.node_file
# We can fill some more fields, but avoid any expensive function
# that might be not worth preparing.

View File

@ -72,8 +72,6 @@ def get_value(cursor, user, recid, message=None, template=None, context=None):
@return: Computed message (unicode) or u""
"""
pool = pooler.get_pool(cursor.dbname)
if not context:
context = {}
if message is None:
message = {}
#Returns the computed expression
@ -274,7 +272,7 @@ This is useful for CRM leads for example"),
def create_action(self, cr, uid, ids, context=None):
vals = {}
if not context:
if context is None:
context = {}
template_obj = self.browse(cr, uid, ids, context=context)[0]
src_obj = template_obj.object_name.model
@ -304,8 +302,6 @@ This is useful for CRM leads for example"),
return True
def unlink_action(self, cr, uid, ids, context=None):
if not context:
context = {}
for template in self.browse(cr, uid, ids, context=context):
try:
if template.ref_ir_act_window:

View File

@ -209,8 +209,6 @@ unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
@return: SMTP server object or Exception
"""
if not context:
context = {}
#Type cast ids to integer
if type(ids) == list:
ids = ids[0]
@ -268,8 +266,6 @@ unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
This method should now wrap smtp_connection
"""
#This function returns a SMTP server object
if not context:
context = {}
logger = netsvc.Logger()
core_obj = self.browse(cursor, user, id, context=context)
if core_obj.smtpserver and core_obj.smtpport and core_obj.state == 'approved':

View File

@ -196,8 +196,6 @@ class email_template_mailbox(osv.osv):
It just changes the folder of the item to "Trash", if it is no in Trash folder yet,
or completely deletes it if it is already in Trash.
"""
if not context:
context = {}
to_update = []
to_remove = []
for mail in self.browse(cr, uid, ids, context=context):

View File

@ -101,11 +101,11 @@ class event_event(osv.osv):
@param context: A standard dictionary for contextual values
@return: True
"""
if not context:
context = {}
res = False
if type(ids) in (int, long,):
ids = [ids]
if context is None:
context = {}
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
for event in self.browse(cr, uid, ids, context=context):
@ -141,8 +141,6 @@ class event_event(osv.osv):
"""
register_pool = self.pool.get('event.registration')
res = {}
if not context:
context = {}
for event in self.browse(cr, uid, ids, context=context):
res[event.id] = {}
for field in fields:
@ -394,7 +392,7 @@ class event_registration(osv.osv):
inv_pool = self.pool.get('account.invoice')
product_pool = self.pool.get('product.product')
contact_pool = self.pool.get('res.partner.contact')
if not context:
if context is None:
context = {}
# If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the
# last day of the last month as invoice date
@ -450,7 +448,7 @@ class event_registration(osv.osv):
def do_close(self, cr, uid, ids, context=None):
""" Close Registration
"""
if not context:
if context is None:
context = {}
invoice_id = context.get('invoice_id', False)
values = {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}
@ -467,12 +465,12 @@ class event_registration(osv.osv):
@param context: A standard dictionary for contextual values
@return: True
"""
if not context:
context = {}
if type(ids) in (int, long,):
ids = [ids]
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
if context is None:
context = {}
for registration in self.browse(cr, uid, ids, context=context):
total_confirmed = registration.event_id.register_current + registration.nb_register
if total_confirmed <= registration.event_id.register_max or registration.event_id.register_max == 0:
@ -500,10 +498,10 @@ class event_registration(osv.osv):
def button_reg_close(self, cr, uid, ids, context=None):
"""This Function Close Event Registration.
"""
if not context:
context = {}
data_pool = self.pool.get('ir.model.data')
unclosed_ids = []
if context is None:
context = {}
for registration in self.browse(cr, uid, ids, context=context):
if registration.tobe_invoiced and not registration.invoice_id:
unclosed_ids.append(registration.id)
@ -538,8 +536,6 @@ class event_registration(osv.osv):
"""
Send email to user
"""
if not context:
context = {}
for regestration in self.browse(cr, uid, ids, context=context):
src = regestration.event_id.reply_to or False

View File

@ -105,8 +105,6 @@ class partner_event_registration(osv.osv_memory):
"""Overrides orm name_get method
@param ids: List of partner_event_register ids
"""
if not context:
context = {}
res = []
if not ids:
@ -124,7 +122,7 @@ class partner_event_registration(osv.osv_memory):
event_obj = self.pool.get('event.event')
product_obj = self.pool.get('product.product')
partner_obj = self.pool.get('res.partner')
if not context:
if context is None:
context = {}
partner_id = context.get('active_id', False)
if event_id:

View File

@ -24,8 +24,6 @@ from osv import fields, osv
class one2many_mod_task(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
if not context:
context = {}
if not values:
values = {}
res = {}

View File

@ -65,8 +65,6 @@ class event_project(osv.osv_memory):
}
def create_duplicate(self, cr, uid, ids, context=None):
if not context:
context = {}
event_obj = self.pool.get('event.event')
project_obj = self.pool.get('project.project')
event = event_obj.browse(cr, uid, context.get('active_id', False), context=context)

View File

@ -100,7 +100,7 @@ class email_server(osv.osv):
return True
def button_confirm_login(self, cr, uid, ids, context=None):
if not context:
if context is None:
context = {}
for server in self.browse(cr, uid, ids, context=context):
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail start checking for new emails on %s' % (server.name))
@ -147,7 +147,7 @@ class email_server(osv.osv):
return self.fetch_mail(cr, uid, ids, context=context)
def fetch_mail(self, cr, uid, ids, context=None):
if not context:
if context is None:
context = {}
email_tool = self.pool.get('email.server.tools')
action_pool = self.pool.get('ir.actions.server')
@ -209,7 +209,7 @@ class mailgate_message(osv.osv):
_order = 'id desc'
def create(self, cr, uid, values, context=None):
if not context:
if context is None:
context={}
server_id = context.get('server_id',False)
server_type = context.get('server_type',False)
@ -221,7 +221,7 @@ class mailgate_message(osv.osv):
return res
def write(self, cr, uid, ids, values, context=None):
if not context:
if context is None:
context={}
server_id = context.get('server_id',False)
server_type = context.get('server_type',False)

View File

@ -26,8 +26,6 @@ from osv import fields
import time
def _launch_wizard(self, cr, uid, data, context=None):
if not context:
context = {}
address_obj= pooler.get_pool(cr.dbname).get('res.partner.address')
m= address_obj.browse(cr, uid, data['id'], context=context)
url=''

View File

@ -28,8 +28,6 @@ class hr_employee_category(osv.osv):
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
if not context:
context = {}
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
res = []
for record in reads:
@ -40,8 +38,6 @@ class hr_employee_category(osv.osv):
return res
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
if not context:
context = {}
res = self.name_get(cr, uid, ids, context=context)
return dict(res)
@ -55,8 +51,6 @@ class hr_employee_category(osv.osv):
}
def _check_recursion(self, cr, uid, ids, context=None):
if not context:
context = {}
level = 100
while len(ids):
cr.execute('select distinct parent_id from hr_employee_category where id IN %s', (tuple(ids), ))
@ -86,16 +80,12 @@ class hr_job(osv.osv):
def _no_of_employee(self, cr, uid, ids, name, args, context=None):
res = {}
if not context:
context = {}
for job in self.browse(cr, uid, ids, context=context):
res[job.id] = len(job.employee_ids or [])
return res
def _no_of_recruitement(self, cr, uid, ids, name, args, context=None):
res = {}
if not context:
context = {}
for job in self.browse(cr, uid, ids, context=context):
res[job.id] = job.expected_employees - job.no_of_employee
return res
@ -175,8 +165,6 @@ class hr_employee(osv.osv):
def onchange_company(self, cr, uid, ids, company, context=None):
address_id = False
if not context:
context = {}
if company:
company_id = self.pool.get('res.company').browse(cr, uid, company, context=context)
address = self.pool.get('res.partner').address_get(cr, uid, [company_id.partner_id.id], ['default'])
@ -185,8 +173,6 @@ class hr_employee(osv.osv):
def onchange_user(self, cr, uid, ids, user_id, context=None):
work_email = False
if not context:
context = {}
if user_id:
work_email = self.pool.get('res.users').browse(cr, uid, user_id, context=context).user_email
return {'value': {'work_email' : work_email}}
@ -203,8 +189,6 @@ class hr_employee(osv.osv):
def _check_recursion(self, cr, uid, ids, context=None):
level = 100
if not context:
context = {}
while len(ids):
cr.execute('SELECT DISTINCT parent_id FROM hr_employee WHERE id IN %s AND parent_id!=id',(tuple(ids),))
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
@ -214,8 +198,6 @@ class hr_employee(osv.osv):
return True
def _check_department_id(self, cr, uid, ids, context=None):
if not context:
context = {}
for emp in self.browse(cr, uid, ids, context=context):
if emp.department_id.manager_id and emp.id == emp.department_id.manager_id.id:
return False

View File

@ -29,8 +29,6 @@ class hr_employee(osv.osv):
def _get_latest_contract(self, cr, uid, ids, field_name, args, context=None):
res = {}
if not context:
context = {}
obj_contract = self.pool.get('hr.contract')
for emp in self.browse(cr, uid, ids, context=context):
contract_ids = obj_contract.search(cr, uid, [('employee_id','=',emp.id),], order='date_start', context=context)

Some files were not shown because too many files have changed in this diff Show More