diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py index 13fef1fde0d..432a430868c 100644 --- a/addons/account/wizard/account_automatic_reconcile.py +++ b/addons/account/wizard/account_automatic_reconcile.py @@ -144,9 +144,6 @@ class account_automatic_reconcile(osv.osv_memory): if context is None: context = {} form = self.read(cr, uid, ids, [])[0] - for m2o_field in ['journal_id','period_id','writeoff_acc_id']: - if form[m2o_field] and isinstance(form[m2o_field], tuple): - form[m2o_field] = form[m2o_field][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'] @@ -255,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: \ No newline at end of file diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py index 223ba327343..d915a1cd34b 100644 --- a/addons/account/wizard/account_change_currency.py +++ b/addons/account/wizard/account_change_currency.py @@ -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.browse(cr, uid, ids)[0] - new_currency = data.currency_id.id + data = self.read(cr, uid, ids)[0] + new_currency = data['currency_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: \ No newline at end of file diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py index 58526b30b0a..e8f0e432d69 100644 --- a/addons/account/wizard/account_chart.py +++ b/addons/account/wizard/account_chart.py @@ -79,17 +79,17 @@ class account_chart(osv.osv_memory): fy_obj = self.pool.get('account.fiscalyear') if context is None: context = {} - data = self.browse(cr, uid, ids, context=context)[0] + data = self.read(cr, uid, ids, [], context=context)[0] result = mod_obj.get_object_reference(cr, uid, 'account', 'action_account_tree') id = result and result[1] or False result = act_obj.read(cr, uid, [id], context=context)[0] result['periods'] = [] - if data.period_from and data.period_to: - result['periods'] = period_obj.build_ctx_periods(cr, uid, data.period_from.id, data.period_to.id) - result['context'] = str({'fiscalyear': data.fiscalyear.id, 'periods': result['periods'], \ - 'state': data.target_move}) - if data.fiscalyear: - result['name'] += ':' + fy_obj.read(cr, uid, [data.fiscalyear.id], context=context)[0]['code'] + if data['period_from'] and data['period_to']: + result['periods'] = period_obj.build_ctx_periods(cr, uid, data['period_from'], data['period_to']) + result['context'] = str({'fiscalyear': data['fiscalyear'], 'periods': result['periods'], \ + 'state': data['target_move']}) + if data['fiscalyear']: + result['name'] += ':' + fy_obj.read(cr, uid, [data['fiscalyear']], context=context)[0]['code'] return result _defaults = { diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py index bd635839afb..6190f792c7f 100644 --- a/addons/account/wizard/account_fiscalyear_close.py +++ b/addons/account/wizard/account_fiscalyear_close.py @@ -56,10 +56,7 @@ 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) - for m2o_field in ['fy_id','fy2_id','journal_id','period_id']: - if isinstance(data[0][m2o_field], tuple): - data[0][m2o_field] = data[0][m2o_field][0] + data = self.read(cr, uid, ids, context=context) if context is None: context = {} diff --git a/addons/account/wizard/account_fiscalyear_close_state.py b/addons/account/wizard/account_fiscalyear_close_state.py index 30edce42077..abf054746ce 100644 --- a/addons/account/wizard/account_fiscalyear_close_state.py +++ b/addons/account/wizard/account_fiscalyear_close_state.py @@ -40,8 +40,8 @@ class account_fiscalyear_close_state(osv.osv_memory): @param ids: List of Account fiscalyear close state’s IDs """ - for data in self.browse(cr, uid, ids, context=context): - fy_id = data.fy_id.id + for data in self.read(cr, uid, ids, context=context): + fy_id = data['fy_id'] cr.execute('UPDATE account_journal_period ' \ 'SET state = %s ' \ @@ -61,4 +61,4 @@ class account_fiscalyear_close_state(osv.osv_memory): account_fiscalyear_close_state() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index edc2b1d99c9..672e2a28fba 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -95,8 +95,6 @@ class account_invoice_refund(osv.osv_memory): description = False company = res_users_obj.browse(cr, uid, uid, context=context).company_id journal_id = form.get('journal_id', False) - if isinstance(journal_id, tuple): - journal_id = journal_id[0] 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)) @@ -104,8 +102,6 @@ class account_invoice_refund(osv.osv_memory): 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 isinstance(period, tuple): - period = period[0] else: period = inv.period_id and inv.period_id.id or False @@ -221,4 +217,4 @@ class account_invoice_refund(osv.osv_memory): account_invoice_refund() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/wizard/account_move_bank_reconcile.py b/addons/account/wizard/account_move_bank_reconcile.py index 266c6e764b4..9be351ed440 100644 --- a/addons/account/wizard/account_move_bank_reconcile.py +++ b/addons/account/wizard/account_move_bank_reconcile.py @@ -41,15 +41,15 @@ class account_move_bank_reconcile(osv.osv_memory): """ if context is None: context = {} - data = self.browse(cr, uid, ids, context=context)[0] + data = self.read(cr, uid, ids, context=context)[0] cr.execute('select default_credit_account_id \ - from account_journal where id=%s', (data.journal_id.id,)) + from account_journal where id=%s', (data['journal_id'],)) account_id = cr.fetchone()[0] if not account_id: raise osv.except_osv(_('Error'), _('You have to define \ the bank account\nin the journal definition for reconciliation.')) return { - 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data.journal_id.id, account_id), + 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id), 'name': _('Standard Encoding'), 'view_type': 'form', 'view_mode': 'tree,form', @@ -61,4 +61,4 @@ the bank account\nin the journal definition for reconciliation.')) account_move_bank_reconcile() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/wizard/account_move_line_reconcile_select.py b/addons/account/wizard/account_move_line_reconcile_select.py index d0953bd83ba..8e57c57884d 100644 --- a/addons/account/wizard/account_move_line_reconcile_select.py +++ b/addons/account/wizard/account_move_line_reconcile_select.py @@ -39,9 +39,9 @@ class account_move_line_reconcile_select(osv.osv_memory): @return: dictionary of Open account move line window for reconcile on given account id """ - data = self.browse(cr, uid, ids, context=context)[0] + data = self.read(cr, uid, ids, context=context)[0] return { - 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data.account_id.id, + 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['account_id'], 'name': _('Reconciliation'), 'view_type': 'form', 'view_mode': 'tree,form', @@ -52,4 +52,4 @@ class account_move_line_reconcile_select(osv.osv_memory): account_move_line_reconcile_select() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/wizard/account_move_line_unreconcile_select.py b/addons/account/wizard/account_move_line_unreconcile_select.py index 084b93cdaa2..ad59493503d 100644 --- a/addons/account/wizard/account_move_line_unreconcile_select.py +++ b/addons/account/wizard/account_move_line_unreconcile_select.py @@ -28,9 +28,9 @@ class account_move_line_unreconcile_select(osv.osv_memory): 'account_id': fields.many2one('account.account','Account',required=True), } def action_open_window(self, cr, uid, ids, context=None): - data = self.browse(cr, uid, ids, context=context)[0] + data = self.read(cr, uid, ids, context=context)[0] return { - 'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data.account_id.id, + 'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data['account_id'], 'name': 'Unreconciliation', 'view_type': 'form', 'view_mode': 'tree,form', @@ -41,4 +41,4 @@ class account_move_line_unreconcile_select(osv.osv_memory): account_move_line_unreconcile_select() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py index 07da76733e4..8131f6a9668 100644 --- a/addons/account/wizard/account_reconcile.py +++ b/addons/account/wizard/account_reconcile.py @@ -152,13 +152,13 @@ class account_move_line_reconcile_writeoff(osv.osv_memory): period_obj = self.pool.get('account.period') if context is None: context = {} - data = self.browse(cr, uid, ids,context=context)[0] - account_id = data.writeoff_acc_id.id - context['date_p'] = data.date_p - journal_id = data.journal_id.id - context['comment'] = data.comment - if data.analytic_id: - context['analytic_id'] = data.analytic_id.id + data = self.read(cr, uid, ids,context=context)[0] + account_id = data['writeoff_acc_id'] + context['date_p'] = data['date_p'] + journal_id = data['journal_id'] + context['comment'] = data['comment'] + if data['analytic_id']: + context['analytic_id'] = data['analytic_id'] if context['date_p']: date = context['date_p'] @@ -173,4 +173,4 @@ class account_move_line_reconcile_writeoff(osv.osv_memory): account_move_line_reconcile_writeoff() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/wizard/account_tax_chart.py b/addons/account/wizard/account_tax_chart.py index fd9b887ee2b..9e02931f34d 100644 --- a/addons/account/wizard/account_tax_chart.py +++ b/addons/account/wizard/account_tax_chart.py @@ -54,20 +54,20 @@ class account_tax_chart(osv.osv_memory): period_obj = self.pool.get('account.period') if context is None: context = {} - data = self.browse(cr, uid, ids, context=context)[0] + data = self.read(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.id], context=context)[0]['fiscalyear_id'][0] - result['context'] = str({'period_id': data.period_id.id, \ + 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}) + 'state': data['target_move']}) else: - result['context'] = str({'state': data.target_move}) + result['context'] = str({'state': data['target_move']}) - if data.period_id: - period_code = period_obj.read(cr, uid, [data.period_id.id], context=context)[0]['code'] + if data['period_id']: + period_code = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['code'] result['name'] += period_code and (':' + period_code) or '' return result @@ -78,4 +78,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: \ No newline at end of file diff --git a/addons/account_analytic_plans/wizard/account_crossovered_analytic.py b/addons/account_analytic_plans/wizard/account_crossovered_analytic.py index 2974c160501..4eaca49e2ca 100644 --- a/addons/account_analytic_plans/wizard/account_crossovered_analytic.py +++ b/addons/account_analytic_plans/wizard/account_crossovered_analytic.py @@ -45,8 +45,6 @@ class account_crossovered_analytic(osv.osv_memory): acc_ids = [x[0] for x in res] data = self.read(cr, uid, ids, [], context=context)[0] - if isinstance(data['ref'],tuple): - data['ref'] = data['ref'][0] obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'], context=context) name = obj_acc.name @@ -74,4 +72,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: \ No newline at end of file diff --git a/addons/account_coda/wizard/account_coda_import.py b/addons/account_coda/wizard/account_coda_import.py index 309a647ef47..6d3743116db 100644 --- a/addons/account_coda/wizard/account_coda_import.py +++ b/addons/account_coda/wizard/account_coda_import.py @@ -69,14 +69,14 @@ class account_coda_import(osv.osv_memory): if context is None: context = {} - data = self.browse(cr, uid, ids)[0] + data = self.read(cr, uid, ids)[0] - codafile = data.coda - journal_code = journal_obj.browse(cr, uid, data.journal_id.id, context=context).code + codafile = data['coda'] + journal_code = journal_obj.browse(cr, uid, data['journal_id'], context=context).code period = account_period_obj.find(cr, uid, context=context)[0] - def_pay_acc = data.def_payable.id - def_rec_acc = data.def_receivable.id + def_pay_acc = data['def_payable'] + def_rec_acc = data['def_receivable'] 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.id + bank_statement['journal_id']=data['journal_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.id}) + bank_statement_lines[st_line_name].update({'account_id': data['awaiting_account']}) 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.id}) + bank_statement_lines[st_line_name].update({'account_id': data['awaiting_account']}) 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.id, + 'journal_id': data['journal_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: \ No newline at end of file diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index e8f5e976389..5d9c2da860f 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -48,10 +48,10 @@ class account_followup_print(osv.osv_memory): if context is None: context = {} - data = self.browse(cr, uid, ids, context=context)[0] + data = self.read(cr, uid, ids, [], context=context)[0] model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context) resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] - context.update({'followup_id': data.followup_id.id, 'date':data.date}) + context.update({'followup_id': data['followup_id'], 'date':data['date']}) return { 'name': _('Select Partners'), 'view_type': 'form', diff --git a/addons/account_invoice_layout/report/special_message_invoice.py b/addons/account_invoice_layout/report/special_message_invoice.py index 81298bb6a06..bac4a467ae1 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.py +++ b/addons/account_invoice_layout/report/special_message_invoice.py @@ -37,10 +37,7 @@ class account_invoice_with_message(report_sxw.rml_parse): self.context = context def spcl_msg(self, form): - msg_id = form['message'] - if isinstance(msg_id, (tuple,list)): - msg_id = msg_id[0] - account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, msg_id) + account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, form['message']) msg = account_msg_data.msg return msg diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py index becef387151..ecb6a7cb3a4 100644 --- a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py +++ b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py @@ -69,7 +69,7 @@ class job2phonecall(osv.osv_memory): phonecall_case_obj = self.pool.get('crm.phonecall') if context is None: context = {} - form = self.browse(cr, uid, ids, context=context)[0] + form = self.read(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 @@ -85,10 +85,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.id, - 'categ_id': form.category_id.id, - 'description': form.note, - 'date': form.deadline, + 'user_id': form['user_id'], + 'categ_id': form['category_id'], + 'description': form['note'], + 'date': form['deadline'], 'description': job.description, 'partner_id': job.partner_id.id, 'partner_address_id': job.partner_address_id.id, diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index b2c0b814375..f3f720687cf 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -63,13 +63,13 @@ class hr_timesheet_invoice_create(osv.osv_memory): if context is None: context = {} result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') - data = self.browse(cr, uid, ids, context=context)[0] + data = self.read(cr, uid, ids, [], context=context)[0] account_ids = {} for line in self.pool.get('account.analytic.line').browse(cr, uid, context['active_ids'], context=context): account_ids[line.account_id.id] = True - account_ids = account_ids.keys() #data.accounts + account_ids = account_ids.keys() #data['accounts'] for account in analytic_account_obj.browse(cr, uid, account_ids, context=context): partner = account.partner_id if (not partner) or not (account.pricelist_id): @@ -121,17 +121,17 @@ class hr_timesheet_invoice_create(osv.osv_memory): factor_name = '' factor = invoice_factor_obj.browse(cr, uid, factor_id, context2) - if not data.product: + if not data['product']: if factor.customer_name: factor_name = product.name+' - '+factor.customer_name else: factor_name = product.name else: - factor_name = product_obj.name_get(cr, uid, [data.product.id], context=context)[0][1] + factor_name = product_obj.name_get(cr, uid, [data['product']], context=context)[0][1] if account.pricelist_id: pl = account.pricelist_id.id - price = pro_price_obj.price_get(cr,uid,[pl], data.product.id or product_id, qty or 1.0, account.partner_id.id)[pl] + price = pro_price_obj.price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl] else: price = 0.0 @@ -145,7 +145,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): 'invoice_line_tax_id': [(6,0,tax )], 'invoice_id': last_invoice, 'name': factor_name, - 'product_id': data.product.id or product_id, + 'product_id': data['product'] or product_id, 'invoice_line_tax_id': [(6,0,tax)], 'uos_id': product.uom_id.id, 'account_id': account_id, @@ -162,14 +162,14 @@ class hr_timesheet_invoice_create(osv.osv_memory): for line in line_ids: # set invoice_line_note details = [] - if data.date: + if data['date']: details.append(line['date']) - if data.time: + if data['time']: if line['product_uom_id']: details.append("%s %s" % (line['unit_amount'], product_uom_obj.browse(cr, uid, [line['product_uom_id']],context2)[0].name)) else: details.append("%s" % (line['unit_amount'], )) - if data.name: + if data['name']: details.append(line['name']) note.append(u' - '.join(map(lambda x: unicode(x) or '',details))) diff --git a/addons/lunch/wizard/lunch_order_confirm.py b/addons/lunch/wizard/lunch_order_confirm.py index 3dee0c3fd0d..6014f14f510 100644 --- a/addons/lunch/wizard/lunch_order_confirm.py +++ b/addons/lunch/wizard/lunch_order_confirm.py @@ -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.browse(cr, uid, ids): - order_ref.confirm(cr, uid, data, confirm_obj.confirm_cashbox.id, context) + for confirm_obj in self.read(cr, uid, ids): + order_ref.confirm(cr, uid, data, confirm_obj['confirm_cashbox'], context) return {'type': 'ir.actions.act_window_close'} lunch_order_confirm() diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index df5456baa4a..a7b264c781e 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -119,11 +119,12 @@ class mrp_production_workcenter_line(osv.osv): @return: Nothing """ wf_service = netsvc.LocalService("workflow") + prod_obj_pool = self.pool.get('mrp.production') oper_obj = self.browse(cr, uid, ids)[0] prod_obj = oper_obj.production_id if action == 'start': if prod_obj.state =='confirmed': - self.pool.get('mrp.production').force_production(cr, uid, [prod_obj.id]) + prod_obj_pool.force_production(cr, uid, [prod_obj.id]) wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr) elif prod_obj.state =='ready': wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr) @@ -139,6 +140,9 @@ class mrp_production_workcenter_line(osv.osv): if line.state != 'done': flag = False if flag: + for production in prod_obj_pool.browse(cr, uid, [prod_obj.id], context= None): + if production.move_lines or production.move_created_ids: + prod_obj_pool.action_produce(cr,uid, production.id, production.product_qty, 'consume_produce', context = None) wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr) return @@ -244,10 +248,12 @@ class mrp_production(osv.osv): wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_start_working', cr) return super(mrp_production,self).action_in_production(cr, uid, ids) - def action_cancel(self, cr, uid, ids): + def action_cancel(self, cr, uid, ids, context=None): """ Cancels work order if production order is canceled. @return: Super method """ + if context is None: + context = {} obj = self.browse(cr, uid, ids)[0] wf_service = netsvc.LocalService("workflow") for workcenter_line in obj.workcenter_lines: diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index 6f9c2126a6d..8d8a6f8465a 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -148,9 +148,6 @@ 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']: - if data[m2o_field] and isinstance(data[m2o_field], (list,tuple)): - data[m2o_field] = data[m2o_field][0] if data['is_acc']: amount = self.pool.get('product.product').browse(cr, uid, data['product_id'], context=context).list_price diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py index 5db14e31358..810ef86ec7b 100644 --- a/addons/point_of_sale/wizard/pos_return.py +++ b/addons/point_of_sale/wizard/pos_return.py @@ -353,8 +353,8 @@ class add_product(osv.osv_memory): data = return_boj.read(cr,uid,return_id,[])[0] wf_service = netsvc.LocalService("workflow") - self_data = self.browse(cr, uid, ids)[0] - order_obj.add_product(cr, uid, active_ids[0], self_data.product_id.id, self_data.quantity, context=context) + 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) for order_id in order_obj.browse(cr, uid, active_ids, context=context): prop_ids =property_obj.search(cr, uid, [('name', '=', 'property_stock_customer')]) diff --git a/addons/product/product.py b/addons/product/product.py index 6e0ff11e674..0e2b2523cc3 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -139,7 +139,7 @@ class product_uom(osv.osv): context = {} if from_unit.category_id.id <> to_unit.category_id.id: if context.get('raise-exception', True): - raise osv.except_osv(_('Error !'), _('Conversion from Product UoM m to Default UoM PCE is not possible as they both belong to different Category!.')) + raise osv.except_osv(_('Error !'), _('Conversion from Product UoM %s to Default UoM %s is not possible as they both belong to different Category!.') % (from_unit.name,to_unit.name,)) else: return qty amount = qty / from_unit.factor diff --git a/addons/product/wizard/product_price.py b/addons/product/wizard/product_price.py index c797efae937..5a5327a3f6d 100644 --- a/addons/product/wizard/product_price.py +++ b/addons/product/wizard/product_price.py @@ -53,8 +53,6 @@ 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 {} - if isinstance(res['price_list'], (tuple,list)): - res['price_list'] = res['price_list'][0] datas['form'] = res return { 'type': 'ir.actions.report.xml', diff --git a/addons/product_margin/product_margin_view.xml b/addons/product_margin/product_margin_view.xml index a6d6eff5238..87022bdc44f 100644 --- a/addons/product_margin/product_margin_view.xml +++ b/addons/product_margin/product_margin_view.xml @@ -80,6 +80,9 @@ + + + diff --git a/addons/project/wizard/project_task_delegate.py b/addons/project/wizard/project_task_delegate.py index 16c3ec85653..72b32f7db68 100644 --- a/addons/project/wizard/project_task_delegate.py +++ b/addons/project/wizard/project_task_delegate.py @@ -105,8 +105,6 @@ 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] - if isinstance(delegate_data['user_id'], tuple): - 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 {} diff --git a/addons/project_gtd/wizard/project_gtd_fill.py b/addons/project_gtd/wizard/project_gtd_fill.py index 8c607cd12f3..7a36b3e6ead 100644 --- a/addons/project_gtd/wizard/project_gtd_fill.py +++ b/addons/project_gtd/wizard/project_gtd_fill.py @@ -50,10 +50,10 @@ class project_timebox_fill(osv.osv_memory): def process(self, cr, uid, ids, context=None): if not ids: return {} - data = self.browse(cr, uid, ids, context=context) - if not data[0].task_ids: + data = self.read(cr, uid, ids, [], context=context) + if not data[0]['task_ids']: return {} - self.pool.get('project.task').write(cr, uid, [x.id for x in data[0].task_ids], {'timebox_id':data[0].timebox_to_id.id}) + self.pool.get('project.task').write(cr, uid, data[0]['task_ids'], {'timebox_id':data[0]['timebox_to_id']}) return {'type': 'ir.actions.act_window_close'} project_timebox_fill() diff --git a/addons/project_long_term/wizard/project_compute_phases.py b/addons/project_long_term/wizard/project_compute_phases.py index b074f3c93e9..c07f1ae81be 100644 --- a/addons/project_long_term/wizard/project_compute_phases.py +++ b/addons/project_long_term/wizard/project_compute_phases.py @@ -45,12 +45,12 @@ class project_compute_phases(osv.osv_memory): Compute the phases for scheduling. """ project_pool = self.pool.get('project.project') - data = self.browse(cr, uid, ids, context=context)[0] - if not data.project_id and data.target_project == 'one': + data = self.read(cr, uid, ids, [], context=context)[0] + if not data['project_id'] and data['target_project'] == 'one': raise osv.except_osv(_('Error!'), _('Please Specify Project to be schedule')) - if data.project_id: # If project mentioned find its phases - project_ids = [data.project_id.id] + if data['project_id']: # If project mentioned find its phases + project_ids = [data['project_id']] else: # Else take all the draft,open,pending states phases project_ids = project_pool.search(cr, uid, [], context=context) @@ -69,7 +69,7 @@ class project_compute_phases(osv.osv_memory): id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id'] result = act_obj.read(cr, uid, [id], context=context)[0] result['target'] = 'current' - result['context'] = {"search_default_project_id":data.project_id.id or False, "default_project_id":data.project_id.id or False, "search_default_responsible_id":uid, "search_default_current": 1} + result['context'] = {"search_default_project_id":data['project_id'], "default_project_id":data['project_id'], "search_default_responsible_id":uid, "search_default_current": 1} return result project_compute_phases() diff --git a/addons/project_long_term/wizard/project_compute_tasks.py b/addons/project_long_term/wizard/project_compute_tasks.py index d5cc4eb5991..658350a27d2 100644 --- a/addons/project_long_term/wizard/project_compute_tasks.py +++ b/addons/project_long_term/wizard/project_compute_tasks.py @@ -37,8 +37,8 @@ class project_compute_tasks(osv.osv_memory): if context is None: context = {} context['compute_by'] = 'project' - data = self.browse(cr, uid, ids)[0] - project_id = data.project_id.id + data = self.read(cr, uid, ids, [])[0] + project_id = data['project_id'] project_pool.schedule_tasks(cr, uid, [project_id], context=context) return self._open_task_list(cr, uid, data, context=context) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index f2ef17a183d..1bea0d05225 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -170,7 +170,7 @@ class purchase_order(osv.osv): 'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True), 'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"), - 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', + 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', domain="[('partner_id', '!=', False)]", states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="Put an address if you want to deliver directly from the supplier to the customer." \ "In this case, it will remove the warehouse link and set the customer location." @@ -665,7 +665,6 @@ class purchase_order_line(osv.osv): 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} res = {} prod= self.pool.get('product.product').browse(cr, uid, product) - product_uom_pool = self.pool.get('product.uom') lang=False if partner_id: @@ -681,6 +680,11 @@ class purchase_order_line(osv.osv): date_order = time.strftime('%Y-%m-%d') qty = qty or 1.0 seller_delay = 0 + if uom: + uom1_cat = prod.uom_id.category_id.id + uom2_cat = product_uom_pool.browse(cr, uid, uom).category_id.id + if uom1_cat != uom2_cat: + uom = False prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id], context=context)[0][1] res = {} @@ -707,14 +711,13 @@ class purchase_order_line(osv.osv): 'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id), 'date_planned': date_planned or dt,'notes': notes or prod.description_purchase, 'product_qty': qty, - 'product_uom': uom}}) + 'product_uom': prod.uom_id.id}}) domain = {} taxes = self.pool.get('account.tax').browse(cr, uid,map(lambda x: x.id, prod.supplier_taxes_id)) fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False res['value']['taxes_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes) - - res2 = self.pool.get('product.uom').read(cr, uid, [uom], ['category_id']) + res2 = self.pool.get('product.uom').read(cr, uid, [prod.uom_id.id], ['category_id']) res3 = prod.uom_id.category_id.id domain = {'product_uom':[('category_id','=',res2[0]['category_id'][0])]} if res2[0]['category_id'][0] != res3: diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index cb83841f005..d20b9491b39 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -12,7 +12,7 @@ groups="group_purchase_manager" parent="base.menu_purchase_root" sequence="100"/> - @@ -29,22 +29,22 @@ parent="menu_purchase_config_pricelist" sequence="2" groups="base.group_extended"/> - - - - + @@ -216,7 +216,7 @@ - + diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py index d0bbc73863d..8cfdc648349 100644 --- a/addons/stock/wizard/stock_move.py +++ b/addons/stock/wizard/stock_move.py @@ -98,9 +98,9 @@ class stock_move_consume(osv.osv_memory): context = {} move_obj = self.pool.get('stock.move') move_ids = context['active_ids'] - for data in self.browse(cr, uid, ids): + for data in self.read(cr, uid, ids): move_obj.action_consume(cr, uid, move_ids, - data.product_qty, data.location_id.id, + data['product_qty'], data['location_id'], context=context) return {'type': 'ir.actions.act_window_close'} @@ -159,9 +159,9 @@ class stock_move_scrap(osv.osv_memory): context = {} move_obj = self.pool.get('stock.move') move_ids = context['active_ids'] - for data in self.browse(cr, uid, ids): + for data in self.read(cr, uid, ids): move_obj.action_scrap(cr, uid, move_ids, - data.product_qty, data.location_id.id, + data['product_qty'], data['location_id'], context=context) return {'type': 'ir.actions.act_window_close'}