From 44300bb3be8dcadbb9455ebc86a99653bd2cb6a4 Mon Sep 17 00:00:00 2001 From: "Ferdinand@Camptocamp" <> Date: Tue, 16 Nov 2010 09:44:16 +0530 Subject: [PATCH 1/3] [FIX] Account: performance account_move_line needs index on partner_id lp bug: https://launchpad.net/bugs/571595 fixed bzr revid: mra@mra-laptop-20101116041416-zonccm8lg9dvf2at --- addons/account/account_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 89f86d902f2..e302aca3895 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -436,7 +436,7 @@ class account_move_line(osv.osv): 'period_id': fields.many2one('account.period', 'Period', required=True, select=2), 'journal_id': fields.many2one('account.journal', 'Journal', required=True, select=1), 'blocked': fields.boolean('Litigation', help="You can check this box to mark this journal item as a litigation with the associated partner"), - 'partner_id': fields.many2one('res.partner', 'Partner'), + 'partner_id': fields.many2one('res.partner', 'Partner', select=1), 'date_maturity': fields.date('Due date', help="This field is used for payable and receivable journal entries. You can put the limit date for the payment of this line."), 'date': fields.related('move_id','date', string='Effective date', type='date', required=True, store = { From 87372a16dea552b4113d4877f1bbfd9df0532551 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 16 Nov 2010 09:57:28 +0530 Subject: [PATCH 2/3] [FIX] Account: Bug in fields_view_get in invoice.py lp bug: https://launchpad.net/bugs/672626 fixed bzr revid: mra@mra-laptop-20101116042728-eeglnqomskwd18z3 --- addons/account/invoice.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 8df0318bf22..f965b405545 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -326,16 +326,18 @@ class account_invoice(osv.osv): def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): journal_obj = self.pool.get('account.journal') - if context.get('active_model','') in ['res.partner']: - partner = self.pool.get(context['active_model']).read(cr,uid,context['active_ids'],['supplier','customer'])[0] + if context is None: + context = {} + if context.get('active_model', '') in ['res.partner'] and context.get('active_ids', False) and context['active_ids']: + partner = self.pool.get(context['active_model']).read(cr, uid, context['active_ids'], ['supplier','customer'])[0] if not view_type: - view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.tree')])[0] + view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'account.invoice.tree')])[0] view_type = 'tree' if view_type == 'form': if partner['supplier'] and not partner['customer']: - view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0] + view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.supplier.form')])[0] else: - view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0] + view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.form')])[0] res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) type = context.get('journal_type', 'sale') for field in res['fields']: From 2deaf2ef76e80e6b6b1dc52dd6fa94bc7dfb039d Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 16 Nov 2010 10:08:09 +0530 Subject: [PATCH 3/3] [FIX] Account: add select=1 on move_id field of account_invoice and of code field of account_account lp bug: https://launchpad.net/bugs/571610 fixed bzr revid: mra@mra-laptop-20101116043809-m5fxcb5mj4z62dg9 --- addons/account/account.py | 4 ++-- addons/account/invoice.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 0f8c9575931..e35676e08a5 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -344,7 +344,7 @@ class account_account(osv.osv): _columns = { 'name': fields.char('Name', size=128, required=True, select=True), 'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."), - 'code': fields.char('Code', size=64, required=True), + 'code': fields.char('Code', size=64, required=True, select=1), 'type': fields.selection([ ('view', 'View'), ('other', 'Regular'), @@ -2254,7 +2254,7 @@ class account_account_template(osv.osv): _columns = { 'name': fields.char('Name', size=128, required=True, select=True), 'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."), - 'code': fields.char('Code', size=64), + 'code': fields.char('Code', size=64, select=1), 'type': fields.selection([ ('receivable','Receivable'), ('payable','Payable'), diff --git a/addons/account/invoice.py b/addons/account/invoice.py index f965b405545..af26e7d2d28 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -263,7 +263,7 @@ class account_invoice(osv.osv): 'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}), 'tax_line': fields.one2many('account.invoice.tax', 'invoice_id', 'Tax Lines', readonly=True, states={'draft':[('readonly',False)]}), - 'move_id': fields.many2one('account.move', 'Journal Entry', readonly=True, help="Link to the automatically generated Journal Items."), + 'move_id': fields.many2one('account.move', 'Journal Entry', readonly=True, select=1, help="Link to the automatically generated Journal Items."), 'amount_untaxed': fields.function(_amount_all, method=True, digits_compute=dp.get_precision('Account'), string='Untaxed', store={ 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),