[REF]: Added remaining context changes in _constraints. Removed unnecessary checking for context from methods.
bzr revid: uco@tinyerp.com-20101213064309-vg36f1510xv2f8zb
This commit is contained in:
parent
8596a9626b
commit
d827b2f6ea
|
@ -30,7 +30,7 @@ from osv import fields, osv
|
|||
import decimal_precision as dp
|
||||
from tools.translate import _
|
||||
|
||||
def check_cycle(self, cr, uid, ids):
|
||||
def check_cycle(self, cr, uid, ids, context=None):
|
||||
""" climbs the ``self._table.parent_id`` chains for 100 levels or
|
||||
until it can't find any more parent(s)
|
||||
|
||||
|
@ -194,7 +194,7 @@ class account_account(osv.osv):
|
|||
if not args[pos][2]:
|
||||
del args[pos]
|
||||
continue
|
||||
jour = self.pool.get('account.journal').browse(cr, uid, args[pos][2])
|
||||
jour = self.pool.get('account.journal').browse(cr, uid, args[pos][2], context=context)
|
||||
if (not (jour.account_control_ids or jour.type_control_ids)) or not args[pos][2]:
|
||||
args[pos] = ('type','not in',('consolidation','view'))
|
||||
continue
|
||||
|
@ -207,7 +207,7 @@ class account_account(osv.osv):
|
|||
if context and context.has_key('consolidate_childs'): #add consolidated childs of accounts
|
||||
ids = super(account_account, self).search(cr, uid, args, offset, limit,
|
||||
order, context=context, count=count)
|
||||
for consolidate_child in self.browse(cr, uid, context['account_id']).child_consol_ids:
|
||||
for consolidate_child in self.browse(cr, uid, context['account_id'], context=context).child_consol_ids:
|
||||
ids.append(consolidate_child.id)
|
||||
return ids
|
||||
|
||||
|
@ -681,7 +681,7 @@ class account_journal(osv.osv):
|
|||
|
||||
@return: Returns a list of tupples containing id, name
|
||||
"""
|
||||
result = self.browse(cr, user, ids, context)
|
||||
result = self.browse(cr, user, ids, context=context)
|
||||
res = []
|
||||
for rs in result:
|
||||
name = rs.name
|
||||
|
@ -729,7 +729,7 @@ class account_journal(osv.osv):
|
|||
view_id = 'account_journal_bank_view_multi'
|
||||
|
||||
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=',view_id)])
|
||||
data = obj_data.browse(cr, uid, data_id[0])
|
||||
data = obj_data.browse(cr, uid, data_id[0], context=context)
|
||||
|
||||
res.update({
|
||||
'centralisation':type == 'situation',
|
||||
|
@ -2059,7 +2059,7 @@ class account_model(osv.osv):
|
|||
raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
|
||||
period_id = period_id[0]
|
||||
|
||||
for model in self.browse(cr, uid, ids, context):
|
||||
for model in self.browse(cr, uid, ids, context=context):
|
||||
entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
|
||||
move_id = account_move_obj.create(cr, uid, {
|
||||
'ref': entry['name'],
|
||||
|
@ -2721,7 +2721,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
# Creating Journals Sales and Purchase
|
||||
vals_journal={}
|
||||
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
|
||||
data = obj_data.browse(cr, uid, data_id[0])
|
||||
data = obj_data.browse(cr, uid, data_id[0], context=context)
|
||||
view_id = data.res_id
|
||||
|
||||
seq_id = obj_sequence.search(cr, uid, [('name','=','Account Journal')])[0]
|
||||
|
|
|
@ -385,7 +385,7 @@ class account_bank_statement(osv.osv):
|
|||
return {'value': {'balance_start': balance_start, 'account_id': account_id}}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
stat = self.read(cr, uid, ids, ['state'])
|
||||
stat = self.read(cr, uid, ids, ['state'], context=context)
|
||||
unlink_ids = []
|
||||
for t in stat:
|
||||
if t['state'] in ('draft'):
|
||||
|
|
|
@ -283,7 +283,7 @@ class account_cash_statement(osv.osv):
|
|||
@return: True on success, False otherwise
|
||||
"""
|
||||
|
||||
super(account_cash_statement, self).write(cr, uid, ids, vals)
|
||||
super(account_cash_statement, self).write(cr, uid, ids, vals, context=context)
|
||||
res = self._get_starting_balance(cr, uid, ids)
|
||||
for rs in res:
|
||||
super(account_cash_statement, self).write(cr, uid, [rs], res.get(rs))
|
||||
|
@ -338,7 +338,7 @@ class account_cash_statement(osv.osv):
|
|||
'state': 'open',
|
||||
|
||||
})
|
||||
self.write(cr, uid, [statement.id], vals)
|
||||
self.write(cr, uid, [statement.id], vals, context=context)
|
||||
return True
|
||||
|
||||
def balance_check(self, cr, uid, cash_id, journal_type='bank', context=None):
|
||||
|
|
|
@ -552,7 +552,7 @@ class account_move_line(osv.osv):
|
|||
if (not currency_id) or (not account_id):
|
||||
return {}
|
||||
result = {}
|
||||
acc = account_obj.browse(cr, uid, account_id)
|
||||
acc = account_obj.browse(cr, uid, account_id, context=context)
|
||||
if (amount>0) and journal:
|
||||
x = journal_obj.browse(cr, uid, journal).default_credit_account_id
|
||||
if x: acc = x
|
||||
|
@ -668,7 +668,7 @@ class account_move_line(osv.osv):
|
|||
raise osv.except_osv(_('Warning !'), _('To reconcile the entries company should be the same for all entries'))
|
||||
company_list.append(line.company_id.id)
|
||||
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.reconcile_id:
|
||||
raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
|
||||
if line.reconcile_partial_id:
|
||||
|
@ -814,8 +814,10 @@ class account_move_line(osv.osv):
|
|||
partner_obj.write(cr, uid, [partner_id], {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return r_id
|
||||
|
||||
def view_header_get(self, cr, user, view_id, view_type, context):
|
||||
context = self.convert_to_period(cr, user, context)
|
||||
def view_header_get(self, cr, user, view_id, view_type, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
context = self.convert_to_period(cr, user, context=context)
|
||||
if context.get('account_id', False):
|
||||
cr.execute('SELECT code FROM account_account WHERE id = %s', (context['account_id'], ))
|
||||
res = cr.fetchone()
|
||||
|
|
|
@ -45,7 +45,7 @@ class account_installer(osv.osv_memory):
|
|||
ids = modules.search(cr, uid, [('category_id', '=', 'Account Charts')], context=context)
|
||||
charts = list(
|
||||
sorted(((m.name, m.shortdesc)
|
||||
for m in modules.browse(cr, uid, ids)),
|
||||
for m in modules.browse(cr, uid, ids, context=context)),
|
||||
key=itemgetter(1)))
|
||||
charts.insert(0, ('configurable', 'Generic Chart Of Account'))
|
||||
return charts
|
||||
|
|
|
@ -60,7 +60,7 @@ class account_invoice(osv.osv):
|
|||
return res and res[0] or False
|
||||
|
||||
def _get_currency(self, cr, uid, context=None):
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0]
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid], context=context)[0]
|
||||
if user.company_id:
|
||||
return user.company_id.currency_id.id
|
||||
return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=', 1.0)])[0]
|
||||
|
@ -396,7 +396,7 @@ class account_invoice(osv.osv):
|
|||
return True
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
invoices = self.read(cr, uid, ids, ['state'])
|
||||
invoices = self.read(cr, uid, ids, ['state'], context=context)
|
||||
unlink_ids = []
|
||||
for t in invoices:
|
||||
if t['state'] in ('draft', 'cancel'):
|
||||
|
|
|
@ -134,10 +134,10 @@ class res_partner(osv.osv):
|
|||
return [('id','=','0')]
|
||||
return [('id','in',map(itemgetter(0), res))]
|
||||
|
||||
def _credit_search(self, cr, uid, obj, name, args, context):
|
||||
def _credit_search(self, cr, uid, obj, name, args, context=None):
|
||||
return self._asset_difference_search(cr, uid, obj, name, 'receivable', args, context=context)
|
||||
|
||||
def _debit_search(self, cr, uid, obj, name, args, context):
|
||||
def _debit_search(self, cr, uid, obj, name, args, context=None):
|
||||
return self._asset_difference_search(cr, uid, obj, name, 'payable', args, context=context)
|
||||
|
||||
_columns = {
|
||||
|
|
|
@ -51,7 +51,7 @@ class account_change_currency(osv.osv_memory):
|
|||
invoice = obj_inv.browse(cr, uid, context['active_id'], context=context)
|
||||
if invoice.currency_id.id == new_currency:
|
||||
return {}
|
||||
rate = obj_currency.browse(cr, uid, new_currency).rate
|
||||
rate = obj_currency.browse(cr, uid, new_currency, context=context).rate
|
||||
for line in invoice.invoice_line:
|
||||
new_price = 0
|
||||
if invoice.company_id.currency_id.id == invoice.currency_id.id:
|
||||
|
|
|
@ -93,7 +93,7 @@ class account_invoice_refund(osv.osv_memory):
|
|||
date = False
|
||||
period = False
|
||||
description = False
|
||||
company = res_users_obj.browse(cr, uid, uid).company_id
|
||||
company = res_users_obj.browse(cr, uid, uid, context=context).company_id
|
||||
journal_id = form.get('journal_id', False)
|
||||
for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
|
||||
if inv.state in ['draft', 'proforma2', 'cancel']:
|
||||
|
|
|
@ -33,8 +33,6 @@ class account_move_journal(osv.osv_memory):
|
|||
"""
|
||||
Return default account period value
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
account_period_obj = self.pool.get('account.period')
|
||||
ids = account_period_obj.find(cr, uid, context=context)
|
||||
period_id = False
|
||||
|
@ -48,8 +46,6 @@ class account_move_journal(osv.osv_memory):
|
|||
"""
|
||||
|
||||
journal_id = False
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
if context.get('journal_type', False):
|
||||
|
@ -142,8 +138,8 @@ class account_move_journal(osv.osv_memory):
|
|||
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context)
|
||||
|
||||
if not ids:
|
||||
journal = journal_pool.browse(cr, uid, journal_id)
|
||||
period = account_period_obj.browse(cr, uid, period_id)
|
||||
journal = journal_pool.browse(cr, uid, journal_id, context=context)
|
||||
period = account_period_obj.browse(cr, uid, period_id, context=context)
|
||||
|
||||
name = journal.name
|
||||
state = period.state
|
||||
|
|
|
@ -39,8 +39,6 @@ class account_move_line_reconcile_select(osv.osv_memory):
|
|||
@return: dictionary of Open account move line window for reconcile on given account id
|
||||
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
return {
|
||||
'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['account_id'],
|
||||
|
|
|
@ -42,7 +42,7 @@ class account_move_line_select(osv.osv_memory):
|
|||
else:
|
||||
fiscalyear_ids = [context['fiscalyear']]
|
||||
|
||||
fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids)
|
||||
fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids, context=context)
|
||||
|
||||
period_ids = []
|
||||
if fiscalyears:
|
||||
|
|
|
@ -28,8 +28,6 @@ class account_move_line_unreconcile_select(osv.osv_memory):
|
|||
'account_id': fields.many2one('account.account','Account',required=True),
|
||||
}
|
||||
def action_open_window(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
return {
|
||||
'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data['account_id'],
|
||||
|
|
|
@ -31,12 +31,10 @@ class account_open_closed_fiscalyear(osv.osv_memory):
|
|||
}
|
||||
|
||||
def remove_entries(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
fy_obj = self.pool.get('account.fiscalyear')
|
||||
move_obj = self.pool.get('account.move')
|
||||
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data_fyear = fy_obj.browse(cr, uid, data['fyear_id'], context=context)
|
||||
if not data_fyear.end_journal_period_id:
|
||||
raise osv.except_osv(_('Error'), _('No journal for ending writing has been defined for the fiscal year'))
|
||||
|
|
|
@ -73,6 +73,8 @@ class account_partner_reconcile_process(osv.osv_memory):
|
|||
return res
|
||||
|
||||
def next_partner(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
res_partner_obj = self.pool.get('res.partner')
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class account_bs_report(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||
account = self.pool.get('account.account').browse(cr, uid, data['form']['chart_account_id'])
|
||||
account = self.pool.get('account.account').browse(cr, uid, data['form']['chart_account_id'], context=context)
|
||||
if not account.company_id.property_reserve_and_surplus_account:
|
||||
raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !'))
|
||||
data['form']['reserve_account_id'] = account.company_id.property_reserve_and_surplus_account.id
|
||||
|
|
|
@ -38,7 +38,7 @@ class account_common_account_report(osv.osv_memory):
|
|||
def pre_print_report(self, cr, uid, ids, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data['form'].update(self.read(cr, uid, ids, ['display_account'])[0])
|
||||
data['form'].update(self.read(cr, uid, ids, ['display_account'], context=context)[0])
|
||||
return data
|
||||
|
||||
account_common_account_report()
|
||||
|
|
|
@ -41,7 +41,7 @@ class account_common_journal_report(osv.osv_memory):
|
|||
def pre_print_report(self, cr, uid, ids, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data['form'].update(self.read(cr, uid, ids, ['amount_currency'])[0])
|
||||
data['form'].update(self.read(cr, uid, ids, ['amount_currency'], context=context)[0])
|
||||
fy_ids = data['form']['fiscalyear_id'] and [data['form']['fiscalyear_id']] or self.pool.get('account.fiscalyear').search(cr, uid, [('state', '=', 'draft')], context=context)
|
||||
period_list = data['form']['periods'] or self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', fy_ids)], context=context)
|
||||
data['form']['active_ids'] = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', data['form']['journal_ids']), ('period_id', 'in', period_list)], context=context)
|
||||
|
|
|
@ -39,7 +39,7 @@ class account_common_partner_report(osv.osv_memory):
|
|||
def pre_print_report(self, cr, uid, ids, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data['form'].update(self.read(cr, uid, ids, ['result_selection'])[0])
|
||||
data['form'].update(self.read(cr, uid, ids, ['result_selection'], context=context)[0])
|
||||
return data
|
||||
|
||||
account_common_partner_report()
|
||||
|
|
|
@ -39,7 +39,7 @@ class account_print_journal(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||
data['form'].update(self.read(cr, uid, ids, ['sort_selection'])[0])
|
||||
data['form'].update(self.read(cr, uid, ids, ['sort_selection'], context=context)[0])
|
||||
return {'type': 'ir.actions.report.xml', 'report_name': 'account.journal.period.print', 'datas': data}
|
||||
|
||||
account_print_journal()
|
||||
|
|
|
@ -34,8 +34,6 @@ class account_subscription_generate(osv.osv_memory):
|
|||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
def action_generate(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
moves_created=[]
|
||||
|
|
|
@ -41,11 +41,11 @@ class account_unreconcile_reconcile(osv.osv_memory):
|
|||
|
||||
def trans_unrec_reconcile(self, cr, uid, ids, context=None):
|
||||
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
||||
rec_ids = context['active_ids']
|
||||
if context is None:
|
||||
context = {}
|
||||
rec_ids = context['active_ids']
|
||||
if rec_ids:
|
||||
obj_move_reconcile.unlink(cr, uid, rec_ids)
|
||||
obj_move_reconcile.unlink(cr, uid, rec_ids, context=context)
|
||||
return {}
|
||||
|
||||
account_unreconcile_reconcile()
|
||||
|
|
|
@ -59,9 +59,9 @@ class account_use_model(osv.osv_memory):
|
|||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
record_id = context and context.get('model_line', False) or False
|
||||
if record_id:
|
||||
data_model = account_model_obj.browse(cr, uid, data['model'])
|
||||
data_model = account_model_obj.browse(cr, uid, data['model'], context=context)
|
||||
else:
|
||||
data_model = account_model_obj.browse(cr, uid, context['active_ids'])
|
||||
data_model = account_model_obj.browse(cr, uid, context['active_ids'], context=context)
|
||||
for model in data_model:
|
||||
entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%d')}
|
||||
period_id = account_period_obj.find(cr, uid, context=context)
|
||||
|
|
|
@ -33,11 +33,11 @@ class validate_account_move(osv.osv_memory):
|
|||
obj_move = self.pool.get('account.move')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data['journal_id']),('period_id','=',data['period_id'])])
|
||||
if not ids_move:
|
||||
raise osv.except_osv(_('Warning'), _('Specified Journal does not have any account move entries in draft state for this period'))
|
||||
obj_move.button_validate(cr, uid, ids_move, context)
|
||||
obj_move.button_validate(cr, uid, ids_move, context=context)
|
||||
return {}
|
||||
|
||||
validate_account_move()
|
||||
|
|
|
@ -33,8 +33,6 @@ class account_analytic_account(osv.osv):
|
|||
def _analysis_all(self, cr, uid, ids, fields, arg, context=None):
|
||||
dp = 2
|
||||
res = dict([(i, {}) for i in ids])
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context))
|
||||
accounts = self.browse(cr, uid, ids, context=context)
|
||||
|
@ -253,8 +251,6 @@ class account_analytic_account(osv.osv):
|
|||
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
res_final = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context))
|
||||
for i in child_ids:
|
||||
res[i] = {}
|
||||
|
@ -281,8 +277,6 @@ class account_analytic_account(osv.osv):
|
|||
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
res_final = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context))
|
||||
|
||||
for i in child_ids:
|
||||
|
@ -309,8 +303,6 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
def _remaining_hours_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
if account.quantity_max != 0:
|
||||
res[account.id] = account.quantity_max - account.hours_quantity
|
||||
|
@ -322,8 +314,6 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
def _hours_qtt_invoiced_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
res[account.id] = account.hours_quantity - account.hours_qtt_non_invoiced
|
||||
if res[account.id] < 0:
|
||||
|
@ -334,8 +324,6 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
def _revenue_per_hour_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
if account.hours_qtt_invoiced == 0:
|
||||
res[account.id]=0.0
|
||||
|
@ -347,8 +335,6 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
def _real_margin_rate_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
if account.ca_invoiced == 0:
|
||||
res[account.id]=0.0
|
||||
|
@ -362,8 +348,6 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
def _remaining_ca_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
if account.amount_max != 0:
|
||||
res[account.id] = account.amount_max - account.ca_invoiced
|
||||
|
@ -375,8 +359,6 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
def _real_margin_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
res[account.id] = account.ca_invoiced + account.total_cost
|
||||
for id in ids:
|
||||
|
@ -385,8 +367,6 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
def _theorical_margin_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for account in self.browse(cr, uid, ids, context=context):
|
||||
res[account.id] = account.ca_theorical + account.total_cost
|
||||
for id in ids:
|
||||
|
@ -450,8 +430,6 @@ class account_analytic_account_summary_user(osv.osv):
|
|||
|
||||
def _unit_amount(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
account_obj = self.pool.get('account.analytic.account')
|
||||
cr.execute('SELECT MAX(id) FROM res_users')
|
||||
max_user = cr.fetchone()[0]
|
||||
|
@ -618,8 +596,6 @@ class account_analytic_account_summary_month(osv.osv):
|
|||
|
||||
def _unit_amount(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
account_obj = self.pool.get('account.analytic.account')
|
||||
account_ids = [int(str(int(x))[:-6]) for x in ids]
|
||||
month_ids = [int(str(int(x))[-6:]) for x in ids]
|
||||
|
|
|
@ -41,8 +41,6 @@ class account_analytic_default(osv.osv):
|
|||
|
||||
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context=None):
|
||||
domain = []
|
||||
if context is None:
|
||||
context = {}
|
||||
if product_id:
|
||||
domain += ['|', ('product_id', '=', product_id)]
|
||||
domain += [('product_id','=', False)]
|
||||
|
@ -106,8 +104,6 @@ class sale_order_line(osv.osv):
|
|||
|
||||
# Method overridden to set the analytic account by default on criterion match
|
||||
def invoice_line_create(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
create_ids = super(sale_order_line, self).invoice_line_create(cr, uid, ids, context=context)
|
||||
if not ids:
|
||||
return create_ids
|
||||
|
|
|
@ -355,8 +355,6 @@ class account_invoice(osv.osv):
|
|||
_inherit = "account.invoice"
|
||||
|
||||
def line_get_convert(self, cr, uid, x, part, date, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res=super(account_invoice,self).line_get_convert(cr, uid, x, part, date, context=context)
|
||||
res['analytics_id'] = x.get('analytics_id', False)
|
||||
return res
|
||||
|
@ -425,8 +423,6 @@ class sale_order_line(osv.osv):
|
|||
|
||||
# Method overridden to set the analytic account by default on criterion match
|
||||
def invoice_line_create(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context=context)
|
||||
inv_line_obj = self.pool.get('account.invoice.line')
|
||||
acct_anal_def_obj = self.pool.get('account.analytic.default')
|
||||
|
@ -447,8 +443,6 @@ class account_bank_statement(osv.osv):
|
|||
_name = "account.bank.statement"
|
||||
|
||||
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
account_move_line_pool = self.pool.get('account.move.line')
|
||||
account_bank_statement_line_pool = self.pool.get('account.bank.statement.line')
|
||||
st_line = account_bank_statement_line_pool.browse(cr, uid, st_line_id, context=context)
|
||||
|
@ -460,10 +454,8 @@ class account_bank_statement(osv.osv):
|
|||
return result
|
||||
|
||||
def button_confirm_bank(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
super(account_bank_statement,self).button_confirm_bank(cr, uid, ids, context=context)
|
||||
for st in self.browse(cr, uid, ids, context):
|
||||
for st in self.browse(cr, uid, ids, context=context):
|
||||
for st_line in st.line_ids:
|
||||
if st_line.analytics_id:
|
||||
if not st.journal_id.analytic_journal_id:
|
||||
|
|
|
@ -30,6 +30,8 @@ class analytic_plan_create_model(osv.osv_memory):
|
|||
plan_obj = self.pool.get('account.analytic.plan.instance')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
anlytic_plan_obj = self.pool.get('account.analytic.plan')
|
||||
if context is None:
|
||||
context = {}
|
||||
if 'active_id' in context and context['active_id']:
|
||||
plan = plan_obj.browse(cr, uid, context['active_id'], context=context)
|
||||
if (not plan.name) or (not plan.code):
|
||||
|
|
|
@ -27,8 +27,6 @@ class account_invoice_line(osv.osv):
|
|||
_inherit = "account.invoice.line"
|
||||
|
||||
def move_line_get(self, cr, uid, invoice_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context)
|
||||
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
|
||||
if inv.type in ('out_invoice','out_refund'):
|
||||
|
@ -130,8 +128,6 @@ class account_invoice_line(osv.osv):
|
|||
return res
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not product:
|
||||
return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
|
||||
else:
|
||||
|
|
|
@ -31,7 +31,6 @@ class stock_picking(osv.osv):
|
|||
def action_invoice_create(self, cr, uid, ids, journal_id=False,
|
||||
group=False, type='out_invoice', context=None):
|
||||
'''Return ids of created invoices for the pickings'''
|
||||
if context is None: context = {}
|
||||
res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context=context)
|
||||
if type == 'in_refund':
|
||||
for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context):
|
||||
|
|
|
@ -111,7 +111,8 @@ class crossovered_budget_lines(osv.osv):
|
|||
def _prac_amt(self, cr, uid, ids, context=None):
|
||||
res = {}
|
||||
result = 0.0
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
acc_ids = [x.id for x in line.general_budget_id.account_ids]
|
||||
if not acc_ids:
|
||||
|
@ -134,14 +135,14 @@ class crossovered_budget_lines(osv.osv):
|
|||
|
||||
def _prac(self, cr, uid, ids, name, args, context=None):
|
||||
res={}
|
||||
if context is None: context = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
res[line.id] = self._prac_amt(cr, uid, [line.id], context=context)[line.id]
|
||||
return res
|
||||
|
||||
def _theo_amt(self, cr, uid, ids, context=None):
|
||||
res = {}
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
today = datetime.datetime.today()
|
||||
date_to = today.strftime("%Y-%m-%d")
|
||||
|
@ -172,7 +173,6 @@ class crossovered_budget_lines(osv.osv):
|
|||
|
||||
def _theo(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None: context = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
res[line.id] = self._theo_amt(cr, uid, [line.id], context=context)[line.id]
|
||||
return res
|
||||
|
|
|
@ -39,7 +39,7 @@ class account_budget_analytic(osv.osv_memory):
|
|||
datas = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': context.get('active_ids',[]),
|
||||
'model': 'account.analytic.account',
|
||||
|
|
|
@ -39,7 +39,7 @@ class account_budget_crossvered_report(osv.osv_memory):
|
|||
datas = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': context.get('active_ids',[]),
|
||||
'model': 'crossovered.budget',
|
||||
|
|
|
@ -41,7 +41,7 @@ class account_budget_crossvered_summary_report(osv.osv_memory):
|
|||
datas = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': context.get('active_ids',[]),
|
||||
'model': 'crossovered.budge',
|
||||
|
|
|
@ -40,7 +40,7 @@ class account_budget_report(osv.osv_memory):
|
|||
datas = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': context.get('active_ids',[]),
|
||||
'model': 'account.budget.post',
|
||||
|
|
|
@ -43,7 +43,8 @@ class account_coda(osv.osv):
|
|||
}
|
||||
|
||||
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(account_coda, self).search(cr, user, args=args, offset=offset, limit=limit, order=order,
|
||||
context=context, count=count)
|
||||
if context.get('bank_statement', False) and not res:
|
||||
|
|
|
@ -72,7 +72,7 @@ class account_coda_import(osv.osv_memory):
|
|||
data = self.read(cr, uid, ids)[0]
|
||||
|
||||
codafile = data['coda']
|
||||
journal_code = journal_obj.browse(cr, uid, data['journal_id'], context).code
|
||||
journal_code = journal_obj.browse(cr, uid, data['journal_id'], context=context).code
|
||||
|
||||
period = account_period_obj.find(cr, uid, context=context)[0]
|
||||
def_pay_acc = data['def_payable']
|
||||
|
|
|
@ -39,7 +39,7 @@ class account_followup_print(osv.osv_memory):
|
|||
context = {}
|
||||
if context.get('active_model', 'ir.ui.menu') == 'account_followup.followup':
|
||||
return context.get('active_id', False)
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
|
||||
followp_id = self.pool.get('account_followup.followup').search(cr, uid, [('company_id', '=', company_id)], context=context)
|
||||
return followp_id and followp_id[0] or False
|
||||
|
||||
|
@ -48,7 +48,7 @@ class account_followup_print(osv.osv_memory):
|
|||
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
context.update({'followup_id': data['followup_id'], 'date':data['date']})
|
||||
|
@ -146,7 +146,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
if ids:
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
cr.execute(
|
||||
"SELECT l.partner_id, l.followup_line_id,l.date_maturity, l.date, l.id "\
|
||||
"FROM account_move_line AS l "\
|
||||
|
@ -208,7 +208,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all_msg')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
if data['email_conf']:
|
||||
|
@ -306,7 +306,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
def do_print(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
res = self._get_partners_followp(cr, uid, ids, context)['to_update']
|
||||
to_update = res
|
||||
data['followup_id'] = 'followup_id' in context and context['followup_id'] or False
|
||||
|
|
|
@ -127,13 +127,11 @@ class account_invoice_line(osv.osv):
|
|||
def copy_data(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
if context is None: context = {}
|
||||
default['state'] = self.browse(cr, uid, id, context=context).state
|
||||
return super(account_invoice_line, self).copy_data(cr, uid, id, default, context)
|
||||
|
||||
def _fnct(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None: context = {}
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
account_ids = [line.account_id.id for line in lines]
|
||||
account_names = dict(self.pool.get('account.account').name_get(cr, uid, account_ids, context=context))
|
||||
|
|
|
@ -34,7 +34,7 @@ class account_invoice_special_msg(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
datas = {
|
||||
'ids': context.get('active_ids',[]),
|
||||
'model': 'account.invoice',
|
||||
|
|
|
@ -31,7 +31,6 @@ class Invoice(osv.osv):
|
|||
if not ids:
|
||||
return {}
|
||||
res = {}
|
||||
if context is None: context = {}
|
||||
for invoice in self.browse(cursor, user, ids, context=context):
|
||||
res[invoice.id] = 0.0
|
||||
if invoice.move_id:
|
||||
|
|
|
@ -50,7 +50,6 @@ class account_move_line(osv.osv):
|
|||
def _to_pay_search(self, cr, uid, obj, name, args, context=None):
|
||||
if not args:
|
||||
return []
|
||||
if context is None: context = {}
|
||||
line_obj = self.pool.get('account.move.line')
|
||||
query = line_obj._query_get(cr, uid, context={})
|
||||
where = ' and '.join(map(lambda x: '''(SELECT
|
||||
|
@ -89,7 +88,6 @@ class account_move_line(osv.osv):
|
|||
"""
|
||||
payment_mode_obj = self.pool.get('payment.mode')
|
||||
line2bank = {}
|
||||
if context is None: context = {}
|
||||
if not ids:
|
||||
return {}
|
||||
bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
|
||||
|
|
|
@ -67,7 +67,6 @@ class payment_order(osv.osv):
|
|||
if not ids:
|
||||
return {}
|
||||
res = {}
|
||||
if context is None: context = {}
|
||||
for order in self.browse(cursor, user, ids, context=context):
|
||||
if order.line_ids:
|
||||
res[order.id] = reduce(lambda x, y: x + y.amount, order.line_ids, 0.0)
|
||||
|
@ -128,7 +127,6 @@ class payment_order(osv.osv):
|
|||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context=None):
|
||||
if context is None: context = {}
|
||||
default.update({
|
||||
'state': 'draft',
|
||||
'line_ids': [],
|
||||
|
@ -272,7 +270,6 @@ class payment_line(osv.osv):
|
|||
def _get_currency(self, cr, uid, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
currency_obj = self.pool.get('res.currency')
|
||||
if context is None: context = {}
|
||||
user = user_obj.browse(cr, uid, uid, context=context)
|
||||
|
||||
if user.company_id:
|
||||
|
@ -367,7 +364,7 @@ class payment_line(osv.osv):
|
|||
data['amount_currency'] = data['communication'] = data['partner_id'] = data['reference'] = data['date_created'] = data['bank_id'] = data['amount'] = False
|
||||
|
||||
if move_line_id:
|
||||
line = move_line_obj.browse(cr, uid, move_line_id)
|
||||
line = move_line_obj.browse(cr, uid, move_line_id, context=context)
|
||||
data['amount_currency'] = line.amount_to_pay
|
||||
|
||||
res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency,
|
||||
|
@ -410,7 +407,6 @@ class payment_line(osv.osv):
|
|||
|
||||
def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
|
||||
data = {}
|
||||
if context is None: context = {}
|
||||
partner_zip_obj = self.pool.get('res.partner.zip')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
payment_mode_obj = self.pool.get('payment.mode')
|
||||
|
|
|
@ -62,7 +62,7 @@ class payment_order_create(osv.osv_memory):
|
|||
payment_obj = self.pool.get('payment.line')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
line_ids = data['entries']
|
||||
if not line_ids:
|
||||
return {}
|
||||
|
|
|
@ -31,6 +31,8 @@ class account_payment_make_payment(osv.osv_memory):
|
|||
If type is manual. just confirm the order.
|
||||
"""
|
||||
obj_payment_order = self.pool.get('payment.order')
|
||||
if context is None:
|
||||
context = {}
|
||||
# obj_model = self.pool.get('ir.model.data')
|
||||
# obj_act = self.pool.get('ir.actions.act_window')
|
||||
# order = obj_payment_order.browse(cr, uid, context['active_id'], context)
|
||||
|
|
|
@ -60,7 +60,7 @@ class account_payment_populate_statement(osv.osv_memory):
|
|||
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
line_ids = data['lines']
|
||||
if not line_ids:
|
||||
return {}
|
||||
|
|
|
@ -30,11 +30,10 @@ class account_move(osv.osv):
|
|||
}
|
||||
|
||||
def post(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
obj_sequence = self.pool.get('ir.sequence')
|
||||
res = super(account_move, self).post(cr, uid, ids, context=context)
|
||||
seq_no = False
|
||||
for move in self.browse(cr, uid, ids, context):
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
if move.journal_id.internal_sequence_id:
|
||||
seq_no = obj_sequence.get_id(cr, uid, move.journal_id.internal_sequence_id.id, context=context)
|
||||
if seq_no:
|
||||
|
|
|
@ -47,7 +47,7 @@ class account_sequence_installer(osv.osv_memory):
|
|||
context = {}
|
||||
jou_obj = self.pool.get('account.journal')
|
||||
obj_sequence = self.pool.get('ir.sequence')
|
||||
record = self.browse(cr, uid, ids, context)[0]
|
||||
record = self.browse(cr, uid, ids, context=context)[0]
|
||||
j_ids = []
|
||||
if record.company_id:
|
||||
company_id = record.company_id.id,
|
||||
|
@ -70,7 +70,7 @@ class account_sequence_installer(osv.osv_memory):
|
|||
ir_seq = obj_sequence.create(cr, uid, vals, context)
|
||||
res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context)
|
||||
journal_ids = jou_obj.search(cr, uid, search_criteria, context=context)
|
||||
for journal in jou_obj.browse(cr, uid, journal_ids, context):
|
||||
for journal in jou_obj.browse(cr, uid, journal_ids, context=context):
|
||||
if not journal.internal_sequence_id:
|
||||
j_ids.append(journal.id)
|
||||
if j_ids:
|
||||
|
|
|
@ -32,7 +32,6 @@ class account_move_line(osv.osv):
|
|||
|
||||
def _unreconciled(self, cr, uid, ids, prop, unknow_none, context=None):
|
||||
res = {}
|
||||
if context is None: context = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
res[line.id] = line.debit - line.credit
|
||||
if line.reconcile_partial_id:
|
||||
|
@ -299,7 +298,6 @@ class account_voucher(osv.osv):
|
|||
}
|
||||
voucher_total = 0.0
|
||||
voucher_line_ids = []
|
||||
if context is None: context = {}
|
||||
|
||||
total = 0.0
|
||||
total_tax = 0.0
|
||||
|
@ -358,7 +356,6 @@ class account_voucher(osv.osv):
|
|||
default = {
|
||||
'value':{},
|
||||
}
|
||||
if context is None: context = {}
|
||||
|
||||
if not partner_id or not journal_id:
|
||||
return default
|
||||
|
@ -530,7 +527,6 @@ class account_voucher(osv.osv):
|
|||
def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
|
||||
if not journal_id:
|
||||
return False
|
||||
if context is None: context = {}
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
journal = journal_pool.browse(cr, uid, journal_id, context=context)
|
||||
account_id = journal.default_credit_account_id or journal.default_debit_account_id
|
||||
|
@ -560,7 +556,6 @@ class account_voucher(osv.osv):
|
|||
def cancel_voucher(self, cr, uid, ids, context=None):
|
||||
reconcile_pool = self.pool.get('account.move.reconcile')
|
||||
move_pool = self.pool.get('account.move')
|
||||
if context is None: context = {}
|
||||
|
||||
for voucher in self.browse(cr, uid, ids, context=context):
|
||||
recs = []
|
||||
|
@ -803,7 +798,6 @@ class account_voucher_line(osv.osv):
|
|||
def _compute_balance(self, cr, uid, ids, name, args, context=None):
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
rs_data = {}
|
||||
if context is None: context = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
res = {}
|
||||
company_currency = line.voucher_id.journal_id.company_id.currency_id.id
|
||||
|
@ -855,7 +849,6 @@ class account_voucher_line(osv.osv):
|
|||
@return: Returns a dict which contains new values, and context
|
||||
"""
|
||||
res = {}
|
||||
if context is None: context = {}
|
||||
move_line_pool = self.pool.get('account.move.line')
|
||||
if move_line_id:
|
||||
move_line = move_line_pool.browse(cr, user, move_line_id, context=context)
|
||||
|
@ -880,7 +873,8 @@ class account_voucher_line(osv.osv):
|
|||
|
||||
@return: Returns a dict that contains default values for fields
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
journal_id = context.get('journal_id', False)
|
||||
partner_id = context.get('partner_id', False)
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
@ -917,7 +911,6 @@ class account_bank_statement(osv.osv):
|
|||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
voucher_obj = self.pool.get('account.voucher')
|
||||
if context is None: context = {}
|
||||
for st in self.browse(cr, uid, ids, context=context):
|
||||
voucher_ids = []
|
||||
for line in st.line_ids:
|
||||
|
@ -931,7 +924,6 @@ class account_bank_statement(osv.osv):
|
|||
wf_service = netsvc.LocalService("workflow")
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
bank_st_line_obj = self.pool.get('account.bank.statement.line')
|
||||
if context is None: context = {}
|
||||
st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
|
||||
if st_line.voucher_id:
|
||||
voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
|
||||
|
@ -957,7 +949,6 @@ class account_bank_statement_line(osv.osv):
|
|||
return {}
|
||||
|
||||
res = {}
|
||||
if context is None: context = {}
|
||||
# company_currency_id = False
|
||||
for line in self.browse(cursor, user, ids, context=context):
|
||||
# if not company_currency_id:
|
||||
|
@ -979,7 +970,6 @@ class account_bank_statement_line(osv.osv):
|
|||
}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
voucher_obj = self.pool.get('account.voucher')
|
||||
statement_line = self.browse(cr, uid, ids, context=context)
|
||||
unlink_ids = []
|
||||
|
|
|
@ -27,7 +27,6 @@ class invoice(osv.osv):
|
|||
|
||||
def invoice_pay_customer(self, cr, uid, ids, context=None):
|
||||
if not ids: return []
|
||||
if context is None: context = {}
|
||||
inv = self.browse(cr, uid, ids[0], context=context)
|
||||
return {
|
||||
'name':_("Pay Invoice"),
|
||||
|
|
|
@ -35,7 +35,8 @@ class account_statement_from_invoice_lines(osv.osv_memory):
|
|||
}
|
||||
|
||||
def populate_statement(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
statement_id = context.get('statement_id', False)
|
||||
if not statement_id:
|
||||
return {}
|
||||
|
@ -134,7 +135,8 @@ class account_statement_from_invoice(osv.osv_memory):
|
|||
}
|
||||
|
||||
def search_invoices(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
line_obj = self.pool.get('account.move.line')
|
||||
statement_obj = self.pool.get('account.bank.statement')
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
|
|
|
@ -59,7 +59,7 @@ class auction_dates(osv.osv):
|
|||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name', 'auction1'], context)
|
||||
reads = self.read(cr, uid, ids, ['name', 'auction1'], context=context)
|
||||
name = [(r['id'], '['+r['auction1']+'] '+ r['name']) for r in reads]
|
||||
return name
|
||||
|
||||
|
@ -193,7 +193,7 @@ class aie_category(osv.osv):
|
|||
res = []
|
||||
if not ids:
|
||||
return res
|
||||
reads = self.read(cr, uid, ids, ['name', 'parent_id'], context)
|
||||
reads = self.read(cr, uid, ids, ['name', 'parent_id'], context=context)
|
||||
for record in reads:
|
||||
name = record['name']
|
||||
if record['parent_id']:
|
||||
|
|
|
@ -60,7 +60,8 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(auction_lots_send_aie, self).default_get(cr, uid, fields, context=context)
|
||||
if 'uname' in fields and context.get('uname',False):
|
||||
res['uname'] = context.get('uname')
|
||||
|
@ -149,7 +150,8 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
self._photo_bin_send(uname, passwd, ref, did, fname, bin)
|
||||
|
||||
def get_dates(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
import httplib
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
conn = httplib.HTTPConnection('www.auction-in-europe.com')
|
||||
|
@ -181,7 +183,8 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
cr.execute('select name,aie_categ from auction_lot_category')
|
||||
vals = dict(cr.fetchall())
|
||||
cr.close()
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids',[]), ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
|
||||
|
|
|
@ -55,7 +55,8 @@ class auction_lots_pay(osv.osv_memory):
|
|||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(auction_lots_pay, self).default_get(cr, uid, fields, context=context)
|
||||
if 'uname' in fields and context.get('uname',False):
|
||||
res['uname'] = context.get('uname')
|
||||
|
@ -98,7 +99,8 @@ class auction_lots_pay(osv.osv_memory):
|
|||
return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),))
|
||||
|
||||
def get_dates(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
import httplib
|
||||
conn = httplib.HTTPConnection('www.auction-in-europe.com')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
@ -127,7 +129,8 @@ class auction_lots_pay(osv.osv_memory):
|
|||
}
|
||||
|
||||
def send(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
import pickle
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
datas = self.read(cr, uid, ids[0],['uname','password','dates'])
|
||||
|
|
|
@ -53,7 +53,8 @@ class auction_catalog_flagey(osv.osv_memory):
|
|||
"""
|
||||
lots_obj = self.pool.get('auction.lots')
|
||||
auc_dates_obj = self.pool.get('auction.dates')
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
current_auction = auc_dates_obj.browse(cr, uid, context.get('active_ids', []))
|
||||
v_lots = lots_obj.search(cr, uid, [('auction_id','=',current_auction.id)])
|
||||
v_ids = lots_obj.browse(cr, uid, v_lots, context=context)
|
||||
|
@ -72,7 +73,8 @@ class auction_catalog_flagey(osv.osv_memory):
|
|||
@param context: A standard dictionary
|
||||
@return: Report
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
datas = {'ids': context.get('active_ids',[])}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
|
|
|
@ -38,7 +38,8 @@ class auction_lots_able(osv.osv_memory):
|
|||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of auction lots able’s IDs.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'ach_emp':True})
|
||||
return {}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
|
|||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(wiz_auc_lots_buyer_map,self).default_get(cr, uid, fields, context=context)
|
||||
auction_lots_obj = self.pool.get('auction.lots')
|
||||
lots_ids = auction_lots_obj.search(cr, uid, [('ach_uid', '=', ''), ('ach_login', '!=', '')])
|
||||
|
|
|
@ -35,7 +35,8 @@ class auction_lots_enable(osv.osv_memory):
|
|||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of auction lots enable’s IDs.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
self.pool.get('auction.lots').write(cr, uid, context.get('active_id',False), {'ach_emp':False})
|
||||
return {}
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context)
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids', []))
|
||||
|
@ -102,7 +103,8 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
@param ids: List of Auction lots make invoice buyer’s IDs
|
||||
@return: dictionary of account invoice form.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
datas = {'ids' : context.get('active_ids',[])}
|
||||
res = self.read(cr, uid, ids, ['number','ach_uid'])
|
||||
|
|
|
@ -91,7 +91,6 @@ class auction_lots_numerotate_per_lot(osv.osv_memory):
|
|||
}
|
||||
|
||||
def numerotate(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
record_ids = context and context.get('active_ids',False) or False
|
||||
assert record_ids, _('Active IDs not Found')
|
||||
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num','obj_num'])
|
||||
|
@ -134,7 +133,6 @@ class auction_lots_numerotate_per_lot(osv.osv_memory):
|
|||
return lots_datas[0]
|
||||
|
||||
def test_exist(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
record_ids = context and context.get('active_ids',False) or False
|
||||
assert record_ids, _('Active IDs not Found')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
|
|
@ -48,7 +48,7 @@ class auction_lots_sms_send(osv.osv_memory):
|
|||
lot_obj = self.pool.get('auction.lots')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
partner_address_obj = self.pool.get('res.partner.address')
|
||||
for data in self.read(cr, uid, ids):
|
||||
for data in self.read(cr, uid, ids, context=context):
|
||||
lots = lot_obj.read(cr, uid, context.get('active_ids', []), ['obj_num','obj_price','ach_uid'])
|
||||
res = partner_obj.read(cr, uid, [l['ach_uid'][0] for l in lots if l['ach_uid']], ['gsm'], context)
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ class auction_pay_sel(osv.osv_memory):
|
|||
@param context: A standard dictionary
|
||||
@return:
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context=context)
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
for datas in self.read(cr, uid, ids, context=context):
|
||||
|
|
|
@ -26,7 +26,8 @@ class auction_payer(osv.osv_memory):
|
|||
_description = "Auction payer"
|
||||
|
||||
def payer(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'is_ok':True, 'state':'paid'})
|
||||
return {}
|
||||
|
||||
|
@ -46,7 +47,8 @@ class auction_payer_sel(osv.osv_memory):
|
|||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of auction payer sel’s IDs.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'paid_vnd':True})
|
||||
return {}
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ class audittrail_view_log(osv.osv_memory):
|
|||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
result = mod_obj._get_id(cr, uid, 'audittrail', 'action_audittrail_log_tree')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id])[0]
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
|
||||
#start Loop
|
||||
for datas in self.read(cr, uid, ids, context=context):
|
||||
|
|
|
@ -82,7 +82,8 @@ class base_calendar_set_exrule(osv.osv_memory):
|
|||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
event_obj = self.pool.get(context.get('active_model'))
|
||||
for event in event_obj.browse(cr, uid, context.get('active_ids', []), context=context):
|
||||
if not event.rrule:
|
||||
|
@ -103,7 +104,8 @@ class base_calendar_set_exrule(osv.osv_memory):
|
|||
weekstring = ''
|
||||
monthstring = ''
|
||||
yearstring = ''
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
ex_id = base_calendar.base_calendar_id2real_id(context.get('active_id', False))
|
||||
model = context.get('model', False)
|
||||
model_obj = self.pool.get(model)
|
||||
|
|
|
@ -131,7 +131,8 @@ class res_partner_address(osv.osv):
|
|||
if not len(ids):
|
||||
return []
|
||||
res = []
|
||||
if context is None: context = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for r in self.read(cr, user, ids, ['zip', 'city', 'partner_id', 'street']):
|
||||
if context.get('contact_display', 'contact')=='partner' and r['partner_id']:
|
||||
res.append((r['id'], r['partner_id'][1]))
|
||||
|
@ -169,7 +170,7 @@ class res_partner_job(osv.osv):
|
|||
return []
|
||||
res = []
|
||||
|
||||
jobs = self.browse(cr, uid, ids)
|
||||
jobs = self.browse(cr, uid, ids, context=context)
|
||||
|
||||
contact_ids = [rec.contact_id.id for rec in jobs]
|
||||
contact_names = dict(self.pool.get('res.partner.contact').name_get(cr, uid, contact_ids, context=context))
|
||||
|
|
|
@ -52,7 +52,7 @@ class report_menu_create(osv.osv_memory):
|
|||
return {}
|
||||
data = data[0]
|
||||
|
||||
board = obj_board.browse(cr, uid, context_id)
|
||||
board = obj_board.browse(cr, uid, context_id, context=context)
|
||||
view = board.view_type1
|
||||
if board.view_type2:
|
||||
view += ',' + board.view_type2
|
||||
|
|
|
@ -39,7 +39,7 @@ class base_report_sxw(osv.osv_memory):
|
|||
|
||||
|
||||
def get_report(self, cr, uid, ids, context=None):
|
||||
data = self.read(cr,uid,ids)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
id2 = data_obj._get_id(cr, uid, 'base_report_designer', 'view_base_report_file_sxw')
|
||||
report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
|
||||
|
@ -76,7 +76,7 @@ class base_report_file_sxw(osv.osv_memory):
|
|||
"""
|
||||
res = super(base_report_file_sxw, self).default_get(cr, uid, fields, context=context)
|
||||
report_id1 = self.pool.get('base.report.sxw').search(cr,uid,[])
|
||||
data=self.pool.get('base.report.sxw').read(cr,uid,report_id1)[0]
|
||||
data = self.pool.get('base.report.sxw').read(cr, uid, report_id1, context=context)[0]
|
||||
report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
|
||||
if context is None:
|
||||
context={}
|
||||
|
@ -137,7 +137,7 @@ class base_report_rml_save(osv.osv_memory):
|
|||
|
||||
res = super(base_report_rml_save, self).default_get(cr, uid, fields, context=context)
|
||||
report_id = self.pool.get('base.report.sxw').search(cr,uid,[])
|
||||
data=self.pool.get('base.report.file.sxw').read(cr,uid,report_id)[0]
|
||||
data = self.pool.get('base.report.file.sxw').read(cr, uid, report_id, context=context)[0]
|
||||
report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
|
||||
|
||||
if 'file_rml' in fields:
|
||||
|
|
|
@ -656,7 +656,7 @@ class Calendar(CalDAV, osv.osv):
|
|||
ctx_model = context.get('model', None)
|
||||
ctx_res_id = context.get('res_id', None)
|
||||
ical = vobject.iCalendar()
|
||||
for cal in self.browse(cr, uid, ids):
|
||||
for cal in self.browse(cr, uid, ids, context=context):
|
||||
for line in cal.line_ids:
|
||||
if ctx_model and ctx_model != line.object_id.model:
|
||||
continue
|
||||
|
@ -1124,8 +1124,6 @@ class Alarm(CalDAV, osv.osv_memory):
|
|||
@param alarm_id: Get Alarm's Id
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
valarm = vevent.add('valarm')
|
||||
alarm_object = self.pool.get(model)
|
||||
alarm_data = alarm_object.read(cr, uid, alarm_id, [])
|
||||
|
@ -1159,7 +1157,8 @@ class Alarm(CalDAV, osv.osv_memory):
|
|||
@param ical_data: Get calendar's Data
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
ctx = context.copy()
|
||||
ctx.update({'model': context.get('model', None)})
|
||||
self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, ctx)
|
||||
|
@ -1221,7 +1220,8 @@ class Attendee(CalDAV, osv.osv_memory):
|
|||
@param ical_data: Get calendar's Data
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
ctx = context.copy()
|
||||
ctx.update({'model': context.get('model', None)})
|
||||
self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, ctx)
|
||||
|
|
|
@ -48,7 +48,7 @@ class calendar_event_import(osv.osv_memory):
|
|||
context = context.copy()
|
||||
context['uid'] = uid
|
||||
|
||||
for data in self.read(cr, uid, ids):
|
||||
for data in self.read(cr, uid, ids, context=context):
|
||||
model = data.get('model', 'basic.calendar')
|
||||
model_obj = self.pool.get(model)
|
||||
context.update({'model': model})
|
||||
|
|
|
@ -50,7 +50,7 @@ class calendar_event_subscribe(osv.osv_memory):
|
|||
context = context.copy()
|
||||
context['uid'] = uid
|
||||
|
||||
for data in self.read(cr, uid, ids):
|
||||
for data in self.read(cr, uid, ids, context=context):
|
||||
try:
|
||||
f = urllib.urlopen(data['url_path'])
|
||||
caldata = f.fp.read()
|
||||
|
|
|
@ -281,9 +281,9 @@ class crm_lead(crm_case, osv.osv):
|
|||
}
|
||||
return value
|
||||
|
||||
def write(self, cr, uid, ids, vals, context={}):
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if 'date_closed' in vals:
|
||||
return super(crm_lead,self).write(cr, uid, ids, vals, context)
|
||||
return super(crm_lead,self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
if 'stage_id' in vals and vals['stage_id']:
|
||||
stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, vals['stage_id'], context=context)
|
||||
|
@ -297,7 +297,7 @@ class crm_lead(crm_case, osv.osv):
|
|||
return super(crm_lead,self).write(cr, uid, ids, vals, context)
|
||||
|
||||
def stage_next(self, cr, uid, ids, context=None):
|
||||
stage = super(crm_lead, self).stage_next(cr, uid, ids, context)
|
||||
stage = super(crm_lead, self).stage_next(cr, uid, ids, context=context)
|
||||
if stage:
|
||||
stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage, context=context)
|
||||
if stage_obj.on_change:
|
||||
|
|
|
@ -176,8 +176,6 @@ class res_users(osv.osv):
|
|||
_inherit = 'res.users'
|
||||
|
||||
def create(self, cr, uid, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
user_id = super(res_users, self).create(cr, uid, data, context=context)
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
try:
|
||||
|
|
|
@ -32,8 +32,6 @@ import pooler
|
|||
class phonecall2meeting(wizard.interface):
|
||||
|
||||
def _makeMeeting(self, cr, uid, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
phonecall_case_obj = pool.get('crm.phonecall')
|
||||
data_obj = pool.get('ir.model.data')
|
||||
|
|
|
@ -110,8 +110,6 @@ class document_directory_content(osv.osv):
|
|||
return True
|
||||
|
||||
def process_read(self, cr, uid, node, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if node.extension != '.pdf':
|
||||
raise Exception("Invalid content: %s" % node.extension)
|
||||
report = self.pool.get('ir.actions.report.xml').browse(cr, uid, node.report_id, context=context)
|
||||
|
|
|
@ -196,7 +196,7 @@ class document_directory(osv.osv):
|
|||
else:
|
||||
raise ValueError("dir node for %s type", dbro.type)
|
||||
|
||||
def _prepare_context(self, cr, uid, nctx, context):
|
||||
def _prepare_context(self, cr, uid, nctx, context=None):
|
||||
""" Fill nctx with properties for this database
|
||||
@param nctx instance of nodes.node_context, to be filled
|
||||
@param context ORM context (dict) for us
|
||||
|
@ -210,7 +210,7 @@ class document_directory(osv.osv):
|
|||
"""
|
||||
return
|
||||
|
||||
def get_dir_permissions(self, cr, uid, ids, context=None ):
|
||||
def get_dir_permissions(self, cr, uid, ids, context=None):
|
||||
"""Check what permission user 'uid' has on directory 'id'
|
||||
"""
|
||||
assert len(ids) == 1
|
||||
|
|
|
@ -347,7 +347,6 @@ class crm_meeting(osv.osv):
|
|||
"""
|
||||
|
||||
if not default: default = {}
|
||||
if context is None: context = {}
|
||||
default.update({'code': self.pool.get('ir.sequence').get(cr, uid, 'crm.meeting'), 'id': False})
|
||||
return super(crm_meeting, self).copy(cr, uid, id, default, context)
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class document_ics_crm_wizard(osv.osv_memory):
|
|||
@param ids: List of Document CRM wizard’s IDs
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
data=self.read(cr, uid, ids, [])[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
dir_obj = self.pool.get('document.directory')
|
||||
dir_cont_obj = self.pool.get('document.directory.content')
|
||||
dir_id = dir_obj.search(cr, uid, [('name', '=', 'Calendars')])
|
||||
|
|
|
@ -40,7 +40,7 @@ class email_template_mailbox(osv.osv):
|
|||
to periodically send emails
|
||||
"""
|
||||
try:
|
||||
self.send_all_mail(cursor, user, context)
|
||||
self.send_all_mail(cursor, user, context=context)
|
||||
except Exception, e:
|
||||
LOGGER.notifyChannel(
|
||||
"Email Template",
|
||||
|
|
|
@ -104,8 +104,6 @@ class event_event(osv.osv):
|
|||
res = False
|
||||
if type(ids) in (int, long,):
|
||||
ids = [ids]
|
||||
if context is None:
|
||||
context = {}
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
unconfirmed_ids = []
|
||||
for event in self.browse(cr, uid, ids, context=context):
|
||||
|
@ -267,8 +265,6 @@ class event_event(osv.osv):
|
|||
"""
|
||||
if not team_id:
|
||||
return {}
|
||||
if context is None:
|
||||
context = {}
|
||||
team_pool = self.pool.get('crm.case.section')
|
||||
res = {}
|
||||
team = team_pool.browse(cr, uid, team_id, context=context)
|
||||
|
@ -287,7 +283,6 @@ class event_registration(osv.osv):
|
|||
def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
res = {}
|
||||
context = context or {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
price = line.unit_price * line.nb_register
|
||||
pricelist = line.event_id.pricelist_id or line.partner_invoice_id.property_product_pricelist
|
||||
|
@ -490,8 +485,6 @@ class event_registration(osv.osv):
|
|||
"""
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
unclosed_ids = []
|
||||
if context is None:
|
||||
context = {}
|
||||
for registration in self.browse(cr, uid, ids, context=context):
|
||||
if registration.tobe_invoiced and not registration.invoice_id:
|
||||
unclosed_ids.append(registration.id)
|
||||
|
|
|
@ -38,8 +38,6 @@ class hr_department(osv.osv):
|
|||
return res
|
||||
|
||||
def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = self.name_get(cr, uid, ids, context=context)
|
||||
return dict(res)
|
||||
|
||||
|
@ -58,8 +56,6 @@ class hr_department(osv.osv):
|
|||
}
|
||||
|
||||
def _get_members(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
mids = self.search(cr, uid, [('manager_id', '=', uid)], context=context)
|
||||
result = {uid: 1}
|
||||
for m in self.browse(cr, uid, mids, context=context):
|
||||
|
|
|
@ -38,8 +38,6 @@ class hr_action_reason(osv.osv):
|
|||
hr_action_reason()
|
||||
|
||||
def _employee_get(obj, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
return ids and ids[0] or False
|
||||
|
||||
|
@ -48,8 +46,6 @@ class hr_attendance(osv.osv):
|
|||
_description = "Attendance"
|
||||
|
||||
def _day_compute(self, cr, uid, ids, fieldnames, args, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = dict.fromkeys(ids, '')
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
res[obj.id] = time.strftime('%Y-%m-%d', time.strptime(obj.name, '%Y-%m-%d %H:%M:%S'))
|
||||
|
@ -93,8 +89,6 @@ class hr_employee(osv.osv):
|
|||
_description = "Employee"
|
||||
|
||||
def _state(self, cr, uid, ids, name, args, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = {}
|
||||
if not ids:
|
||||
return result
|
||||
|
@ -120,16 +114,12 @@ class hr_employee(osv.osv):
|
|||
}
|
||||
|
||||
def _action_check(self, cr, uid, emp_id, dt=False, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
cr.execute('SELECT MAX(name) FROM hr_attendance WHERE employee_id=%s', (emp_id,))
|
||||
res = cr.fetchone()
|
||||
return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S'))))
|
||||
|
||||
def attendance_action_change(self, cr, uid, ids, type='action', context=None, dt=False, *args):
|
||||
obj_attendance = self.pool.get('hr.attendance')
|
||||
if context is None:
|
||||
context = {}
|
||||
id = False
|
||||
warning_sign = 'sign'
|
||||
res = {}
|
||||
|
|
|
@ -36,8 +36,6 @@ class hr_attendance_bymonth(osv.osv_memory):
|
|||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
|
|
|
@ -35,8 +35,6 @@ class hr_attendance_byweek(osv.osv_memory):
|
|||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
|
|
|
@ -39,8 +39,6 @@ class hr_attendance_error(osv.osv_memory):
|
|||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_ids = []
|
||||
data_error = self.read(cr, uid, ids, context=context)[0]
|
||||
date_from = data_error['init_date']
|
||||
|
|
|
@ -33,8 +33,6 @@ class hr_si_so_ask(osv.osv_memory):
|
|||
}
|
||||
|
||||
def _get_empname(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
if emp_id:
|
||||
employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0].name
|
||||
|
@ -53,14 +51,10 @@ class hr_si_so_ask(osv.osv_memory):
|
|||
}
|
||||
|
||||
def sign_in(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
return self.pool.get('hr.sign.in.out').sign_in(cr, uid, data, context)
|
||||
|
||||
def sign_out(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
return self.pool.get('hr.sign.in.out').sign_out(cr, uid, data, context)
|
||||
|
||||
|
@ -78,8 +72,6 @@ class hr_sign_in_out(osv.osv_memory):
|
|||
}
|
||||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_id = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
if emp_id:
|
||||
employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0]
|
||||
|
@ -87,8 +79,6 @@ class hr_sign_in_out(osv.osv_memory):
|
|||
return {}
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(hr_sign_in_out, self).default_get(cr, uid, fields_list, context=context)
|
||||
res_emp = self._get_empid(cr, uid, context=context)
|
||||
res.update(res_emp)
|
||||
|
@ -97,8 +87,6 @@ class hr_sign_in_out(osv.osv_memory):
|
|||
def si_check(self, cr, uid, ids, context=None):
|
||||
obj_model = self.pool.get('ir.model.data')
|
||||
att_obj = self.pool.get('hr.attendance')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
emp_id = data['emp_id']
|
||||
att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id)], limit=1, order='name desc')
|
||||
|
@ -124,8 +112,6 @@ class hr_sign_in_out(osv.osv_memory):
|
|||
def so_check(self, cr, uid, ids, context=None):
|
||||
obj_model = self.pool.get('ir.model.data')
|
||||
att_obj = self.pool.get('hr.attendance')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
emp_id = data['emp_id']
|
||||
att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action', '!=', 'action')], limit=1, order='name desc')
|
||||
|
@ -177,8 +163,6 @@ class hr_sign_in_out(osv.osv_memory):
|
|||
return {} # To do: Return Success message
|
||||
|
||||
def sign_out(self, cr, uid, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_id = data['emp_id']
|
||||
if 'last_time' in data:
|
||||
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
|
||||
|
|
|
@ -106,8 +106,6 @@ class hr_employee(osv.osv):
|
|||
|
||||
def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
|
||||
obj_evaluation = self.pool.get('hr_evaluation.evaluation')
|
||||
if context is None:
|
||||
context = {}
|
||||
for id in self.browse(cr, uid, self.search(cr, uid, [], context=context), context=context):
|
||||
if id.evaluation_plan_id and id.evaluation_date:
|
||||
if (parser.parse(id.evaluation_date) + relativedelta(months = int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"):
|
||||
|
@ -116,8 +114,6 @@ class hr_employee(osv.osv):
|
|||
return True
|
||||
|
||||
def onchange_evaluation_plan_id(self, cr, uid, ids, evaluation_plan_id, evaluation_date, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if evaluation_plan_id:
|
||||
evaluation_plan_obj=self.pool.get('hr_evaluation.plan')
|
||||
obj_evaluation = self.pool.get('hr_evaluation.evaluation')
|
||||
|
@ -135,8 +131,6 @@ class hr_employee(osv.osv):
|
|||
return {'value': {'evaluation_date': evaluation_date}}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
id = super(hr_employee, self).create(cr, uid, vals, context=context)
|
||||
if vals.get('evaluation_plan_id', False):
|
||||
self.pool.get('hr_evaluation.evaluation').create(cr, uid, {'employee_id': id, 'plan_id': vals['evaluation_plan_id']}, context=context)
|
||||
|
@ -180,8 +174,6 @@ class hr_evaluation(osv.osv):
|
|||
}
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.browse(cr, uid, ids, context=context)
|
||||
|
@ -192,8 +184,6 @@ class hr_evaluation(osv.osv):
|
|||
return res
|
||||
|
||||
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
evaluation_plan_id=False
|
||||
if employee_id:
|
||||
employee_obj=self.pool.get('hr.employee')
|
||||
|
@ -246,8 +236,6 @@ class hr_evaluation(osv.osv):
|
|||
|
||||
def button_final_validation(self, cr, uid, ids, context=None):
|
||||
request_obj = self.pool.get('hr.evaluation.interview')
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'progress'}, context=context)
|
||||
for id in self.browse(cr, uid, ids, context=context):
|
||||
if len(id.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', id.id),('state', '=', 'done')], context=context)):
|
||||
|
@ -255,21 +243,15 @@ class hr_evaluation(osv.osv):
|
|||
return True
|
||||
|
||||
def button_done(self,cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids,{'progress': 1 * 100}, context=context)
|
||||
self.write(cr, uid, ids,{'state':'done', 'date_close': time.strftime('%Y-%m-%d')}, context=context)
|
||||
return True
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids,{'state':'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if 'date' in vals:
|
||||
new_vals = {'date_deadline': vals.get('date')}
|
||||
obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview')
|
||||
|
@ -306,8 +288,6 @@ class hr_evaluation_interview(osv.osv):
|
|||
}
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.browse(cr, uid, ids, context=context)
|
||||
|
@ -318,15 +298,11 @@ class hr_evaluation_interview(osv.osv):
|
|||
return res
|
||||
|
||||
def survey_req_waiting_answer(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, { 'state': 'waiting_answer'}, context=context)
|
||||
return True
|
||||
|
||||
def survey_req_done(self, cr, uid, ids, context=None):
|
||||
hr_eval_obj = self.pool.get('hr_evaluation.evaluation')
|
||||
if context is None:
|
||||
context = {}
|
||||
for id in self.browse(cr, uid, ids, context=context):
|
||||
flag = False
|
||||
wating_id = 0
|
||||
|
@ -349,14 +325,10 @@ class hr_evaluation_interview(osv.osv):
|
|||
return True
|
||||
|
||||
def survey_req_draft(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, { 'state': 'draft'}, context=context)
|
||||
return True
|
||||
|
||||
def survey_req_cancel(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, { 'state': 'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ class hr_evaluation_reminder(osv.osv_memory):
|
|||
|
||||
def send_mail(self, cr, uid, ids, context=None):
|
||||
hr_evaluation_interview_obj = self.pool.get('hr.evaluation.interview')
|
||||
if context is None:
|
||||
context = {}
|
||||
evaluation_data = self.read(cr, uid, ids, context=context)[0]
|
||||
current_interview = hr_evaluation_interview_obj.browse(cr, uid, evaluation_data.get('evaluation_id'))
|
||||
if current_interview.state == "waiting_answer" and current_interview.user_to_review_id.work_email :
|
||||
|
|
|
@ -43,15 +43,11 @@ class hr_expense_expense(osv.osv):
|
|||
return super(hr_expense_expense, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
def _amount(self, cr, uid, ids, field_name, arg, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
cr.execute("SELECT s.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_expense s LEFT OUTER JOIN hr_expense_line l ON (s.id=l.expense_id) WHERE s.id IN %s GROUP BY s.id ", (tuple(ids),))
|
||||
res = dict(cr.fetchall())
|
||||
return res
|
||||
|
||||
def _get_currency(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
user = self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0]
|
||||
if user.company_id:
|
||||
return user.company_id.currency_id.id
|
||||
|
@ -217,8 +213,6 @@ class hr_expense_line(osv.osv):
|
|||
_description = "Expense Line"
|
||||
|
||||
def _amount(self, cr, uid, ids, field_name, arg, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not ids:
|
||||
return {}
|
||||
cr.execute("SELECT l.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_line l WHERE id IN %s GROUP BY l.id ",(tuple(ids),))
|
||||
|
@ -246,8 +240,6 @@ class hr_expense_line(osv.osv):
|
|||
_order = "sequence, date_value desc"
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {}
|
||||
if product_id:
|
||||
product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||
|
|
|
@ -36,8 +36,6 @@ class hr_holidays_status(osv.osv):
|
|||
_description = "Leave Type"
|
||||
|
||||
def get_days_cat(self, cr, uid, ids, category_id, return_false, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
cr.execute("""SELECT id, type, number_of_days, holiday_status_id FROM hr_holidays WHERE category_id = %s AND state='validate' AND holiday_status_id in %s""",
|
||||
[category_id, tuple(ids)])
|
||||
|
@ -61,8 +59,6 @@ class hr_holidays_status(osv.osv):
|
|||
return res
|
||||
|
||||
def get_days(self, cr, uid, ids, employee_id, return_false, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
cr.execute("""SELECT id, type, number_of_days, holiday_status_id FROM hr_holidays WHERE employee_id = %s AND state='validate' AND holiday_status_id in %s""",
|
||||
[employee_id, tuple(ids)])
|
||||
|
@ -86,8 +82,6 @@ class hr_holidays_status(osv.osv):
|
|||
return res
|
||||
|
||||
def _user_left_days(self, cr, uid, ids, name, args, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
return_false = False
|
||||
employee_id = False
|
||||
res = {}
|
||||
|
@ -133,8 +127,6 @@ class hr_holidays(osv.osv):
|
|||
_order = "type desc, date_from asc"
|
||||
|
||||
def _employee_get(obj, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
if ids:
|
||||
return ids[0]
|
||||
|
@ -177,16 +169,12 @@ class hr_holidays(osv.osv):
|
|||
|
||||
def _create_resource_leave(self, cr, uid, vals, context=None):
|
||||
'''This method will create entry in resource calendar leave object at the time of holidays validated '''
|
||||
if context is None:
|
||||
context = {}
|
||||
obj_res_leave = self.pool.get('resource.calendar.leaves')
|
||||
return obj_res_leave.create(cr, uid, vals, context=context)
|
||||
|
||||
def _remove_resouce_leave(self, cr, uid, ids, context=None):
|
||||
'''This method will create entry in resource calendar leave object at the time of holidays cancel/removed'''
|
||||
obj_res_leave = self.pool.get('resource.calendar.leaves')
|
||||
if context is None:
|
||||
context = {}
|
||||
leave_ids = obj_res_leave.search(cr, uid, [('holiday_id', 'in', ids)], context=context)
|
||||
return obj_res_leave.unlink(cr, uid, leave_ids)
|
||||
|
||||
|
@ -205,8 +193,6 @@ class hr_holidays(osv.osv):
|
|||
return super(hr_holidays, self).create(cr, uid, vals, context=context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if 'holiday_type' in vals:
|
||||
if vals['holiday_type'] == 'employee':
|
||||
vals.update({'category_id': False})
|
||||
|
@ -260,8 +246,6 @@ class hr_holidays(osv.osv):
|
|||
_constraints = [(_check_date, 'Start date should not be larger than end date!\nNumber of Days should be greater than 1!', ['number_of_days_temp'])]
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self._update_user_holidays(cr, uid, ids)
|
||||
self._remove_resouce_leave(cr, uid, ids, context=context)
|
||||
return super(hr_holidays, self).unlink(cr, uid, ids, context)
|
||||
|
@ -283,8 +267,6 @@ class hr_holidays(osv.osv):
|
|||
return self.onchange_date_from(cr, uid, ids, date_to, date_from)
|
||||
|
||||
def onchange_sec_id(self, cr, uid, ids, status, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
warning = {}
|
||||
if status:
|
||||
brows_obj = self.pool.get('hr.holidays.status').browse(cr, uid, [status], context=context)[0]
|
||||
|
|
|
@ -39,8 +39,6 @@ class hr_holidays_summary_dept(osv.osv_memory):
|
|||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
if not data['depts']:
|
||||
raise osv.except_osv(_('Error'), _('You have to select at least 1 Department. And try again'))
|
||||
|
|
|
@ -37,8 +37,6 @@ class hr_holidays_summary_employee(osv.osv_memory):
|
|||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data['emp'] = context['active_ids']
|
||||
datas = {
|
||||
|
|
|
@ -114,8 +114,6 @@ class hr_payroll_structure(osv.osv):
|
|||
|
||||
@return: returns a id of newly created record
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
code = self.browse(cr, uid, id, context=context).code
|
||||
default = {
|
||||
'code':code+"(copy)",
|
||||
|
@ -424,20 +422,14 @@ class payroll_register(osv.osv):
|
|||
return True
|
||||
|
||||
def set_to_draft(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'draft'}, context=context)
|
||||
return True
|
||||
|
||||
def cancel_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
def verify_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
slip_pool = self.pool.get('hr.payslip')
|
||||
|
||||
for id in ids:
|
||||
|
@ -455,8 +447,6 @@ class payroll_register(osv.osv):
|
|||
advice_line_pool = self.pool.get('hr.payroll.advice.line')
|
||||
sequence_pool = self.pool.get('ir.sequence')
|
||||
users_pool = self.pool.get('res.users')
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
for id in ids:
|
||||
sids = slip_pool.search(cr, uid, [('register_id','=',id), ('state','=','hr_check')], context=context)
|
||||
|
@ -533,27 +523,19 @@ class payroll_advice(osv.osv):
|
|||
}
|
||||
|
||||
def confirm_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'confirm'}, context=context)
|
||||
return True
|
||||
|
||||
def set_to_draft(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'draft'}, context=context)
|
||||
return True
|
||||
|
||||
def cancel_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
def onchange_company_id(self, cr, uid, ids, company_id=False, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
if company_id:
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
|
||||
if company.partner_id.bank_ids:
|
||||
|
@ -585,8 +567,6 @@ class payroll_advice_line(osv.osv):
|
|||
def onchange_employee_id(self, cr, uid, ids, ddate, employee_id, context=None):
|
||||
vals = {}
|
||||
slip_pool = self.pool.get('hr.payslip')
|
||||
if context is None:
|
||||
context = {}
|
||||
if employee_id:
|
||||
dates = prev_bounds(ddate)
|
||||
sids = False
|
||||
|
@ -650,8 +630,6 @@ class contrib_register_line(osv.osv):
|
|||
_description = 'Contribution Register Line'
|
||||
|
||||
def _total(self, cr, uid, ids, field_names, arg, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res={}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
res[line.id] = line.emp_deduction + line.comp_deduction
|
||||
|
@ -763,8 +741,6 @@ class company_contribution(osv.osv):
|
|||
uid: user id of current executer
|
||||
"""
|
||||
line_pool = self.pool.get('company.contribution.line')
|
||||
if context is None:
|
||||
context = {}
|
||||
res = 0
|
||||
ids = line_pool.search(cr, uid, [('category_id','=',id), ('to_val','>=',value),('from_val','<=',value)], context=context)
|
||||
if not ids:
|
||||
|
@ -839,8 +815,6 @@ class hr_payslip(osv.osv):
|
|||
|
||||
def _calculate(self, cr, uid, ids, field_names, arg, context=None):
|
||||
slip_line_obj = self.pool.get('hr.payslip.line')
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {}
|
||||
for rs in self.browse(cr, uid, ids, context=context):
|
||||
allow = 0.0
|
||||
|
@ -935,8 +909,6 @@ class hr_payslip(osv.osv):
|
|||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
|
||||
default = {
|
||||
'line_ids': False,
|
||||
|
@ -963,32 +935,22 @@ class hr_payslip(osv.osv):
|
|||
slip_move.create(cr, uid, res)
|
||||
|
||||
def set_to_draft(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'draft'}, context=context)
|
||||
return True
|
||||
|
||||
def cancel_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
def account_check_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'accont_check'}, context=context)
|
||||
return True
|
||||
|
||||
def hr_check_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'hr_check'}, context=context)
|
||||
return True
|
||||
|
||||
def process_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'paid':True, 'state':'done'}, context=context)
|
||||
return True
|
||||
|
||||
|
@ -1023,8 +985,6 @@ class hr_payslip(osv.osv):
|
|||
return True
|
||||
|
||||
def get_contract(self, cr, uid, employee, date, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
sql_req= '''
|
||||
SELECT c.id as id, c.wage as wage, struct_id as function
|
||||
FROM hr_contract c
|
||||
|
@ -1055,8 +1015,6 @@ class hr_payslip(osv.osv):
|
|||
|
||||
@return: return a result
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
result = []
|
||||
|
||||
dates = prev_bounds(slip.date)
|
||||
|
@ -1381,8 +1339,6 @@ class hr_payslip_line(osv.osv):
|
|||
}
|
||||
|
||||
def execute_function(self, cr, uid, id, value, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
line_pool = self.pool.get('hr.payslip.line.line')
|
||||
res = 0
|
||||
ids = line_pool.search(cr, uid, [('slipline_id','=',id), ('from_val','<=',value), ('to_val','>=',value)], context=context)
|
||||
|
|
|
@ -156,19 +156,19 @@ class contrib_register(osv.osv):
|
|||
period_id = self.pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d')),('date_stop','>=',time.strftime('%Y-%m-%d'))])[0]
|
||||
fiscalyear_id = self.pool.get('account.period').browse(cr, uid, period_id, context=context).fiscalyear_id
|
||||
res = {}
|
||||
for cur in self.browse(cr, uid, ids):
|
||||
for cur in self.browse(cr, uid, ids, context=context):
|
||||
current = line_pool.search(cr, uid, [('period_id','=',period_id),('register_id','=',cur.id)])
|
||||
years = line_pool.search(cr, uid, [('period_id.fiscalyear_id','=',fiscalyear_id.id), ('register_id','=',cur.id)])
|
||||
|
||||
e_month = 0.0
|
||||
c_month = 0.0
|
||||
for i in line_pool.browse(cr, uid, current):
|
||||
for i in line_pool.browse(cr, uid, current, context=context):
|
||||
e_month += i.emp_deduction
|
||||
c_month += i.comp_deduction
|
||||
|
||||
e_year = 0.0
|
||||
c_year = 0.0
|
||||
for j in line_pool.browse(cr, uid, years):
|
||||
for j in line_pool.browse(cr, uid, years, context=context):
|
||||
e_year += i.emp_deduction
|
||||
c_year += i.comp_deduction
|
||||
|
||||
|
@ -235,8 +235,6 @@ class hr_payslip(osv.osv):
|
|||
def cancel_sheet(self, cr, uid, ids, context=None):
|
||||
move_pool = self.pool.get('account.move')
|
||||
slip_move = self.pool.get('hr.payslip.account.move')
|
||||
if context is None:
|
||||
context = {}
|
||||
move_ids = []
|
||||
for slip in self.browse(cr, uid, ids, context=context):
|
||||
for line in slip.move_ids:
|
||||
|
@ -256,8 +254,6 @@ class hr_payslip(osv.osv):
|
|||
invoice_pool = self.pool.get('account.invoice')
|
||||
fiscalyear_pool = self.pool.get('account.fiscalyear')
|
||||
period_pool = self.pool.get('account.period')
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
for slip in self.browse(cr, uid, ids, context=context):
|
||||
line_ids = []
|
||||
|
@ -398,14 +394,10 @@ class hr_payslip(osv.osv):
|
|||
return True
|
||||
|
||||
def account_check_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'accont_check'}, context=context)
|
||||
return True
|
||||
|
||||
def hr_check_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'hr_check'}, context=context)
|
||||
return True
|
||||
|
||||
|
@ -418,8 +410,6 @@ class hr_payslip(osv.osv):
|
|||
property_pool = self.pool.get('ir.property')
|
||||
payslip_pool = self.pool.get('hr.payslip.line')
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
for slip in self.browse(cr, uid, ids, context=context):
|
||||
total_deduct = 0.0
|
||||
|
||||
|
|
|
@ -82,8 +82,6 @@ class hr_applicant(crm.crm_case, osv.osv):
|
|||
_inherit = ['mailgate.thread']
|
||||
|
||||
def _compute_day(self, cr, uid, ids, fields, args, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
"""
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
|
@ -165,8 +163,6 @@ class hr_applicant(crm.crm_case, osv.osv):
|
|||
}
|
||||
|
||||
def _get_stage(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
ids = self.pool.get('hr.recruitment.stage').search(cr, uid, [], context=context)
|
||||
return ids and ids[0] or False
|
||||
|
||||
|
@ -181,8 +177,6 @@ class hr_applicant(crm.crm_case, osv.osv):
|
|||
}
|
||||
|
||||
def onchange_job(self,cr, uid, ids, job, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = {}
|
||||
|
||||
if job:
|
||||
|
@ -305,8 +299,6 @@ class hr_applicant(crm.crm_case, osv.osv):
|
|||
"""
|
||||
mailgate_pool = self.pool.get('email.server.tools')
|
||||
attach_obj = self.pool.get('ir.attachment')
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
subject = msg.get('subject')
|
||||
body = msg.get('body')
|
||||
|
@ -349,8 +341,6 @@ class hr_applicant(crm.crm_case, osv.osv):
|
|||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of update mail’s IDs
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if isinstance(ids, (str, int, long)):
|
||||
ids = [ids]
|
||||
|
|
|
@ -70,8 +70,6 @@ class hr_analytic_timesheet(osv.osv):
|
|||
}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
toremove = {}
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
toremove[obj.line_id.id] = True
|
||||
|
@ -80,8 +78,6 @@ class hr_analytic_timesheet(osv.osv):
|
|||
|
||||
|
||||
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit=False, journal_id=False, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {'value':{}}
|
||||
if prod_id and unit_amount:
|
||||
# find company
|
||||
|
|
|
@ -37,8 +37,6 @@ class analytical_timesheet_employee(osv.osv_memory):
|
|||
def _get_user(self, cr, uid, context=None):
|
||||
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
if not emp_id:
|
||||
raise osv.except_osv(_("Warning"), _("No employee defined for this user"))
|
||||
|
@ -51,8 +49,6 @@ class analytical_timesheet_employee(osv.osv_memory):
|
|||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': [],
|
||||
|
|
|
@ -39,8 +39,6 @@ class analytical_timesheet_employees(osv.osv_memory):
|
|||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': [],
|
||||
|
|
|
@ -40,16 +40,12 @@ class hr_so_project(osv.osv_memory):
|
|||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
if emp_ids:
|
||||
for employee in emp_obj.browse(cr, uid, emp_ids, context=context):
|
||||
return {'name': employee.name, 'state': employee.state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
|
||||
def _get_empid2(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = self._get_empid(cr, uid, context=context)
|
||||
cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
|
||||
|
||||
|
@ -61,8 +57,6 @@ class hr_so_project(osv.osv_memory):
|
|||
return res
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(hr_so_project, self).default_get(cr, uid, fields_list, context=context)
|
||||
res.update(self._get_empid2(cr, uid, context=context))
|
||||
return res
|
||||
|
@ -94,8 +88,6 @@ class hr_so_project(osv.osv_memory):
|
|||
return timesheet_obj.create(cr, uid, res, context=context)
|
||||
|
||||
def sign_out_result_end(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
emp_id = data.emp_id.id
|
||||
|
@ -104,8 +96,6 @@ class hr_so_project(osv.osv_memory):
|
|||
return {}
|
||||
|
||||
def sign_out_result(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
emp_id = data.emp_id.id
|
||||
|
@ -137,8 +127,6 @@ class hr_si_project(osv.osv_memory):
|
|||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
if not emp_id:
|
||||
raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
|
||||
|
@ -146,8 +134,6 @@ class hr_si_project(osv.osv_memory):
|
|||
|
||||
def check_state(self, cr, uid, ids, context=None):
|
||||
obj_model = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_id = self.default_get(cr, uid, context)['emp_id']
|
||||
# get the latest action (sign_in or out) for this employee
|
||||
cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
|
||||
|
@ -168,8 +154,6 @@ class hr_si_project(osv.osv_memory):
|
|||
|
||||
def sign_in_result(self, cr, uid, ids, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
if context is None:
|
||||
context = {}
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
emp_id = data.emp_id.id
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data.date or False)
|
||||
|
@ -177,8 +161,6 @@ class hr_si_project(osv.osv_memory):
|
|||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context)
|
||||
if context is None:
|
||||
context = {}
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
if emp_id:
|
||||
|
|
|
@ -41,8 +41,6 @@ hr_timesheet_invoice_factor()
|
|||
class account_analytic_account(osv.osv):
|
||||
def _invoiced_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
obj_invoice = self.pool.get('account.invoice')
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {}
|
||||
|
||||
cr.execute('SELECT account_id as account_id, l.invoice_id '
|
||||
|
@ -90,14 +88,10 @@ class account_analytic_line(osv.osv):
|
|||
}
|
||||
|
||||
def unlink(self, cursor, user, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
return super(account_analytic_line,self).unlink(cursor, user, ids,
|
||||
context=context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self._check_inv(cr, uid, ids, vals)
|
||||
return super(account_analytic_line,self).write(cr, uid, ids, vals,
|
||||
context=context)
|
||||
|
@ -114,8 +108,6 @@ class account_analytic_line(osv.osv):
|
|||
return True
|
||||
|
||||
def copy(self, cursor, user, obj_id, default=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
|
@ -144,8 +136,6 @@ class hr_analytic_timesheet(osv.osv):
|
|||
return res
|
||||
|
||||
def copy(self, cursor, user, obj_id, default=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue