Adding URL Action

bzr revid: fp@tinyerp.com-3dbbb14209f5322b4cf53e66ee4a40f15605aead
This commit is contained in:
Fabien Pinckaers 2007-10-25 18:20:12 +00:00
parent 564ee53654
commit ffe14868c5
3 changed files with 51 additions and 24 deletions

View File

@ -128,6 +128,13 @@ CREATE TABLE ir_act_wizard (
)
INHERITS (ir_actions);
CREATE TABLE ir_act_url (
url text NOT NULL,
target varchar(64) NOT NULL,
primary key(id)
)
INHERITS (ir_actions);
CREATE TABLE ir_ui_view (
id serial NOT NULL,
perm_id int references perm on delete set null,

View File

@ -236,3 +236,22 @@ class act_wizard(osv.osv):
}
act_wizard()
class act_url(osv.osv):
_name = 'ir.actions.url'
_table = 'ir_act_url'
_sequence = 'ir_actions_id_seq'
_columns = {
'name': fields.char('Action Name', size=64, translate=True),
'type': fields.char('Action Type', size=32, required=True),
'url': fields.text('Action Url',required=True),
'target': fields.selection((
('new', 'New Window'),
('self', 'This Window')),
'Action Target', required=True)
}
_defaults = {
'type': lambda *a: 'ir.actions.act_url',
'target': lambda *a: 'new'
}
act_url()

View File

@ -368,6 +368,7 @@ class xml_import(object):
"act_window": 'STOCK_NEW',
"report.xml": 'STOCK_PASTE',
"wizard": 'STOCK_EXECUTE',
"url": 'STOCK_JUMP_TO',
}
values['icon'] = icons.get(a_type,'STOCK_NEW')
if a_type=='act_window':
@ -627,46 +628,46 @@ class xml_import(object):
def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
noupdate=False):
'''Import csv file :
quote: "
delimiter: ,
encoding: utf-8'''
if not idref:
idref={}
model = ('.'.join(fname.split('.')[:-1]).split('-'))[0]
quote: "
delimiter: ,
encoding: utf-8'''
if not idref:
idref={}
model = ('.'.join(fname.split('.')[:-1]).split('-'))[0]
#remove folder path from model
head, model = os.path.split(model)
head, model = os.path.split(model)
pool = pooler.get_pool(cr.dbname)
pool = pooler.get_pool(cr.dbname)
input = StringIO.StringIO(csvcontent)
input = StringIO.StringIO(csvcontent)
reader = csv.reader(input, quotechar='"', delimiter=',')
fields = reader.next()
fields = reader.next()
if not (mode == 'init' or 'id' in fields):
return
uid = 1
datas = []
for line in reader:
uid = 1
datas = []
for line in reader:
if (not line) or not reduce(lambda x,y: x or y, line) :
continue
datas.append( map(lambda x:x.decode('utf8').encode('utf8'), line))
pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate)
datas.append( map(lambda x:x.decode('utf8').encode('utf8'), line))
pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate)
#
# xml import/export
#
def convert_xml_import(cr, module, xmlstr, idref=None, mode='init', noupdate = False, report=None):
if not idref:
idref={}
if report is None:
report=assertion_report()
def convert_xml_import(cr, module, xmlstr, idref=None, mode='init', noupdate = False, report=None):
if not idref:
idref={}
if report is None:
report=assertion_report()
obj = xml_import(cr, module, idref, mode, report=report, noupdate = noupdate)
obj.parse(xmlstr)
obj.parse(xmlstr)
del obj
return True
def convert_xml_export(res):
def convert_xml_export(res):
uid=1
pool=pooler.get_pool(cr.dbname)
cr=pooler.db.cursor()
@ -674,8 +675,8 @@ def convert_xml_export(res):
d = xml.dom.minidom.getDOMImplementation().createDocument(None, "terp", None)
de = d.documentElement
data=d.createElement("data")
de.appendChild(data)
de.appendChild(data)
de.appendChild(d.createTextNode('Some textual content.'))
cr.commit()
cr.close()
cr.close()