Add minimal new view type calendar

bzr revid: ced-3e20a47bc638b8f772c277f74bfa0a90a830ed81
This commit is contained in:
ced 2007-08-09 06:07:21 +00:00
parent 35138ca6b8
commit f7ea1ce562
5 changed files with 19 additions and 5 deletions

View File

@ -162,9 +162,14 @@ class act_window_view(osv.osv):
_columns = {
'sequence': fields.integer('Sequence'),
'view_id': fields.many2one('ir.ui.view', 'View'),
'view_mode': fields.selection((('tree', 'Tree'),('form', 'Form'),('graph', 'Graph')), string='Type of view', required=True),
'view_mode': fields.selection((
('tree', 'Tree'),
('form', 'Form'),
('graph', 'Graph'),
('calendar', 'Calendar')), string='Type of view', required=True),
'act_window_id': fields.many2one('ir.actions.act_window', 'Action'),
'multi': fields.boolean('On multiple doc.', help="If set to true, the action will not be displayed on the right toolbar of a form views.")
'multi': fields.boolean('On multiple doc.',
help="If set to true, the action will not be displayed on the right toolbar of a form views.")
}
_defaults = {
'multi': lambda *a: False,

View File

@ -62,7 +62,7 @@ icons = map(lambda x: (x,x), ['STOCK_ABOUT', 'STOCK_ADD', 'STOCK_APPLY', 'STOCK_
'STOCK_UNDO', 'STOCK_UNINDENT', 'STOCK_YES', 'STOCK_ZOOM_100',
'STOCK_ZOOM_FIT', 'STOCK_ZOOM_IN', 'STOCK_ZOOM_OUT',
'terp-account', 'terp-crm', 'terp-mrp', 'terp-product', 'terp-purchase', 'terp-sale', 'terp-tools',
'terp-administration', 'terp-hr', 'terp-partner', 'terp-project', 'terp-report', 'terp-stock'
'terp-administration', 'terp-hr', 'terp-partner', 'terp-project', 'terp-report', 'terp-stock', 'terp-calendar',
])
class many2many_unique(fields.many2many):

View File

@ -44,7 +44,11 @@ class view(osv.osv):
'name': fields.char('View Name',size=64, required=True),
'model': fields.char('Model', size=64, required=True),
'priority': fields.integer('Priority', required=True),
'type': fields.selection((('tree','Tree'),('form','Form'),('graph', 'Graph')), 'View Type', required=True),
'type': fields.selection((
('tree','Tree'),
('form','Form'),
('graph', 'Graph'),
('calendar', 'Calendar')), 'View Type', required=True),
'arch': fields.text('View Architecture', required=True),
'inherit_id': fields.many2one('ir.ui.view', 'Inherited View'),
'field_parent': fields.char('Childs Field',size=64)

View File

@ -276,6 +276,7 @@ class orm(object):
_name = None
_rec_name = 'name'
_parent_name = 'parent_id'
_date_name = 'date'
_order = 'id'
_inherits = {}
_sequence = None
@ -1398,6 +1399,8 @@ class orm(object):
xml += "</form>"
elif view_type == 'tree':
xml = '''<?xml version="1.0"?>\n<tree string="%s">\n\t<field name="%s"/>\n</tree>''' % (self._description,self._rec_name)
elif view_type == 'calendar':
xml = '''<?xml version="1.0"?>\n<calendar string="%s" date_start="%s">\n\t<field name="%s"/>\n</calendar>''' % (self._description,self._date_name,self._rec_name)
else:
xml = ''
result['arch'] = xml

View File

@ -282,7 +282,9 @@ class xml_import(object):
elif action_mode and action_mode.startswith('tree'):
values['icon'] = 'STOCK_JUSTIFY_FILL'
elif action_mode and action_mode.startswith('graph'):
values['icon'] = 'terp-account'
values['icon'] = 'terp-graph'
elif action_mode and action_mode.startswith('calendar'):
values['icon'] = 'terp-calendar'
if not values['name']:
values['name'] = action_name
if rec.hasAttribute('sequence'):