This commit is contained in:
Bertrand Chenal committed 2008-10-06 14:06:41 +02:00
commit d520453c42
4 files changed
+34 -11

No files matched your search

+9
View File
@@ -95,6 +95,15 @@
<field name="module">ir</field>
<field name="fuzzy" eval="False"/>
</record>
<record model="ir.translation" id="translation_delete_workflow_record">
<field name="name">delete_workflow_record</field>
<field name="lang">en_US</field>
<field name="type">error</field>
<field name="src">You cannot delete a record with a running workflow.</field>
<field name="value">You cannot delete a record with a running workflow.</field>
<field name="module">ir</field>
<field name="fuzzy" eval="False"/>
</record>
<record model="ir.ui.view" id="act_translation_set_report_init_view_form">
<field name="model">ir.translation.set_report.init</field>
+16 -7
View File
@@ -15,12 +15,13 @@ class View(OSV):
model = fields.Char('Model', required=True, select=1)
priority = fields.Integer('Priority', required=True, select=1)
type = fields.Selection([
('tree','Tree'),
('form','Form'),
('graph', 'Graph'),
('calendar', 'Calendar'),
('board', 'Board'),
], 'View Type', select=1)
(False, ''),
('tree','Tree'),
('form','Form'),
('graph', 'Graph'),
('calendar', 'Calendar'),
('board', 'Board'),
], 'View Type', select=1)
arch = fields.Text('View Architecture', required=True)
inherit = fields.Many2One('ir.ui.view', 'Inherited View', select=1,
ondelete='CASCADE')
@@ -33,7 +34,7 @@ class View(OSV):
('check_xml', 'invalid_xml'),
]
self._error_messages.update({
'invalid_xml': 'Invalid XML for View Architecture!',
'invalid_xml': 'Invalid XML for View!',
})
self._order.insert(0, ('priority', 'ASC'))
@@ -63,6 +64,14 @@ class View(OSV):
xml = view.arch.strip()
tree = etree.fromstring(xml)
if view.inherit:
if view.model != view.inherit.model:
logger = logging.getLogger('ir')
logger.error('Invalid model "%s" ' \
'with inherited model "%"' % \
(view.model, view.inherit.model))
return False
# validate the tree using RelaxNG
rng_name = os.path.join(os.path.dirname(__file__),
(view.inherit and view.inherit.type or view.type) + '.rng')
+6 -1
View File
@@ -295,7 +295,12 @@ class TinySocketClientThread(threading.Thread):
import pdb
tback = sys.exc_info()[2]
pdb.post_mortem(tback)
pysocket.send(exception.args, exception=True, traceback=tb_s)
try:
pysocket.send(exception.args, exception=True, traceback=tb_s)
except:
pysocket.disconnect()
self.threads.remove(self)
return False
pysocket.disconnect()
self.threads.remove(self)
return True
+3 -3
View File
@@ -1406,8 +1406,8 @@ class ORM(object):
"AND res_type = %s AND state != 'complete'",
ids + [self._name])
if cursor.rowcount != 0:
raise Exception('UserError',
'You cannot delete a record with a running workflow.')
self.raise_user_error(cursor, 'delete_workflow_record',
context=context)
wf_service = LocalService("workflow")
for obj_id in ids:
@@ -2142,7 +2142,7 @@ class ORM(object):
raise AttributeError('Unknown position ' \
'in inherited view %s!' % pos)
else:
raise AttributeError('Couldn\'t find tag in parent view!')
raise AttributeError('Couldn\'t find tag (%s: %s) in parent view!' % (element2.tag, element2.get('expr')))
return etree.tostring(tree_src, encoding='utf-8')
result = {'type': view_type, 'model': self._name}