diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py
index 2bb89a84cdc..9af0dcf60f4 100644
--- a/addons/account/account_cash_statement.py
+++ b/addons/account/account_cash_statement.py
@@ -169,7 +169,7 @@ class account_cash_statement(osv.osv):
return result
_columns = {
- 'total_entry_encoding': fields.function(_get_sum_entry_encoding, string="Total Cash Transactions",
+ 'total_entry_encoding': fields.function(_get_sum_entry_encoding, string="Total Transactions",
store = {
'account.bank.statement': (lambda self, cr, uid, ids, context=None: ids, ['line_ids','move_line_ids'], 10),
'account.bank.statement.line': (_get_statement_from_line, ['amount'], 10),
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 501a50b96c2..03d127249fb 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -347,7 +347,7 @@
-
+ ).
+# Copyright (C) 2010-2012 OpenERP s.a. ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -15,11 +16,11 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
import board
-import wizard
+import controllers
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/board/__openerp__.py b/addons/board/__openerp__.py
index 503f11afe6b..62986c452be 100644
--- a/addons/board/__openerp__.py
+++ b/addons/board/__openerp__.py
@@ -3,6 +3,7 @@
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
+# Copyright (C) 2010-2012 OpenERP s.a. ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -35,15 +36,19 @@ The user can also publish notes.
'depends': ['base'],
'update_xml': [
'security/ir.model.access.csv',
- 'wizard/board_menu_create_view.xml',
'board_view.xml',
- 'board_data_admin.xml',
- 'board_data_home.xml',
'board_mydashboard_view.xml'
],
- 'demo_xml': [
- 'board_demo.xml'
+ "js": [
+ 'static/src/js/dashboard.js',
],
+ "css": [
+ 'static/src/css/dashboard.css',
+ ],
+ 'qweb': [
+ "static/src/xml/*.xml",
+ ],
+
'installable': True,
'auto_install': False,
'certificate': '0076912305725',
diff --git a/addons/board/board.py b/addons/board/board.py
index 985bc3cd09a..a76bff7a66b 100644
--- a/addons/board/board.py
+++ b/addons/board/board.py
@@ -3,6 +3,7 @@
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
+# Copyright (C) 2010-2012 OpenERP s.a. ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -19,75 +20,58 @@
#
##############################################################################
+from operator import itemgetter
+from textwrap import dedent
from osv import fields, osv
-import time
import tools
class board_board(osv.osv):
- """
- Board
- """
_name = 'board.board'
_description = "Board"
+ _auto = False
+ _columns = {}
- def create_view(self, cr, uid, ids, context=None):
- """
- Create view
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Board's IDs
- @return: arch of xml view.
- """
- arch = """
- """
- return arch
+ @tools.cache()
+ def list(self, cr, uid, context=None):
+ Actions = self.pool.get('ir.actions.act_window')
+ Menus = self.pool.get('ir.ui.menu')
+ IrValues = self.pool.get('ir.values')
+
+ act_ids = Actions.search(cr, uid, [('res_model', '=', self._name)], context=context)
+ refs = ['%s,%s' % (Actions._name, act_id) for act_id in act_ids]
+
+ # cannot search "action" field on menu (non stored function field without search_fnct)
+ irv_ids = IrValues.search(cr, uid, [
+ ('model', '=', 'ir.ui.menu'),
+ ('key', '=', 'action'),
+ ('key2', '=', 'tree_but_open'),
+ ('value', 'in', refs),
+ ], context=context)
+ menu_ids = map(itemgetter('res_id'), IrValues.read(cr, uid, irv_ids, ['res_id'], context=context))
+ menu_names = Menus.name_get(cr, uid, menu_ids, context=context)
+ return [dict(id=m[0], name=m[1]) for m in menu_names]
+
+ def _clear_list_cache(self):
+ self.list.clear_cache(self)
def create(self, cr, user, vals, context=None):
- """
- create new record.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param vals: dictionary of values for every field.
- dictionary must use this form: {‘name_of_the_field’: value, ...}
- @return: id of new created record of board.board.
- """
+ return 0
-
- if not 'name' in vals:
- return False
- id = super(board_board, self).create(cr, user, vals, context=context)
- view_id = self.pool.get('ir.ui.view').create(cr, user, {
- 'name': vals['name'],
- 'model': 'board.board',
- 'priority': 16,
- 'type': 'form',
- 'arch': self.create_view(cr, user, id, context=context),
- })
-
- super(board_board, self).write(cr, user, [id], {'view_id': view_id}, context)
- return id
-
- def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None,\
- toolbar=False, submenu=False):
+ def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
"""
Overrides orm field_view_get.
@return: Dictionary of Fields, arch and toolbar.
"""
res = {}
- res = super(board_board, self).fields_view_get(cr, user, view_id, view_type,\
- context, toolbar=toolbar, submenu=submenu)
+ res = super(board_board, self).fields_view_get(cr, user, view_id, view_type,
+ context, toolbar=toolbar, submenu=submenu)
- vids = self.pool.get('ir.ui.view.custom').search(cr, user,\
- [('user_id', '=', user), ('ref_id' ,'=', view_id)])
+ CustView = self.pool.get('ir.ui.view.custom')
+ vids = CustView.search(cr, user, [('user_id', '=', user), ('ref_id', '=', view_id)], context=context)
if vids:
view_id = vids[0]
- arch = self.pool.get('ir.ui.view.custom').browse(cr, user, view_id, context=context)
+ arch = CustView.browse(cr, user, view_id, context=context)
res['custom_view_id'] = view_id
res['arch'] = arch.arch
res['arch'] = self._arch_preprocessing(cr, user, res['arch'], context=context)
@@ -98,10 +82,10 @@ class board_board(osv.osv):
from lxml import etree
def remove_unauthorized_children(node):
for child in node.iterchildren():
- if child.tag=='action' and child.get('invisible'):
+ if child.tag == 'action' and child.get('invisible'):
node.remove(child)
else:
- child=remove_unauthorized_children(child)
+ child = remove_unauthorized_children(child)
return node
def encode(s):
@@ -110,16 +94,84 @@ class board_board(osv.osv):
return s
archnode = etree.fromstring(encode(arch))
- return etree.tostring(remove_unauthorized_children(archnode),pretty_print=True)
+ return etree.tostring(remove_unauthorized_children(archnode), pretty_print=True)
+
+
+class board_create(osv.osv_memory):
+
+ def board_create(self, cr, uid, ids, context=None):
+ assert len(ids) == 1
+ this = self.browse(cr, uid, ids[0], context=context)
+
+ view_arch = dedent("""
+
+ """.strip() % (this.name,))
+
+ view_id = self.pool.get('ir.ui.view').create(cr, uid, {
+ 'name': this.name,
+ 'model': 'board.board',
+ 'priority': 16,
+ 'type': 'form',
+ 'arch': view_arch,
+ }, context=context)
+
+ action_id = self.pool.get('ir.actions.act_window').create(cr, uid, {
+ 'name': this.name,
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'board.board',
+ 'usage': 'menu',
+ 'view_id': view_id,
+ 'help': dedent('''
+
+ This dashboard is empty.
+
+ To add the first report into this dashboard, go to any
+ menu, switch to list or graph view, and click 'Add to
+ Dashboard' in the extended search options.
+
+ You can filter and group data before inserting into the
+ dashboard using the search options.
+
+
+
+
+
+
diff --git a/addons/board/wizard/__init__.py b/addons/board/wizard/__init__.py
deleted file mode 100644
index a22e1d05e43..00000000000
--- a/addons/board/wizard/__init__.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import board_menu_create
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/board/wizard/board_menu_create.py b/addons/board/wizard/board_menu_create.py
deleted file mode 100644
index 8c7909767f0..00000000000
--- a/addons/board/wizard/board_menu_create.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-
-class board_menu_create(osv.osv_memory):
- """
- Create Menu
- """
- def view_init(self, cr, uid, fields, context=None):
- """
- This function checks for precondition before wizard executes
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param fields: List of fields for default value
- @param context: A standard dictionary for contextual values
-
- check dashboard view on menu name field.
- @return: False
- """
- data = context and context.get('active_id', False) or False
- if data:
- return False
-
-
- def board_menu_create(self, cr, uid, ids, context=None):
- """
- Create Menu.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Board Menu Create's IDs
- @return: Dictionary {}.
- """
- if context is None:
- context = {}
-
- context_id = context and context.get('active_id', False) or False
- if context_id:
- board = self.pool.get('board.board').browse(cr, uid, context_id, context=context)
- action_id = self.pool.get('ir.actions.act_window').create(cr, uid, {
- 'name': board.name,
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'board.board',
- 'view_id': board.view_id.id,
- 'help': _('''
-
- This dashboard is empty.
-
- To add the first report into this dashboard, go to any
- menu, switch to list or graph view, and click 'Add to
- Dashboard' in the extended search options.
-
- You can filter and group data before inserting into the
- dashboard using the search options.
-