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