[MERGE] merged the dev branch related to the change of read() of osv_memory in order to work by batch (server side change, revno: 3369, revision-id: odo@openerp.com-20110315132628-uhhpf95b9iyin482). It will now return a tuple (id, name) for the m2o instead and thus the osv_memory objects have been changed accordingly
bzr revid: qdp-launchpad@openerp.com-20110315132726-dpwcxa08a2l12yy6
This commit is contained in:
commit
559e65c84e
|
@ -143,15 +143,15 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
obj_model = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
form = self.read(cr, uid, ids, [])[0]
|
||||
max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0
|
||||
power = form['power']
|
||||
allow_write_off = form['allow_write_off']
|
||||
form = self.browse(cr, uid, ids, context=context)[0]
|
||||
max_amount = form.max_amount or 0.0
|
||||
power = form.power
|
||||
allow_write_off = form.allow_write_off
|
||||
reconciled = unreconciled = 0
|
||||
if not form['account_ids']:
|
||||
if not form.account_ids:
|
||||
raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile'))
|
||||
for account_id in form['account_ids']:
|
||||
params = (account_id,)
|
||||
for account_id in form.account_ids:
|
||||
params = (account_id.id,)
|
||||
if not allow_write_off:
|
||||
query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL
|
||||
AND state <> 'draft' GROUP BY partner_id
|
||||
|
@ -172,12 +172,12 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
"AND partner_id=%s " \
|
||||
"AND state <> 'draft' " \
|
||||
"AND reconcile_id IS NULL",
|
||||
(account_id, partner_id))
|
||||
(account_id.id, partner_id))
|
||||
line_ids = [id for (id,) in cr.fetchall()]
|
||||
if line_ids:
|
||||
reconciled += len(line_ids)
|
||||
if allow_write_off:
|
||||
move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
|
||||
move_line_obj.reconcile(cr, uid, line_ids, 'auto', form.writeoff_acc_id.id, form.period_id.id, form.journal_id.id, context)
|
||||
else:
|
||||
move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context=context)
|
||||
|
||||
|
@ -191,7 +191,7 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
"AND partner_id IS NOT NULL " \
|
||||
"GROUP BY partner_id " \
|
||||
"HAVING count(*)>1",
|
||||
(account_id,))
|
||||
(account_id.id,))
|
||||
partner_ids = [id for (id,) in cr.fetchall()]
|
||||
#filter?
|
||||
for partner_id in partner_ids:
|
||||
|
@ -205,7 +205,7 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
"AND state <> 'draft' " \
|
||||
"AND debit > 0 " \
|
||||
"ORDER BY date_maturity",
|
||||
(account_id, partner_id))
|
||||
(account_id.id, partner_id))
|
||||
debits = cr.fetchall()
|
||||
|
||||
# get the list of unreconciled 'credit transactions' for this partner
|
||||
|
@ -218,10 +218,10 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
"AND state <> 'draft' " \
|
||||
"AND credit > 0 " \
|
||||
"ORDER BY date_maturity",
|
||||
(account_id, partner_id))
|
||||
(account_id.id, partner_id))
|
||||
credits = cr.fetchall()
|
||||
|
||||
(rec, unrec) = self.do_reconcile(cr, uid, credits, debits, max_amount, power, form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
|
||||
(rec, unrec) = self.do_reconcile(cr, uid, credits, debits, max_amount, power, form.writeoff_acc_id.id, form.period_id.id, form.journal_id.id, context)
|
||||
reconciled += rec
|
||||
unreconciled += unrec
|
||||
|
||||
|
@ -234,7 +234,7 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
"WHERE account_id=%s " \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND state <> 'draft' " + partner_filter,
|
||||
(account_id,))
|
||||
(account_id.id,))
|
||||
additional_unrec = cr.fetchone()[0]
|
||||
unreconciled = unreconciled + additional_unrec
|
||||
context.update({'reconciled': reconciled, 'unreconciled': unreconciled})
|
||||
|
@ -252,4 +252,4 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
|
||||
account_automatic_reconcile()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -45,8 +45,8 @@ class account_change_currency(osv.osv_memory):
|
|||
obj_currency = self.pool.get('res.currency')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
new_currency = data['currency_id']
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
new_currency = data.currency_id.id
|
||||
|
||||
invoice = obj_inv.browse(cr, uid, context['active_id'], context=context)
|
||||
if invoice.currency_id.id == new_currency:
|
||||
|
@ -76,4 +76,4 @@ class account_change_currency(osv.osv_memory):
|
|||
|
||||
account_change_currency()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -56,22 +56,22 @@ class account_fiscalyear_close(osv.osv_memory):
|
|||
obj_acc_account = self.pool.get('account.account')
|
||||
obj_acc_journal_period = self.pool.get('account.journal.period')
|
||||
|
||||
data = self.read(cr, uid, ids, context=context)
|
||||
data = self.browse(cr, uid, ids, context=context)
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
fy_id = data[0]['fy_id']
|
||||
fy_id = data[0].fy_id.id
|
||||
|
||||
cr.execute("SELECT id FROM account_period WHERE date_stop < (SELECT date_start FROM account_fiscalyear WHERE id = %s)", (str(data[0]['fy2_id']),))
|
||||
cr.execute("SELECT id FROM account_period WHERE date_stop < (SELECT date_start FROM account_fiscalyear WHERE id = %s)", (str(data[0].fy2_id.id),))
|
||||
fy_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall()))
|
||||
cr.execute("SELECT id FROM account_period WHERE date_start > (SELECT date_stop FROM account_fiscalyear WHERE id = %s)", (str(fy_id),))
|
||||
fy2_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall()))
|
||||
|
||||
period = obj_acc_period.browse(cr, uid, data[0]['period_id'], context=context)
|
||||
new_fyear = obj_acc_fiscalyear.browse(cr, uid, data[0]['fy2_id'], context=context)
|
||||
old_fyear = obj_acc_fiscalyear.browse(cr, uid, data[0]['fy_id'], context=context)
|
||||
period = obj_acc_period.browse(cr, uid, data[0].period_id.id, context=context)
|
||||
new_fyear = obj_acc_fiscalyear.browse(cr, uid, data[0].fy2_id.id, context=context)
|
||||
old_fyear = obj_acc_fiscalyear.browse(cr, uid, fy_id, context=context)
|
||||
|
||||
new_journal = data[0]['journal_id']
|
||||
new_journal = data[0].journal_id.id
|
||||
new_journal = obj_acc_journal.browse(cr, uid, new_journal, context=context)
|
||||
|
||||
if not new_journal.default_credit_account_id or not new_journal.default_debit_account_id:
|
||||
|
@ -107,7 +107,7 @@ class account_fiscalyear_close(osv.osv_memory):
|
|||
obj_acc_move_line.create(cr, uid, {
|
||||
'debit': account.balance>0 and account.balance,
|
||||
'credit': account.balance<0 and -account.balance,
|
||||
'name': data[0]['report_name'],
|
||||
'name': data[0].report_name,
|
||||
'date': period.date_start,
|
||||
'journal_id': new_journal.id,
|
||||
'period_id': period.id,
|
||||
|
@ -204,7 +204,7 @@ class account_fiscalyear_close(osv.osv_memory):
|
|||
|
||||
if ids:
|
||||
obj_acc_move_line.reconcile(cr, uid, ids, context=context)
|
||||
new_period = data[0]['period_id']
|
||||
new_period = data[0].period_id.id
|
||||
ids = obj_acc_journal_period.search(cr, uid, [('journal_id','=',new_journal.id),('period_id','=',new_period)])
|
||||
if not ids:
|
||||
ids = [obj_acc_journal_period.create(cr, uid, {
|
||||
|
|
|
@ -88,29 +88,29 @@ class account_invoice_refund(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
for form in self.read(cr, uid, ids, context=context):
|
||||
for form in self.browse(cr, uid, ids, context=context):
|
||||
created_inv = []
|
||||
date = False
|
||||
period = False
|
||||
description = False
|
||||
company = res_users_obj.browse(cr, uid, uid, context=context).company_id
|
||||
journal_id = form.get('journal_id', False)
|
||||
journal_id = form.journal_id.id
|
||||
for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
|
||||
if inv.state in ['draft', 'proforma2', 'cancel']:
|
||||
raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
|
||||
if inv.reconciled and mode in ('cancel', 'modify'):
|
||||
raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode))
|
||||
if form['period']:
|
||||
period = form['period']
|
||||
if form.period.id:
|
||||
period = form.period.id
|
||||
else:
|
||||
period = inv.period_id and inv.period_id.id or False
|
||||
|
||||
if not journal_id:
|
||||
journal_id = inv.journal_id.id
|
||||
|
||||
if form['date']:
|
||||
date = form['date']
|
||||
if not form['period']:
|
||||
if form.date:
|
||||
date = form.date
|
||||
if not form.period.id:
|
||||
cr.execute("select name from ir_model_fields \
|
||||
where model = 'account.period' \
|
||||
and name = 'company_id'")
|
||||
|
@ -128,8 +128,8 @@ class account_invoice_refund(osv.osv_memory):
|
|||
period = res[0]
|
||||
else:
|
||||
date = inv.date_invoice
|
||||
if form['description']:
|
||||
description = form['description']
|
||||
if form.description:
|
||||
description = form.description
|
||||
else:
|
||||
description = inv.name
|
||||
|
||||
|
@ -211,10 +211,10 @@ class account_invoice_refund(osv.osv_memory):
|
|||
return result
|
||||
|
||||
def invoice_refund(self, cr, uid, ids, context=None):
|
||||
data_refund = self.read(cr, uid, ids, [],context=context)[0]['filter_refund']
|
||||
data_refund = self.read(cr, uid, ids, ['filter_refund'],context=context)[0]['filter_refund']
|
||||
return self.compute_refund(cr, uid, ids, data_refund, context=context)
|
||||
|
||||
|
||||
account_invoice_refund()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -148,7 +148,7 @@ class account_move_journal(osv.osv_memory):
|
|||
|
||||
journal_id = self._get_journal(cr, uid, context)
|
||||
period_id = self._get_period(cr, uid, context)
|
||||
target_move = self.read(cr, uid, ids, [])[0]['target_move']
|
||||
target_move = self.read(cr, uid, ids, ['target_move'], context=context)[0]['target_move']
|
||||
|
||||
name = _("Journal Items")
|
||||
if journal_id:
|
||||
|
|
|
@ -31,14 +31,13 @@ class account_open_closed_fiscalyear(osv.osv_memory):
|
|||
}
|
||||
|
||||
def remove_entries(self, cr, uid, ids, context=None):
|
||||
fy_obj = self.pool.get('account.fiscalyear')
|
||||
move_obj = self.pool.get('account.move')
|
||||
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data_fyear = fy_obj.browse(cr, uid, data['fyear_id'], context=context)
|
||||
if not data_fyear.end_journal_period_id:
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
period_journal = data.fyear_id.end_journal_period_id or False
|
||||
if not period_journal:
|
||||
raise osv.except_osv(_('Error !'), _('No End of year journal defined for the fiscal year'))
|
||||
period_journal = data_fyear.end_journal_period_id
|
||||
|
||||
ids_move = move_obj.search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
|
||||
if ids_move:
|
||||
cr.execute('delete from account_move where id IN %s', (tuple(ids_move),))
|
||||
|
@ -46,4 +45,4 @@ class account_open_closed_fiscalyear(osv.osv_memory):
|
|||
|
||||
account_open_closed_fiscalyear()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -131,7 +131,10 @@ class account_common_report(osv.osv_memory):
|
|||
data = {}
|
||||
data['ids'] = context.get('active_ids', [])
|
||||
data['model'] = context.get('active_model', 'ir.ui.menu')
|
||||
data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id', 'target_move'])[0]
|
||||
data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id', 'target_move'], context=context)[0]
|
||||
for field in ['fiscalyear_id', 'chart_account_id', 'period_from', 'period_to']:
|
||||
if isinstance(data['form'][field], tuple):
|
||||
data['form'][field] = data['form'][field][0]
|
||||
used_context = self._build_contexts(cr, uid, ids, data, context=context)
|
||||
data['form']['periods'] = used_context.get('periods', False) and used_context['periods'] or []
|
||||
data['form']['used_context'] = used_context
|
||||
|
|
|
@ -54,21 +54,19 @@ class account_tax_chart(osv.osv_memory):
|
|||
period_obj = self.pool.get('account.period')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_tax_code_tree')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
if data['period_id']:
|
||||
fiscalyear_id = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['fiscalyear_id'][0]
|
||||
result['context'] = str({'period_id': data['period_id'], \
|
||||
'fiscalyear_id': fiscalyear_id, \
|
||||
'state': data['target_move']})
|
||||
else:
|
||||
result['context'] = str({'state': data['target_move']})
|
||||
|
||||
if data['period_id']:
|
||||
period_code = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['code']
|
||||
if data.period_id:
|
||||
result['context'] = str({'period_id': data.period_id.id, \
|
||||
'fiscalyear_id': data.period_id.fiscalyear_id.id, \
|
||||
'state': data.target_move})
|
||||
period_code = data.period_id.code
|
||||
result['name'] += period_code and (':' + period_code) or ''
|
||||
else:
|
||||
result['context'] = str({'state': data.target_move})
|
||||
|
||||
return result
|
||||
|
||||
_defaults = {
|
||||
|
@ -78,4 +76,4 @@ class account_tax_chart(osv.osv_memory):
|
|||
|
||||
account_tax_chart()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -33,8 +33,8 @@ class validate_account_move(osv.osv_memory):
|
|||
obj_move = self.pool.get('account.move')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data['journal_id']),('period_id','=',data['period_id'])])
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data.journal_id.id),('period_id','=',data.period_id.id)])
|
||||
if not ids_move:
|
||||
raise osv.except_osv(_('Warning'), _('Specified Journal does not have any account move entries in draft state for this period'))
|
||||
obj_move.button_validate(cr, uid, ids_move, context=context)
|
||||
|
|
|
@ -46,7 +46,10 @@ class account_vat_declaration(osv.osv_memory):
|
|||
context = {}
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
datas['model'] = 'account.tax.code'
|
||||
datas['form'] = self.read(cr, uid, ids)[0]
|
||||
datas['form'] = self.read(cr, uid, ids, context=context)[0]
|
||||
for field in datas['form'].keys():
|
||||
if isinstance(datas['form'][field], tuple):
|
||||
datas['form'][field] = datas['form'][field][0]
|
||||
datas['form']['company_id'] = self.pool.get('account.tax.code').browse(cr, uid, [datas['form']['chart_tax_id']], context=context)[0].company_id.id
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
|
|
|
@ -45,6 +45,7 @@ class account_crossovered_analytic(osv.osv_memory):
|
|||
acc_ids = [x[0] for x in res]
|
||||
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data['ref'] = data['ref'][0]
|
||||
|
||||
obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'], context=context)
|
||||
name = obj_acc.name
|
||||
|
@ -72,4 +73,4 @@ class account_crossovered_analytic(osv.osv_memory):
|
|||
|
||||
account_crossovered_analytic()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -69,14 +69,14 @@ class account_coda_import(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
|
||||
codafile = data['coda']
|
||||
journal_code = journal_obj.browse(cr, uid, data['journal_id'], context=context).code
|
||||
codafile = data.coda
|
||||
journal_code = data.journal_id.code
|
||||
|
||||
period = account_period_obj.find(cr, uid, context=context)[0]
|
||||
def_pay_acc = data['def_payable']
|
||||
def_rec_acc = data['def_receivable']
|
||||
def_pay_acc = data.def_payable.id
|
||||
def_rec_acc = data.def_receivable.id
|
||||
|
||||
err_log = "Errors:\n------\n"
|
||||
nb_err=0
|
||||
|
@ -96,7 +96,7 @@ class account_coda_import(osv.osv_memory):
|
|||
bank_statement["bank_statement_line"]={}
|
||||
bank_statement_lines = {}
|
||||
bank_statement['date'] = str2date(line[5:11])
|
||||
bank_statement['journal_id']=data['journal_id']
|
||||
bank_statement['journal_id']=data.journal_id.id
|
||||
period_id = account_period_obj.search(cr, uid, [('date_start', '<=', time.strftime('%Y-%m-%d', time.strptime(bank_statement['date'], "%y/%m/%d"))), ('date_stop', '>=', time.strftime('%Y-%m-%d', time.strptime(bank_statement['date'], "%y/%m/%d")))])
|
||||
bank_statement['period_id'] = period_id and period_id[0] or False
|
||||
bank_statement['state']='draft'
|
||||
|
@ -144,7 +144,7 @@ class account_coda_import(osv.osv_memory):
|
|||
bank_statement["bank_statement_line"]=bank_statement_lines
|
||||
elif line[1] == '2':
|
||||
st_line_name = line[2:6]
|
||||
bank_statement_lines[st_line_name].update({'account_id': data['awaiting_account']})
|
||||
bank_statement_lines[st_line_name].update({'account_id': data.awaiting_account.id})
|
||||
|
||||
elif line[1] == '3':
|
||||
# movement data record 3.1
|
||||
|
@ -165,7 +165,7 @@ class account_coda_import(osv.osv_memory):
|
|||
else:
|
||||
nb_err += 1
|
||||
err_log += _('The bank account %s is not defined for the partner %s.\n')%(cntry_number, contry_name)
|
||||
bank_statement_lines[st_line_name].update({'account_id': data['awaiting_account']})
|
||||
bank_statement_lines[st_line_name].update({'account_id': data.awaiting_account.id})
|
||||
|
||||
bank_statement["bank_statement_line"]=bank_statement_lines
|
||||
elif line[0]=='3':
|
||||
|
@ -296,7 +296,7 @@ class account_coda_import(osv.osv_memory):
|
|||
'name': codafile,
|
||||
'statement_ids': [(6, 0, bkst_list,)],
|
||||
'note': str_log1+str_not+std_log+err_log,
|
||||
'journal_id': data['journal_id'],
|
||||
'journal_id': data.journal_id.id,
|
||||
'date': time.strftime("%Y-%m-%d"),
|
||||
'user_id': uid,
|
||||
})
|
||||
|
@ -336,4 +336,4 @@ class account_coda_import(osv.osv_memory):
|
|||
|
||||
account_coda_import()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -48,10 +48,10 @@ class account_followup_print(osv.osv_memory):
|
|||
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
context.update({'followup_id': data['followup_id'], 'date':data['date']})
|
||||
context.update({'followup_id': data.followup_id.id, 'date':data.date})
|
||||
return {
|
||||
'name': _('Select Partners'),
|
||||
'view_type': 'form',
|
||||
|
@ -146,7 +146,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
if ids:
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
cr.execute(
|
||||
"SELECT l.partner_id, l.followup_line_id,l.date_maturity, l.date, l.id "\
|
||||
"FROM account_move_line AS l "\
|
||||
|
@ -162,8 +162,8 @@ class account_followup_print_all(osv.osv_memory):
|
|||
move_lines = cr.fetchall()
|
||||
old = None
|
||||
fups = {}
|
||||
fup_id = 'followup_id' in context and context['followup_id'] or data['followup_id']
|
||||
date = 'date' in context and context['date'] or data['date']
|
||||
fup_id = 'followup_id' in context and context['followup_id'] or data.followup_id.id
|
||||
date = 'date' in context and context['date'] or data.date
|
||||
|
||||
current_date = datetime.date(*time.strptime(date,
|
||||
'%Y-%m-%d')[:3])
|
||||
|
@ -208,14 +208,15 @@ class account_followup_print_all(osv.osv_memory):
|
|||
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
partner_ids = [partner_id.id for partner_id in data.partner_ids]
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all_msg')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
if data['email_conf']:
|
||||
if data.email_conf:
|
||||
msg_sent = ''
|
||||
msg_unsent = ''
|
||||
data_user = user_obj.browse(cr, uid, uid, context=context)
|
||||
move_lines = line_obj.browse(cr, uid, data['partner_ids'], context=context)
|
||||
move_lines = line_obj.browse(cr, uid, partner_ids, context=context)
|
||||
partners = []
|
||||
dict_lines = {}
|
||||
for line in move_lines:
|
||||
|
@ -235,8 +236,8 @@ class account_followup_print_all(osv.osv_memory):
|
|||
if adr.email:
|
||||
dest = [adr.email]
|
||||
src = tools.config.options['email_from']
|
||||
if not data['partner_lang']:
|
||||
body = data['email_body']
|
||||
if not data.partner_lang:
|
||||
body = data.email_body
|
||||
else:
|
||||
cxt = context.copy()
|
||||
cxt['lang'] = partner.lang
|
||||
|
@ -272,7 +273,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
'date':time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
body = body%val
|
||||
sub = tools.ustr(data['email_subject'])
|
||||
sub = tools.ustr(data.email_subject)
|
||||
msg = ''
|
||||
if dest:
|
||||
try:
|
||||
|
|
|
@ -37,7 +37,8 @@ class account_invoice_with_message(report_sxw.rml_parse):
|
|||
self.context = context
|
||||
|
||||
def spcl_msg(self, form):
|
||||
account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, form['message'])
|
||||
msg_id = form['message'][0]
|
||||
account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, msg_id)
|
||||
msg = account_msg_data.msg
|
||||
return msg
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ class payment_order_create(osv.osv_memory):
|
|||
payment_obj = self.pool.get('payment.line')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
line_ids = data['entries']
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
line_ids = [entry.id for entry in data.entries]
|
||||
if not line_ids:
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
@ -97,8 +97,8 @@ class payment_order_create(osv.osv_memory):
|
|||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
search_due_date = data['duedate']
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
search_due_date = data.duedate
|
||||
# payment = self.pool.get('payment.order').browse(cr, uid, context['active_id'], context=context)
|
||||
|
||||
# Search for move line to pay:
|
||||
|
|
|
@ -70,10 +70,10 @@ class board_menu_create(osv.osv_memory):
|
|||
})
|
||||
obj_menu = self.pool.get('ir.ui.menu')
|
||||
#start Loop
|
||||
for data in self.read(cr, uid, ids):
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
obj_menu.create(cr, uid, {
|
||||
'name': data.get('menu_name'),
|
||||
'parent_id': data.get('menu_parent_id'),
|
||||
'name': data.menu_name,
|
||||
'parent_id': data.menu_parent_id.id,
|
||||
'icon': 'STOCK_SELECT_COLOR',
|
||||
'action': 'ir.actions.act_window,' + str(action_id)
|
||||
}, context=context)
|
||||
|
|
|
@ -77,7 +77,7 @@ class job2phonecall(osv.osv_memory):
|
|||
phonecall_case_obj = self.pool.get('crm.phonecall')
|
||||
if context is None:
|
||||
context = {}
|
||||
form = self.read(cr, uid, ids, [], context=context)[0]
|
||||
form = self.browse(cr, uid, ids, context=context)[0]
|
||||
result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'], context=context)
|
||||
# Select the view
|
||||
|
@ -93,10 +93,10 @@ class job2phonecall(osv.osv_memory):
|
|||
#TODO: Take other info from job
|
||||
new_phonecall_id = phonecall_case_obj.create(cr, uid, {
|
||||
'name': job.name,
|
||||
'user_id': form['user_id'],
|
||||
'categ_id': form['category_id'],
|
||||
'description': form['note'],
|
||||
'date': form['deadline'],
|
||||
'user_id': form.user_id.id,
|
||||
'categ_id': form.category_id.id,
|
||||
'description': form.note,
|
||||
'date': form.deadline,
|
||||
'description': job.description,
|
||||
'partner_id': job.partner_id.id,
|
||||
'partner_address_id': job.partner_address_id.id,
|
||||
|
|
|
@ -31,7 +31,7 @@ class analytical_timesheet_employee(osv.osv_memory):
|
|||
'Month', required=True),
|
||||
'year': fields.integer('Year', required=True),
|
||||
'employee_id': fields.many2one('hr.employee', 'Employee', required=True)
|
||||
|
||||
|
||||
}
|
||||
|
||||
def _get_user(self, cr, uid, context=None):
|
||||
|
@ -50,6 +50,7 @@ class analytical_timesheet_employee(osv.osv_memory):
|
|||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
data['employee_id'] = data['employee_id'][0]
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
|
|
|
@ -58,7 +58,9 @@ class final_invoice_create(osv.osv_memory):
|
|||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'], context=context)
|
||||
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
balance_product = data.balance_product.id
|
||||
|
||||
account_ids = 'active_ids' in context and context['active_ids'] or []
|
||||
|
||||
for account in analytic_account_obj.browse(cr, uid, account_ids, context=context):
|
||||
|
@ -143,9 +145,9 @@ class final_invoice_create(osv.osv_memory):
|
|||
}
|
||||
invoice_line_obj.create(cr, uid, curr_line, context=context)
|
||||
|
||||
if not data['balance_product']:
|
||||
if not balance_product:
|
||||
raise osv.except_osv(_('Balance product needed'), _('Please fill a Balance product in the wizard'))
|
||||
product = product_obj.browse(cr, uid, data['balance_product'], context2)
|
||||
product = product_obj.browse(cr, uid, balance_product, context=context2)
|
||||
taxes = product.taxes_id
|
||||
tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes)
|
||||
account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id
|
||||
|
@ -180,4 +182,4 @@ class final_invoice_create(osv.osv_memory):
|
|||
|
||||
final_invoice_create()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -46,8 +46,8 @@ class lunch_order_confirm(osv.osv_memory):
|
|||
data = context and context.get('active_ids', []) or []
|
||||
order_ref = self.pool.get('lunch.order')
|
||||
|
||||
for confirm_obj in self.read(cr, uid, ids):
|
||||
order_ref.confirm(cr, uid, data, confirm_obj['confirm_cashbox'], context)
|
||||
for confirm_obj in self.browse(cr, uid, ids, context=context):
|
||||
order_ref.confirm(cr, uid, data, confirm_obj.confirm_cashbox.id, context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
lunch_order_confirm()
|
||||
|
|
|
@ -70,10 +70,10 @@ class mrp_product_produce(osv.osv_memory):
|
|||
context = {}
|
||||
prod_obj = self.pool.get('mrp.production')
|
||||
move_ids = context.get('active_ids', [])
|
||||
for data in self.read(cr, uid, ids, context=context):
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
for move_id in move_ids:
|
||||
prod_obj.action_produce(cr, uid, move_id,
|
||||
data['product_qty'], data['mode'], context=context)
|
||||
data.product_qty, data.mode, context=context)
|
||||
return {}
|
||||
|
||||
mrp_product_produce()
|
||||
|
|
|
@ -149,6 +149,8 @@ class pos_make_payment(osv.osv_memory):
|
|||
order = order_obj.browse(cr, uid, active_id, context=context)
|
||||
amount = order.amount_total - order.amount_paid
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
for m2o_field in ['product_id','pricelist_id','partner_id']:
|
||||
data[m2o_field] = data[m2o_field][0]
|
||||
partner = obj_partner.browse(cr, uid, data['partner_id'], context=context)
|
||||
if not partner.address:
|
||||
raise osv.except_osv(_('Error!'),_("Customer doesn't have an address to make the invoice"))
|
||||
|
|
|
@ -279,8 +279,8 @@ class add_product(osv.osv_memory):
|
|||
data = return_boj.read(cr,uid,return_id,[])[0]
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
self_data = self.read(cr, uid, ids)[0]
|
||||
order_obj.add_product(cr, uid, active_ids[0], self_data['product_id'], self_data['quantity'], context=context)
|
||||
self_data = self.browse(cr, uid, ids, context=context)[0]
|
||||
order_obj.add_product(cr, uid, active_ids[0], self_data.product_id.id, self_data.quantity, context=context)
|
||||
|
||||
for order_id in order_obj.browse(cr, uid, active_ids, context=context):
|
||||
stock_dest_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
|
||||
|
|
|
@ -53,6 +53,7 @@ class product_price_list(osv.osv_memory):
|
|||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context=context)
|
||||
res = res and res[0] or {}
|
||||
res['price_list'] = res['price_list'][0]
|
||||
datas['form'] = res
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
|
|
|
@ -105,6 +105,7 @@ class project_task_delegate(osv.osv_memory):
|
|||
task_id = context.get('active_id', False)
|
||||
task_pool = self.pool.get('project.task')
|
||||
delegate_data = self.read(cr, uid, ids, context=context)[0]
|
||||
delegate_data['user_id'] = delegate_data['user_id'][0]
|
||||
delegate_data['name'] = tools.ustr(delegate_data['name'])
|
||||
task_pool.do_delegate(cr, uid, task_id, delegate_data, context=context)
|
||||
return {}
|
||||
|
|
|
@ -35,6 +35,8 @@ class backlog_create_task(osv.osv_memory):
|
|||
ids_task = []
|
||||
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data['user_id'] = data['user_id'][0]
|
||||
|
||||
backlogs = backlog_id.browse(cr, uid, context['active_ids'], context=context)
|
||||
result = mod_obj._get_id(cr, uid, 'project', 'view_task_search_form')
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
|
|
@ -66,15 +66,14 @@ class project_scrum_backlog_merge(osv.osv_memory):
|
|||
context = {}
|
||||
#This will check product backlog's project id if different then will accept a new id provided by the user.
|
||||
if 'scrum_projects' in context:
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
if data['project_id'] == False:
|
||||
data = self.browse(cr, uid, ids, [])[0]
|
||||
if data.project_id.id == False:
|
||||
raise osv.except_osv(_('Warning'),_('Please select any Project.'))
|
||||
new_project_id = data['project_id']
|
||||
new_project_id = data.project_id.id
|
||||
else:
|
||||
p_id = backlog_obj.read(cr, uid, context['active_id'], ['project_id'])
|
||||
new_project_id = p_id['project_id'][0]
|
||||
#To merge note and description of backlogs
|
||||
|
||||
new_note = ''
|
||||
new_description = ''
|
||||
for backlogs in backlog_obj.browse(cr, uid, context['active_ids'], context=context):
|
||||
|
@ -93,7 +92,6 @@ class project_scrum_backlog_merge(osv.osv_memory):
|
|||
'project_id': new_project_id,
|
||||
'expected_hours': round(max(new_exp_hour))
|
||||
}, context=context)
|
||||
|
||||
#To assing a new product backlog to merged tasks
|
||||
task_obj.write(cr, uid, task_lines, {'product_backlog_id': id_b})
|
||||
backlog_obj.unlink(cr, uid, context['active_ids'], context=context)
|
||||
|
|
|
@ -41,10 +41,10 @@ class backlog_sprint_assign(osv.osv_memory):
|
|||
backlog_ids = []
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
data = self.browse(cr, uid, ids,context=context)[0]
|
||||
for backlog in backlog_obj.browse(cr, uid, context['active_ids'], context=context):
|
||||
backlog_ids.append(backlog.id)
|
||||
if data['convert_to_task']:
|
||||
if data.convert_to_task:
|
||||
task_id = task.create(cr, uid, {
|
||||
'product_backlog_id': backlog.id,
|
||||
'name': backlog.name,
|
||||
|
@ -56,12 +56,12 @@ class backlog_sprint_assign(osv.osv_memory):
|
|||
})
|
||||
message = _('Product Backlog') + " '" + backlog.name + "' "+ _("is converted into Task %d."%(task_id,))
|
||||
self.log(cr, uid, backlog.id, message)
|
||||
if data['state_open'] and backlog.state == "draft":
|
||||
if data.state_open and backlog.state == "draft":
|
||||
backlog_obj.write(cr, uid, backlog.id, {'state':'open'})
|
||||
sprint = sprint_obj.browse(cr, uid, data['sprint_id'], context=context)
|
||||
sprint = sprint_obj.browse(cr, uid, data.sprint_id.id, context=context)
|
||||
message = _('Product Backlog') + " '" + backlog.name + "' "+ _("is assigned sprint:%s"%(sprint.name))
|
||||
self.log(cr, uid, backlog.id, message)
|
||||
backlog_obj.write(cr, uid, backlog_ids, {'sprint_id': data['sprint_id']}, context=context)
|
||||
backlog_obj.write(cr, uid, backlog_ids, {'sprint_id': data.sprint_id.id}, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
backlog_sprint_assign()
|
||||
|
|
|
@ -67,7 +67,7 @@ class purchase_requisition_partner(osv.osv_memory):
|
|||
context = {}
|
||||
record_ids = context and context.get('active_ids', False)
|
||||
if record_ids:
|
||||
data = self.read(cr, uid, ids)
|
||||
data = self.browse(cr, uid, ids,context=context)[0]
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
|
||||
order_obj = self.pool.get('purchase.order')
|
||||
order_line_obj = self.pool.get('purchase.order.line')
|
||||
|
@ -77,10 +77,8 @@ class purchase_requisition_partner(osv.osv_memory):
|
|||
prod_obj = self.pool.get('product.product')
|
||||
tender_obj = self.pool.get('purchase.requisition')
|
||||
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)
|
||||
|
||||
partner_id = data.partner_id.id
|
||||
supplier_data = data.partner_id
|
||||
address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
|
||||
list_line=[]
|
||||
purchase_order_line={}
|
||||
|
|
|
@ -115,7 +115,7 @@ class stock_invoice_onshipping(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
picking_pool = self.pool.get('stock.picking')
|
||||
onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'], context=context)
|
||||
onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'])
|
||||
if context.get('new_picking', False):
|
||||
onshipdata_obj['id'] = onshipdata_obj.new_picking
|
||||
onshipdata_obj[ids] = onshipdata_obj.new_picking
|
||||
|
@ -127,7 +127,7 @@ class stock_invoice_onshipping(osv.osv_memory):
|
|||
res = picking_pool.action_invoice_create(cr, uid, active_ids,
|
||||
journal_id = onshipdata_obj[0]['journal_id'],
|
||||
group = onshipdata_obj[0]['group'],
|
||||
type = context.get('inv_type'),
|
||||
type = None,
|
||||
context=context)
|
||||
return res
|
||||
|
||||
|
|
|
@ -55,10 +55,9 @@ class survey_print(osv.osv_memory):
|
|||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for print survey form.
|
||||
"""
|
||||
|
||||
datas = {'ids' : self.read(cr, uid, ids, [], context)[0]['survey_ids']}
|
||||
datas = {'ids' : self.read(cr, uid, ids, ['survey_ids'], context=context)[0]['survey_ids']}
|
||||
res = self.read(cr, uid, ids, ['survey_title', 'orientation', 'paper_size',\
|
||||
'page_number', 'without_pagebreak'], context)
|
||||
'page_number', 'without_pagebreak'], context=context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['model'] = 'survey.print'
|
||||
|
|
|
@ -59,7 +59,7 @@ class survey_print_answer(osv.osv_memory):
|
|||
context = {}
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size',\
|
||||
'page_number', 'without_pagebreak'], context)
|
||||
'page_number', 'without_pagebreak'], context=context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['model'] = 'survey.print.answer'
|
||||
|
|
|
@ -44,7 +44,7 @@ class survey_print_statistics(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['survey_ids'], context)
|
||||
res = self.read(cr, uid, ids, ['survey_ids'], context=context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['model'] = 'survey.print.statistics'
|
||||
|
|
|
@ -122,8 +122,7 @@ class survey_name_wiz(osv.osv_memory):
|
|||
search_obj = self.pool.get('ir.ui.view')
|
||||
if context is None: context = {}
|
||||
|
||||
sur_id = self.read(cr, uid, ids, [])[0]
|
||||
survey_id = sur_id['survey_id']
|
||||
survey_id = self.browse(cr, uid, ids, context=context)[0].survey_id.id
|
||||
context.update({'survey_id': survey_id, 'sur_name_id': sur_id['id']})
|
||||
cr.execute('select count(id) from survey_history where user_id=%s\
|
||||
and survey_id=%s' % (uid,survey_id))
|
||||
|
@ -133,8 +132,8 @@ class survey_name_wiz(osv.osv_memory):
|
|||
if user_limit and res >= user_limit:
|
||||
raise osv.except_osv(_('Warning !'),_("You can not give response for this survey more than %s times") % (user_limit))
|
||||
|
||||
sur_rec = survey_obj.read(cr,uid,self.read(cr,uid,ids)[0]['survey_id'])
|
||||
if sur_rec['max_response_limit'] and sur_rec['max_response_limit'] <= sur_rec['tot_start_survey']:
|
||||
sur_rec = survey_obj.browse(cr,uid,ids,context=context)[0]
|
||||
if sur_rec.max_response_limit and sur_rec.max_response_limit <= sur_rec.tot_start_survey:
|
||||
raise osv.except_osv(_('Warning !'),_("You can not give more response. Please contact the author of this survey for further assistance."))
|
||||
|
||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||
|
|
|
@ -96,7 +96,7 @@ class survey_send_invitation(osv.osv_memory):
|
|||
def action_send(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
record = self.read(cr, uid, ids, [])
|
||||
record = self.read(cr, uid, ids, [],context=context)
|
||||
survey_ids = context.get('active_ids', [])
|
||||
record = record and record[0]
|
||||
partner_ids = record['partner_ids']
|
||||
|
|
Loading…
Reference in New Issue