[IMP] removed unused object: board.line

bzr revid: fp@openerp.com-20120805072027-o6a398q8y416w82b
This commit is contained in:
Fabien Pinckaers 2012-08-05 09:20:27 +02:00
parent 38cf051670
commit 61dd90ab32
5 changed files with 31 additions and 102 deletions

View File

@ -38,51 +38,15 @@ class board_board(osv.osv):
@param ids: List of Board's IDs
@return: arch of xml view.
"""
board = self.pool.get('board.board').browse(cr, uid, ids, context=context)
left = []
right = []
#start Loop
for line in board.line_ids:
linestr = '<action string="%s" name="%d"' % (line.name, line.action_id.id)
linestr += '/>'
if line.position == 'left':
left.append(linestr)
else:
right.append(linestr)
#End Loop
arch = """<?xml version="1.0"?>
<form string="My Board">
<form string="My Board" version="7.0">
<board style="1-1">
<column>
%s
</column>
<column>
%s
</column>
<column/>
<column/>
</board>
</form>""" % ('\n'.join(left), '\n'.join(right))
</form>"""
return arch
def write(self, cr, uid, ids, vals, context=None):
"""
Writes values in one or several fields.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Board's IDs
@param vals: dictionary with values to update.
dictionary must be with the form: {name_of_the_field: value, ...}.
@return: True
"""
result = super(board_board, self).write(cr, uid, ids, vals, context=context)
board = self.pool.get('board.board').browse(cr, uid, ids[0], context=context)
view = self.create_view(cr, uid, ids[0], context=context)
id = board.view_id.id
cr.execute("update ir_ui_view set arch=%s where id=%s", (view, id))
return result
def create(self, cr, user, vals, context=None):
"""
create new record.
@ -106,7 +70,6 @@ class board_board(osv.osv):
})
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,\
@ -131,7 +94,6 @@ class board_board(osv.osv):
res['toolbar'] = {'print': [], 'action': [], 'relate': []}
return res
def _arch_preprocessing(self, cr, user, arch, context=None):
from lxml import etree
def remove_unauthorized_children(node):
@ -150,13 +112,9 @@ class board_board(osv.osv):
archnode = etree.fromstring(encode(arch))
return etree.tostring(remove_unauthorized_children(archnode),pretty_print=True)
_columns = {
'name': fields.char('Dashboard', size=64, required=True),
'view_id': fields.many2one('ir.ui.view', 'Board View'),
'line_ids': fields.one2many('board.board.line', 'board_id', 'Action Views')
}
# the following lines added to let the button on dashboard work.
@ -164,26 +122,4 @@ class board_board(osv.osv):
'name':lambda *args: 'Dashboard'
}
class board_line(osv.osv):
"""
Board Line
"""
_name = 'board.board.line'
_description = "Board Line"
_order = 'position,sequence'
_columns = {
'name': fields.char('Title', size=64, required=True),
'sequence': fields.integer('Sequence', help="Gives the sequence order\
when displaying a list of board lines.", select=True),
'height': fields.integer('Height'),
'width': fields.integer('Width'),
'board_id': fields.many2one('board.board', 'Dashboard', required=True, ondelete='cascade'),
'action_id': fields.many2one('ir.actions.act_window', 'Action', required=True),
'position': fields.selection([('left','Left'),
('right','Right')], 'Position', required=True, select=True)
}
_defaults = {
'position': lambda *args: 'left'
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -29,9 +29,9 @@
<p>
<b>Your personal dashboard is empty.</b>
</p><p>
To insert any report into this dashboard, click <i>'Add to
Dashboard'</i> in the extended search options of any list
or graph.
To add your first report into this dashboard, go to any
menu, switch to list or graph view, and click <i>'Add to
Dashboard'</i> in the extended search options.
</p><p>
You can filter and group data before inserting into the
dashboard using the search options.

View File

@ -9,7 +9,6 @@
<field name="arch" type="xml">
<search string="Dashboard">
<field name="name" string="Dashboard"/>
<field name="line_ids"/>
</search>
</field>
</record>
@ -33,28 +32,16 @@
<field name="type">form</field>
<field eval="1" name="priority"/>
<field name="arch" type="xml">
<form string="Dashboard">
<group col="6" colspan="4">
<field name="name"/>
<field name="view_id"/>
<button colspan="2" name="%(action_board_menu_create)d" string="Create Menu" type="action" icon="gtk-justify-fill" />
</group>
<field colspan="4" name="line_ids" nolabel="1">
<tree string="Dashboard View">
<form string="Dashboard" version="7.0">
<header>
<button name="%(action_board_menu_create)d" string="Create Menu" type="action" class="oe_highlight"/>
</header>
<sheet>
<group>
<field name="name"/>
<field name="sequence"/>
<field name="action_id"/>
<field name="position"/>
</tree>
<form string="Dashboard View">
<field name="name"/>
<field name="sequence"/>
<field name="width"/>
<field name="height"/>
<field name="action_id" domain="[('view_type','!=','tree')]" />
<field name="position"/>
</form>
</field>
<field name="view_id" invisible="1"/>
</group>
</sheet>
</form>
</field>
</record>
@ -70,8 +57,8 @@
<menuitem action="action_view_board_list_form"
id="menu_view_board_form" parent="base.menu_reporting_config"
groups="base.group_no_one"
sequence="2"/>
groups="base.group_no_one"
sequence="2"/>
</data>
</openerp>

View File

@ -1,5 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_board_board all,board.board,model_board_board,,1,0,0,0
access_board_board_line all,board.board.line,model_board_board_line,,1,0,0,0
access_board_board system,board.board system,model_board_board,base.group_system,1,1,1,1
access_board_board_line system,board.board.line system,model_board_board_line,base.group_system,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_board_board all board.board model_board_board 1 0 0 0
access_board_board_line all board.board.line model_board_board_line 1 0 0 0
3 access_board_board system board.board system model_board_board base.group_system 1 1 1 1
access_board_board_line system board.board.line system model_board_board_line base.group_system 1 1 1 1

View File

@ -40,10 +40,6 @@ class board_menu_create(osv.osv_memory):
"""
data = context and context.get('active_id', False) or False
if data:
board = self.pool.get('board.board').browse(cr, uid, data, context=context)
if not board.line_ids:
raise osv.except_osv(_('User Error!'),
_('Please Insert Dashboard View(s) !'))
return False
@ -67,6 +63,19 @@ class board_menu_create(osv.osv_memory):
'view_mode': 'form',
'res_model': 'board.board',
'view_id': board.view_id.id,
'help': _('''<div class="oe_empty_custom_dashboard">
<p>
<b>This dashboard is empty.</b>
</p><p>
To add the first report into this dashboard, go to any
menu, switch to list or graph view, and click <i>'Add to
Dashboard'</i> in the extended search options.
</p><p>
You can filter and group data before inserting into the
dashboard using the search options.
</p>
</div>
''')
})
obj_menu = self.pool.get('ir.ui.menu')
#start Loop
@ -74,7 +83,6 @@ class board_menu_create(osv.osv_memory):
obj_menu.create(cr, uid, {
'name': data.menu_name,
'parent_id': data.menu_parent_id.id,
'icon': 'STOCK_SELECT_COLOR',
'action': 'ir.actions.act_window,' + str(action_id)
}, context=context)
#End Loop