[REF]: Refactored some lines from previous commit.
bzr revid: uco@tinyerp.com-20101123113152-0ue71yg9usp1gklx
This commit is contained in:
parent
097ff85deb
commit
3700e08ed6
|
@ -902,9 +902,11 @@ class account_period(osv.osv):
|
|||
cr.execute('update account_period set state=%s where id=%s', (mode, id))
|
||||
return True
|
||||
|
||||
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
|
||||
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
|
||||
if args is None:
|
||||
args = []
|
||||
if context is None:
|
||||
context = {}
|
||||
ids = []
|
||||
if name:
|
||||
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
|
||||
|
@ -1219,7 +1221,8 @@ class account_move(osv.osv):
|
|||
# TODO: Check if period is closed !
|
||||
#
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
if 'line_id' in vals and context.get('copy'):
|
||||
for l in vals['line_id']:
|
||||
if not l[0]:
|
||||
|
@ -1260,7 +1263,8 @@ class account_move(osv.osv):
|
|||
return result
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
default.update({
|
||||
'state':'draft',
|
||||
'name':'/',
|
||||
|
@ -1478,7 +1482,6 @@ class account_move_reconcile(osv.osv):
|
|||
return True
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
if not ids:
|
||||
return []
|
||||
result = []
|
||||
|
@ -1603,7 +1606,6 @@ class account_tax_code(osv.osv):
|
|||
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
if not ids:
|
||||
|
@ -1615,7 +1617,6 @@ class account_tax_code(osv.osv):
|
|||
for x in reads]
|
||||
|
||||
def _default_company(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
|
@ -1761,7 +1762,6 @@ class account_tax(osv.osv):
|
|||
return res
|
||||
|
||||
def _default_company(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
|
@ -2314,7 +2314,6 @@ class account_add_tmpl_wizard(osv.osv_memory):
|
|||
_name = 'account.addtmpl.wizard'
|
||||
|
||||
def _get_def_cparent(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
acc_obj=self.pool.get('account.account')
|
||||
tmpl_obj=self.pool.get('account.account.template')
|
||||
tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']], ['parent_id'])
|
||||
|
@ -2336,7 +2335,8 @@ class account_add_tmpl_wizard(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_create(self,cr,uid,ids,context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
acc_obj = self.pool.get('account.account')
|
||||
tmpl_obj = self.pool.get('account.account.template')
|
||||
data = self.read(cr, uid, ids)
|
||||
|
@ -2384,7 +2384,6 @@ class account_tax_code_template(osv.osv):
|
|||
}
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
if not ids:
|
||||
return []
|
||||
if isinstance(ids, (int, long)):
|
||||
|
@ -2464,7 +2463,6 @@ class account_tax_template(osv.osv):
|
|||
}
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
if not ids:
|
||||
return []
|
||||
res = []
|
||||
|
@ -2474,7 +2472,6 @@ class account_tax_template(osv.osv):
|
|||
return res
|
||||
|
||||
def _default_company(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
|
@ -2602,7 +2599,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
}
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
obj_multi = self.browse(cr, uid, ids[0])
|
||||
obj_acc = self.pool.get('account.account')
|
||||
obj_acc_tax = self.pool.get('account.tax')
|
||||
|
|
|
@ -59,7 +59,6 @@ class account_analytic_line(osv.osv):
|
|||
order, context=context, count=count)
|
||||
|
||||
def _check_company(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
for l in lines:
|
||||
if l.move_id and not l.account_id.company_id.id == l.move_id.account_id.company_id.id:
|
||||
|
@ -135,7 +134,8 @@ class account_analytic_line(osv.osv):
|
|||
}
|
||||
|
||||
def view_header_get(self, cr, user, view_id, view_type, context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('account_id', False):
|
||||
# account_id in context may also be pointing to an account.account.id
|
||||
cr.execute('select name from account_analytic_account where id=%s', (context['account_id'],))
|
||||
|
|
|
@ -47,7 +47,8 @@ class account_bank_statement(osv.osv):
|
|||
return res
|
||||
|
||||
def _default_journal_id(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
journal_type = context.get('journal_type', False)
|
||||
journal_id = False
|
||||
|
@ -58,15 +59,13 @@ class account_bank_statement(osv.osv):
|
|||
return journal_id
|
||||
|
||||
def _default_balance_start(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,))
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
return self.browse(cr, uid, [res[0]], context=context)[0].balance_end
|
||||
return self.browse(cr, uid, res[0], context=context).balance_end
|
||||
return 0.0
|
||||
|
||||
def _end_balance(self, cursor, user, ids, name, attr, context=None):
|
||||
context = context or {}
|
||||
res_currency_obj = self.pool.get('res.currency')
|
||||
res_users_obj = self.pool.get('res.users')
|
||||
res = {}
|
||||
|
@ -105,7 +104,6 @@ class account_bank_statement(osv.osv):
|
|||
return False
|
||||
|
||||
def _currency(self, cursor, user, ids, name, args, context=None):
|
||||
context = context or {}
|
||||
res = {}
|
||||
res_currency_obj = self.pool.get('res.currency')
|
||||
res_users_obj = self.pool.get('res.users')
|
||||
|
@ -198,7 +196,8 @@ class account_bank_statement(osv.osv):
|
|||
return self.write(cr, uid, ids, {}, context=context)
|
||||
|
||||
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
res_currency_obj = self.pool.get('res.currency')
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
|
@ -303,7 +302,6 @@ class account_bank_statement(osv.osv):
|
|||
return st_number + '/' + str(st_line.sequence)
|
||||
|
||||
def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
|
||||
context = context or {}
|
||||
st = self.browse(cr, uid, st_id, context=context)
|
||||
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
|
||||
raise osv.except_osv(_('Error !'),
|
||||
|
|
|
@ -41,7 +41,6 @@ class account_cashbox_line(osv.osv):
|
|||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
context = context or {}
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
res[obj.id] = obj.pieces * obj.number
|
||||
return res
|
||||
|
@ -77,7 +76,6 @@ class account_cash_statement(osv.osv):
|
|||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
context = context or {}
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
amount_total = 0.0
|
||||
|
||||
|
@ -98,7 +96,6 @@ class account_cash_statement(osv.osv):
|
|||
@return: Dictionary of values.
|
||||
"""
|
||||
res ={}
|
||||
context = context or {}
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
amount_total = 0.0
|
||||
for line in statement.ending_details_ids:
|
||||
|
@ -114,7 +111,6 @@ class account_cash_statement(osv.osv):
|
|||
@return: Dictionary of values.
|
||||
"""
|
||||
res2={}
|
||||
context = context or {}
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
encoding_total=0.0
|
||||
for line in statement.line_ids:
|
||||
|
@ -123,7 +119,6 @@ class account_cash_statement(osv.osv):
|
|||
return res2
|
||||
|
||||
def _end_balance(self, cursor, user, ids, name, attr, context=None):
|
||||
context = context or {}
|
||||
res_currency_obj = self.pool.get('res.currency')
|
||||
res_users_obj = self.pool.get('res.users')
|
||||
res = {}
|
||||
|
@ -157,7 +152,6 @@ class account_cash_statement(osv.osv):
|
|||
return res
|
||||
|
||||
def _get_company(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
user_pool = self.pool.get('res.users')
|
||||
company_pool = self.pool.get('res.company')
|
||||
user = user_pool.browse(cr, uid, uid, context=context)
|
||||
|
@ -246,7 +240,6 @@ class account_cash_statement(osv.osv):
|
|||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
context = context or {}
|
||||
sql = [
|
||||
('journal_id', '=', vals.get('journal_id', False)),
|
||||
('state', '=', 'open')
|
||||
|
|
|
@ -108,7 +108,6 @@ class account_move_line(osv.osv):
|
|||
return data
|
||||
|
||||
def create_analytic_lines(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
acc_ana_line_obj = self.pool.get('account.analytic.line')
|
||||
for obj_line in self.browse(cr, uid, ids, context=context):
|
||||
if obj_line.analytic_account_id:
|
||||
|
@ -141,7 +140,8 @@ class account_move_line(osv.osv):
|
|||
return data
|
||||
|
||||
def convert_to_period(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
period_obj = self.pool.get('account.period')
|
||||
#check if the period_id changed in the context from client side
|
||||
if context.get('period_id', False):
|
||||
|
@ -154,7 +154,8 @@ class account_move_line(osv.osv):
|
|||
return context
|
||||
|
||||
def _default_get(self, cr, uid, fields, context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
|
||||
context['journal_id'] = context.get('search_default_journal_id')
|
||||
account_obj = self.pool.get('account.account')
|
||||
|
@ -293,10 +294,9 @@ class account_move_line(osv.osv):
|
|||
return data
|
||||
|
||||
def on_create_write(self, cr, uid, id, context=None):
|
||||
context = context or {}
|
||||
if not id:
|
||||
return []
|
||||
ml = self.browse(cr, uid, id, context)
|
||||
ml = self.browse(cr, uid, id, context=context)
|
||||
return map(lambda x: x.id, ml.move_id.line_id)
|
||||
|
||||
def _balance(self, cr, uid, ids, name, arg, context=None):
|
||||
|
@ -343,11 +343,10 @@ class account_move_line(osv.osv):
|
|||
return res
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
if not ids:
|
||||
return []
|
||||
result = []
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.ref:
|
||||
result.append((line.id, (line.move_id.name or '')+' ('+line.ref+')'))
|
||||
else:
|
||||
|
@ -413,7 +412,6 @@ class account_move_line(osv.osv):
|
|||
return [('id', 'in', [x[0] for x in res])]
|
||||
|
||||
def _get_move_lines(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
result = []
|
||||
for move in self.pool.get('account.move').browse(cr, uid, ids, context=context):
|
||||
for line in move.line_id:
|
||||
|
@ -464,7 +462,8 @@ class account_move_line(osv.osv):
|
|||
}
|
||||
|
||||
def _get_date(self, cr, uid, context=None):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context or {}
|
||||
period_obj = self.pool.get('account.period')
|
||||
dt = time.strftime('%Y-%m-%d')
|
||||
if ('journal_id' in context) and ('period_id' in context):
|
||||
|
@ -507,14 +506,12 @@ class account_move_line(osv.osv):
|
|||
]
|
||||
|
||||
def _auto_init(self, cr, context=None):
|
||||
context = context or {}
|
||||
super(account_move_line, self)._auto_init(cr, context=context)
|
||||
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
|
||||
if not cr.fetchone():
|
||||
cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
|
||||
|
||||
def _check_no_view(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
for l in lines:
|
||||
if l.account_id.type == 'view':
|
||||
|
@ -522,7 +519,6 @@ class account_move_line(osv.osv):
|
|||
return True
|
||||
|
||||
def _check_no_closed(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
for l in lines:
|
||||
if l.account_id.type == 'closed':
|
||||
|
@ -530,7 +526,6 @@ class account_move_line(osv.osv):
|
|||
return True
|
||||
|
||||
def _check_company_id(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
for l in lines:
|
||||
if l.company_id != l.account_id.company_id or l.company_id != l.period_id.company_id:
|
||||
|
@ -538,7 +533,6 @@ class account_move_line(osv.osv):
|
|||
return True
|
||||
|
||||
def _check_partner_id(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
for l in lines:
|
||||
if l.account_id.type in ('receivable', 'payable') and not l.partner_id:
|
||||
|
@ -849,7 +843,8 @@ class account_move_line(osv.osv):
|
|||
@return: Returns a dict which contains new values, and context
|
||||
"""
|
||||
res = {}
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
period_pool = self.pool.get('account.period')
|
||||
pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
|
||||
if pids:
|
||||
|
@ -866,7 +861,8 @@ class account_move_line(osv.osv):
|
|||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
|
||||
if view_type != 'tree':
|
||||
#Remove the toolbar from the form view
|
||||
|
@ -969,7 +965,8 @@ class account_move_line(osv.osv):
|
|||
|
||||
def _check_moves(self, cr, uid, context=None):
|
||||
# use the first move ever created for this journal and period
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
cr.execute('SELECT id, state, name FROM account_move WHERE journal_id = %s AND period_id = %s ORDER BY id limit 1', (context['journal_id'],context['period_id']))
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
|
@ -984,7 +981,6 @@ class account_move_line(osv.osv):
|
|||
obj_move_line = self.pool.get('account.move.line')
|
||||
obj_move_rec = self.pool.get('account.move.reconcile')
|
||||
unlink_ids = []
|
||||
context = context or {}
|
||||
if not move_ids:
|
||||
return True
|
||||
recs = obj_move_line.read(cr, uid, move_ids, ['reconcile_id', 'reconcile_partial_id'])
|
||||
|
@ -999,11 +995,12 @@ class account_move_line(osv.osv):
|
|||
return True
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None, check=True):
|
||||
context = context or {}
|
||||
if context is None:
|
||||
context = {}
|
||||
move_obj = self.pool.get('account.move')
|
||||
self._update_check(cr, uid, ids, context)
|
||||
result = False
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
context['journal_id'] = line.journal_id.id
|
||||
context['period_id'] = line.period_id.id
|
||||
result = super(account_move_line, self).unlink(cr, uid, [line.id], context=context)
|
||||
|
@ -1032,9 +1029,9 @@ class account_move_line(osv.osv):
|
|||
journal_id = context.get('journal_id', False)
|
||||
period_id = context.get('period_id', False)
|
||||
if journal_id:
|
||||
journal = journal_obj.browse(cr, uid, [journal_id], context=context)[0]
|
||||
journal = journal_obj.browse(cr, uid, journal_id, context=context)
|
||||
if journal.allow_date and period_id:
|
||||
period = period_obj.browse(cr, uid, [period_id])[0]
|
||||
period = period_obj.browse(cr, uid, period_id, context=context)
|
||||
if not time.strptime(vals['date'][:10],'%Y-%m-%d') >= time.strptime(period.date_start, '%Y-%m-%d') or not time.strptime(vals['date'][:10], '%Y-%m-%d') <= time.strptime(period.date_stop, '%Y-%m-%d'):
|
||||
raise osv.except_osv(_('Error'),_('The date of your Journal Entry is not in the defined period!'))
|
||||
else:
|
||||
|
@ -1093,7 +1090,6 @@ class account_move_line(osv.osv):
|
|||
jour_period_obj = self.pool.get('account.journal.period')
|
||||
cr.execute('SELECT state FROM account_journal_period WHERE journal_id = %s AND period_id = %s', (journal_id, period_id))
|
||||
result = cr.fetchall()
|
||||
context = context or {}
|
||||
for (state,) in result:
|
||||
if state == 'done':
|
||||
raise osv.except_osv(_('Error !'), _('You can not add/modify entries in a closed journal.'))
|
||||
|
@ -1109,7 +1105,6 @@ class account_move_line(osv.osv):
|
|||
|
||||
def _update_check(self, cr, uid, ids, context=None):
|
||||
done = {}
|
||||
context = context or {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted):
|
||||
raise osv.except_osv(_('Error !'), _('You can not do this modification on a confirmed entry ! Please note that you can just change some non important fields !'))
|
||||
|
|
|
@ -187,9 +187,6 @@ class account_invoice(osv.osv):
|
|||
|
||||
def _get_invoice_from_line(self, cr, uid, ids, context=None):
|
||||
move = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
for line in self.pool.get('account.move.line').browse(cr, uid, ids, context=context):
|
||||
if line.reconcile_partial_id:
|
||||
for line2 in line.reconcile_partial_id.line_partial_ids:
|
||||
|
@ -204,9 +201,6 @@ class account_invoice(osv.osv):
|
|||
|
||||
def _get_invoice_from_reconcile(self, cr, uid, ids, context=None):
|
||||
move = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context):
|
||||
for line in r.line_partial_ids:
|
||||
move[line.move_id.id] = True
|
||||
|
@ -678,8 +672,6 @@ class account_invoice(osv.osv):
|
|||
return True
|
||||
|
||||
def button_compute(self, cr, uid, ids, context=None, set_total=False):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.button_reset_taxes(cr, uid, ids, context)
|
||||
for inv in self.browse(cr, uid, ids, context=context):
|
||||
if set_total:
|
||||
|
@ -1357,7 +1349,7 @@ class account_invoice_line(osv.osv):
|
|||
# Parse the value_reference field to get the ID of the account.account record
|
||||
account_id = int (my_value[0]["value_reference"].split(",")[1])
|
||||
# Use the ID of the account.account record in the browse for the account.account record
|
||||
app_acc_in = account_obj.browse(cr, uid, [account_id], context=context)[0]
|
||||
app_acc_in = account_obj.browse(cr, uid, account_id, context=context)
|
||||
if not exp_pro_id:
|
||||
ex_acc = res.product_tmpl_id.property_account_expense
|
||||
ex_acc_cate = res.categ_id.property_account_expense_categ
|
||||
|
@ -1528,9 +1520,6 @@ class account_invoice_tax(osv.osv):
|
|||
|
||||
def _count_factor(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
for invoice_tax in self.browse(cr, uid, ids, context=context):
|
||||
res[invoice_tax.id] = {
|
||||
'factor_base': 1.0,
|
||||
|
@ -1597,9 +1586,6 @@ class account_invoice_tax(osv.osv):
|
|||
}
|
||||
def compute(self, cr, uid, invoice_id, context=None):
|
||||
tax_grouped = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
|
||||
|
|
|
@ -35,9 +35,6 @@ class account_fiscal_position(osv.osv):
|
|||
}
|
||||
|
||||
def map_tax(self, cr, uid, fposition_id, taxes, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if not taxes:
|
||||
return []
|
||||
if not fposition_id:
|
||||
|
@ -55,8 +52,6 @@ class account_fiscal_position(osv.osv):
|
|||
return result
|
||||
|
||||
def map_account(self, cr, uid, fposition_id, account_id, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not fposition_id:
|
||||
return account_id
|
||||
for pos in fposition_id.account_ids:
|
||||
|
|
|
@ -30,8 +30,6 @@ class project_account_analytic_line(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
mod_obj =self.pool.get('ir.model.data')
|
||||
domain = []
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
|
|
|
@ -28,8 +28,6 @@ import tools
|
|||
from osv import fields,osv
|
||||
|
||||
def _code_get(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
acc_type_obj = self.pool.get('account.account.type')
|
||||
ids = acc_type_obj.search(cr, uid, [])
|
||||
res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
|
||||
|
@ -102,9 +100,7 @@ class report_aged_receivable(osv.osv):
|
|||
|
||||
def _calc_bal(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for period in self.read(cr,uid,ids,['name'],context=context):
|
||||
for period in self.read(cr, uid, ids, ['name'], context=context):
|
||||
date1,date2 = period['name'].split(' to ')
|
||||
cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
|
||||
WHERE (line.account_id=ac.id) AND ac.type='receivable' \
|
||||
|
|
|
@ -181,6 +181,7 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
cr.execute('select name,aie_categ from auction_lot_category')
|
||||
vals = dict(cr.fetchall())
|
||||
cr.close()
|
||||
if context is None: context = {}
|
||||
|
||||
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'])
|
||||
|
|
|
@ -369,7 +369,7 @@ class crm_case(object):
|
|||
return self.remind_user(cr, uid, ids, context, attach,
|
||||
destination=False)
|
||||
|
||||
def remind_user(self, cr, uid, ids, context=None, attach=False,destination=True):
|
||||
def remind_user(self, cr, uid, ids, context=None, attach=False, destination=True):
|
||||
"""
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
|
|
|
@ -36,7 +36,7 @@ class delivery_carrier(osv.osv):
|
|||
if not order_id:
|
||||
res = super(delivery_carrier, self).name_get(cr, uid, ids, context=context)
|
||||
else:
|
||||
order = self.pool.get('sale.order').browse(cr, uid, [order_id], context=context)[0]
|
||||
order = self.pool.get('sale.order').browse(cr, uid, order_id, context=context)
|
||||
currency = order.pricelist_id.currency_id.name or ''
|
||||
res = [(r['id'], r['name']+' ('+(str(r['price']))+' '+currency+')') for r in self.read(cr, uid, ids, ['name', 'price'], context)]
|
||||
return res
|
||||
|
@ -50,7 +50,7 @@ class delivery_carrier(osv.osv):
|
|||
order_id=context.get('order_id',False)
|
||||
price=False
|
||||
if order_id:
|
||||
order = sale_obj.browse(cr, uid, [order_id], context=context)[0]
|
||||
order = sale_obj.browse(cr, uid, order_id, context=context)
|
||||
carrier_grid=self.grid_get(cr,uid,[carrier.id],order.partner_shipping_id.id,context)
|
||||
if carrier_grid:
|
||||
price=grid_obj.get_price(cr, uid, carrier_grid, order, time.strftime('%Y-%m-%d'), context)
|
||||
|
@ -70,7 +70,7 @@ class delivery_carrier(osv.osv):
|
|||
'active': lambda *args:1
|
||||
}
|
||||
def grid_get(self, cr, uid, ids, contact_id, context=None):
|
||||
contact = self.pool.get('res.partner.address').browse(cr, uid, [contact_id], context=context)[0]
|
||||
contact = self.pool.get('res.partner.address').browse(cr, uid, contact_id, context=context)
|
||||
for carrier in self.browse(cr, uid, ids, context=context):
|
||||
for grid in carrier.grids_id:
|
||||
get_id = lambda x: x.id
|
||||
|
|
|
@ -240,7 +240,7 @@ class mrp_bom(osv.osv):
|
|||
@return: Dictionary of changed values
|
||||
"""
|
||||
if product_id:
|
||||
prod = self.pool.get('product.product').browse(cr, uid, [product_id], context=context)[0]
|
||||
prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||
v = {'product_uom': prod.uom_id.id}
|
||||
if not name:
|
||||
v['name'] = prod.name
|
||||
|
|
|
@ -89,7 +89,7 @@ class mrp_repair(osv.osv):
|
|||
tax = self._amount_tax(cr, uid, ids, field_name, arg, context=context)
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
for id in ids:
|
||||
repair = self.browse(cr, uid, [id], context=context)[0]
|
||||
repair = self.browse(cr, uid, id, context=context)
|
||||
cur = repair.pricelist_id.currency_id
|
||||
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
|
||||
return res
|
||||
|
|
|
@ -81,7 +81,7 @@ class process_process(osv.osv):
|
|||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
|
||||
process = pool.get('process.process').browse(cr, uid, [id], context=context)[0]
|
||||
process = pool.get('process.process').browse(cr, uid, id, context=context)
|
||||
|
||||
name = process.name
|
||||
resource = None
|
||||
|
@ -95,8 +95,8 @@ class process_process(osv.osv):
|
|||
states = dict(pool.get(res_model).fields_get(cr, uid, context=context).get('state', {}).get('selection', {}))
|
||||
|
||||
if res_id:
|
||||
current_object = pool.get(res_model).browse(cr, uid, [res_id], context=context)[0]
|
||||
current_user = pool.get('res.users').browse(cr, uid, [uid], context=context)[0]
|
||||
current_object = pool.get(res_model).browse(cr, uid, res_id, context=context)
|
||||
current_user = pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
expr_context = Env(current_object, current_user)
|
||||
resource = current_object.name
|
||||
if 'state' in current_object:
|
||||
|
@ -188,7 +188,7 @@ class process_process(osv.osv):
|
|||
|
||||
nodes[nid]['res'] = resource = {'id': ref_id, 'model': ref_model}
|
||||
|
||||
refobj = pool.get(ref_model).browse(cr, uid, [ref_id], context=context)[0]
|
||||
refobj = pool.get(ref_model).browse(cr, uid, ref_id, context=context)
|
||||
fields = pool.get(ref_model).fields_get(cr, uid, context=context)
|
||||
|
||||
# check for directory_id from inherited from document module
|
||||
|
@ -253,7 +253,7 @@ class process_process(osv.osv):
|
|||
default = {}
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
process = pool.get('process.process').browse(cr, uid, [id], context=context)[0]
|
||||
process = pool.get('process.process').browse(cr, uid, id, context=context)
|
||||
|
||||
nodes = {}
|
||||
transitions = {}
|
||||
|
@ -370,7 +370,7 @@ class process_transition_action(osv.osv):
|
|||
if not default:
|
||||
default = {}
|
||||
|
||||
state = self.pool.get('process.transition.action').browse(cr, uid, [id], context=context)[0].state
|
||||
state = self.pool.get('process.transition.action').browse(cr, uid, id, context=context).state
|
||||
if state:
|
||||
default['state'] = state
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@ class product_pricelist_version(osv.osv):
|
|||
}
|
||||
|
||||
# We desactivate duplicated pricelists, so that dates do not overlap
|
||||
def copy(self, cr, uid, id, default=None,context=None):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if not default: default= {}
|
||||
default['active'] = False
|
||||
return super(product_pricelist_version, self).copy(cr, uid, id, default, context)
|
||||
|
|
|
@ -460,7 +460,7 @@ class purchase_order(osv.osv):
|
|||
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
||||
return picking_id
|
||||
|
||||
def copy(self, cr, uid, id, default=None,context=None):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if not default:
|
||||
default = {}
|
||||
default.update({
|
||||
|
|
|
@ -107,7 +107,7 @@ class purchase_requisition_line(osv.osv):
|
|||
"""
|
||||
value = {'product_uom_id': ''}
|
||||
if product_id:
|
||||
prod = self.pool.get('product.product').browse(cr, uid, [product_id], context=context)[0]
|
||||
prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||
value = {'product_uom_id': prod.uom_id.id,'product_qty':1.0}
|
||||
return {'value': value}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class purchase_requisition_partner(osv.osv_memory):
|
|||
acc_pos_obj = self.pool.get('account.fiscal.position')
|
||||
partner_id = data[0]['partner_id']
|
||||
|
||||
supplier_data = partner_obj.browse(cr, uid,[ partner_id], context=context)[0]
|
||||
supplier_data = partner_obj.browse(cr, uid, partner_id, context=context)
|
||||
|
||||
address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
|
||||
list_line=[]
|
||||
|
|
|
@ -668,7 +668,7 @@ class stock_picking(osv.osv):
|
|||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
picking_obj = self.browse(cr, uid, [id], context=context)[0]
|
||||
picking_obj = self.browse(cr, uid, id, context=context)
|
||||
move_obj=self.pool.get('stock.move')
|
||||
if ('name' not in default) or (picking_obj.name=='/'):
|
||||
seq_obj_name = 'stock.picking.' + picking_obj.type
|
||||
|
@ -677,7 +677,7 @@ class stock_picking(osv.osv):
|
|||
default['backorder_id'] = False
|
||||
res=super(stock_picking, self).copy(cr, uid, id, default, context)
|
||||
if res:
|
||||
picking_obj = self.browse(cr, uid, [res], context)[0]
|
||||
picking_obj = self.browse(cr, uid, res, context=context)
|
||||
for move in picking_obj.move_lines:
|
||||
move_obj.write(cr, uid, [move.id], {'tracking_id': False,'prodlot_id':False})
|
||||
return res
|
||||
|
|
|
@ -86,7 +86,7 @@ class stock_fill_inventory(osv.osv_memory):
|
|||
for location in res_location.keys():
|
||||
res = res_location[location]
|
||||
for product_id in res.keys():
|
||||
prod = product_obj.browse(cr, uid, [product_id], context=context)[0]
|
||||
prod = product_obj.browse(cr, uid, product_id, context=context)
|
||||
uom = prod.uom_id.id
|
||||
context.update(uom=uom, compute_child=False)
|
||||
amount = stock_location_obj._product_get(cr, uid,
|
||||
|
|
|
@ -94,7 +94,7 @@ class survey(osv.osv):
|
|||
self.write(cr, uid, ids, {'state': 'cancel' })
|
||||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default=None,context=None):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
|
||||
|
||||
def action_print_survey(self, cr, uid, ids, context=None):
|
||||
|
@ -631,7 +631,7 @@ class survey_response(osv.osv):
|
|||
res.append((record['id'], name))
|
||||
return res
|
||||
|
||||
def copy(self, cr, uid, id, default=None,context=None):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
|
||||
|
||||
survey_response()
|
||||
|
|
Loading…
Reference in New Issue