improved support for analytics

This commit is contained in:
luc-demeyer
2015-05-31 17:43:24 +02:00
parent 46d2c5a06c
commit 12fa957847
3 changed files with 9 additions and 15 deletions

View File

@@ -22,7 +22,7 @@
{
'name': 'Journal Items Search Extension',
'version': '0.5',
'version': '0.6',
'license': 'AGPL-3',
'author': 'Noviat',
'category': 'Accounting & Finance',

View File

@@ -3,7 +3,7 @@
<data>
<record id="action_account_move_line_search_extension" model="ir.actions.act_window">
<field name="context">{'account_move_line_search_extension':1}</field>
<field name="context">{'account_move_line_search_extension': 1, 'analytic_journal_id': 1}</field>
<field name="name">Journal Items Search All</field>
<field name="res_model">account.move.line</field>
<field name="view_id" ref="account.view_move_line_tree"/>
@@ -18,16 +18,5 @@
groups="account.group_account_user"
/>
<record id="amlse_view_move_line_tree" model="ir.ui.view">
<field name="name">amlse.view.move.line.tree</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree"/>
<field name="arch" type="xml">
<field name="analytic_account_id" position="attributes">
<attribute name="invisible">False</attribute>
</field>
</field>
</record>
</data>
</openerp>

View File

@@ -26,7 +26,7 @@ from openerp import models
class ir_actions_act_window(models.Model):
_inherit = 'ir.actions.act_window'
def __init__(self, pool, cr):
def _get_amlse_act_id(self, cr):
module = 'account_move_line_search_extension'
xml_id = 'action_account_move_line_search_extension'
cr.execute(
@@ -35,7 +35,10 @@ class ir_actions_act_window(models.Model):
"AND module = %s AND name = %s ",
(module, xml_id))
res = cr.fetchone()
self._amlse_act_id = res and res[0]
return res and res[0]
def __init__(self, pool, cr):
self._amlse_act_id = self._get_amlse_act_id(cr)
super(ir_actions_act_window, self).__init__(pool, cr)
def _amlse_add_groups(self, cr, uid, context):
@@ -51,6 +54,8 @@ class ir_actions_act_window(models.Model):
context = {}
res = super(ir_actions_act_window, self).read(
cr, uid, ids, fields=fields, context=context, load=load)
if not self._amlse_act_id:
self._amlse_act_id = self._get_amlse_act_id(cr)
if ids == [self._amlse_act_id]:
amlse_act = res[0]
if amlse_act.get('context'):