[FIX] account: split the actions to open analytic accounts, as context is not compatible

The same action was erroneously used in two incompatible
cases: once for openining the list of analytic accounts
from a partner form view (requires a special context
with a client-side `active_id` variable) and the second
one for the main Analytic Account menu item (which
cannot have `active_id` in the context - it would crash).

The fix includes setting an empty ({}) context explicitly
on the original action to be sure the incorrect context
is removed upon update.


The error was introduced at rev.8685
revid:qdp-launchpad@openerp.com-20130418125951-8p0tfexd9jj8l75b

bzr revid: odo@openerp.com-20130507165113-67lam91046t56ky8
This commit is contained in:
Olivier Dony 2013-05-07 18:51:13 +02:00
parent 54ad990e48
commit 325f710360
3 changed files with 6 additions and 4 deletions

View File

@ -99,7 +99,6 @@ for a particular financial year and for preparation of vouchers there is a modul
'project/wizard/project_account_analytic_line_view.xml',
'account_end_fy.xml',
'account_invoice_view.xml',
'partner_view.xml',
'data/account_data.xml',
'data/data_account_type.xml',
'data/configurable_account_chart.xml',
@ -112,6 +111,7 @@ for a particular financial year and for preparation of vouchers there is a modul
'project/wizard/account_analytic_journal_report_view.xml',
'project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml',
'project/wizard/account_analytic_chart_view.xml',
'partner_view.xml',
'product_view.xml',
'account_assert_test.xml',
'process/statement_process.xml',

View File

@ -50,11 +50,12 @@
</field>
</record>
<record id="action_account_analytic_account_form" model="ir.actions.act_window">
<record id="action_open_partner_analytic_accounts" model="ir.actions.act_window">
<field name="context">{'search_default_partner_id': [active_id], 'default_partner_id': active_id}</field>
<field name="name">Contracts/Analytic Accounts</field>
<field name="res_model">account.analytic.account</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_account_analytic_account_tree"/>
<field name="search_view_id" ref="view_account_analytic_account_search"/>
</record>
<record model="ir.ui.view" id="partner_view_buttons">
<field name="name">partner.view.buttons</field>
@ -67,7 +68,7 @@
name="%(account.action_invoice_tree)d"
context="{'search_default_partner_id': active_id,'default_partner_id': active_id}" groups="account.group_account_invoice"/>
<button type="action" string="Journal Items" name="%(account.action_account_moves_all_tree)d" groups="account.group_account_user"/>
<button type="action" string="Contracts/Analytic Accounts" name="%(account.action_account_analytic_account_form)d"
<button type="action" string="Contracts/Analytic Accounts" name="%(account.action_open_partner_analytic_accounts)d"
groups="analytic.group_analytic_accounting"/>
</xpath>
</field>

View File

@ -77,6 +77,7 @@
<field name="name">Analytic Accounts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.analytic.account</field>
<field name="context">{}</field> <!-- repair invalid context by setting empty one -->
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_account_analytic_account_tree"/>