@@ -286,7 +286,8 @@ class act_window_view(osv.osv):
|
||||
('form', 'Form'),
|
||||
('graph', 'Graph'),
|
||||
('calendar', 'Calendar'),
|
||||
('gantt', 'Gantt')), string='View Type', required=True),
|
||||
('gantt', 'Gantt'),
|
||||
('gallery', 'Gallery')), string='View Type', required=True),
|
||||
'act_window_id': fields.many2one('ir.actions.act_window', 'Action', ondelete='cascade'),
|
||||
'multi': fields.boolean('On Multiple Doc.',
|
||||
help="If set to true, the action will not be displayed on the right toolbar of a form view."),
|
||||
|
||||
@@ -64,6 +64,7 @@ class view(osv.osv):
|
||||
('calendar', 'Calendar'),
|
||||
('diagram','Diagram'),
|
||||
('gantt', 'Gantt'),
|
||||
('gallery', 'Gallery'),
|
||||
('search','Search')), 'View Type', required=True),
|
||||
'arch': fields.text('View Architecture', required=True),
|
||||
'inherit_id': fields.many2one('ir.ui.view', 'Inherited View', ondelete='cascade'),
|
||||
|
||||
@@ -203,7 +203,7 @@ class res_company(osv.osv):
|
||||
return """
|
||||
<header>
|
||||
<pageTemplate>
|
||||
<frame id="first" x1="25" y1="25" width="1070" height="717"/>
|
||||
<frame id="first" x1="22.0" y1="22.0" width="1080" height="700"/>
|
||||
<pageGraphics>
|
||||
<fill color="black"/>
|
||||
<stroke color="black"/>
|
||||
|
||||
@@ -412,8 +412,14 @@ class users(osv.osv):
|
||||
return self.name_get(cr, user, ids)
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
login = self.read(cr, uid, [id], ['login'])[0]['login']
|
||||
default.update({'login': login+' (copy)'})
|
||||
user2copy = self.read(cr, uid, [id], ['login','name'])[0]
|
||||
if default is None:
|
||||
default = {}
|
||||
copy_pattern = _("%s (copy)")
|
||||
default.update(login=(copy_pattern % user2copy['login']),
|
||||
name=(copy_pattern % user2copy['name']),
|
||||
address_id=False, # avoid sharing the address of the copied user!
|
||||
)
|
||||
return super(users, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def context_get(self, cr, uid, context=None):
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0">
|
||||
<rng:define name="any">
|
||||
<rng:element>
|
||||
<rng:anyName/>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:attribute>
|
||||
<rng:anyName/>
|
||||
</rng:attribute>
|
||||
<rng:text/>
|
||||
<rng:ref name="any"/>
|
||||
</rng:choice>
|
||||
</rng:zeroOrMore>
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<rng:start>
|
||||
<rng:ref name="any" />
|
||||
</rng:start>
|
||||
</rng:grammar>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0">
|
||||
<rng:define name="any">
|
||||
<rng:element>
|
||||
<rng:anyName/>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:attribute>
|
||||
<rng:anyName/>
|
||||
</rng:attribute>
|
||||
<rng:text/>
|
||||
<rng:ref name="any"/>
|
||||
</rng:choice>
|
||||
</rng:zeroOrMore>
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<rng:start>
|
||||
<rng:ref name="any" />
|
||||
</rng:start>
|
||||
</rng:grammar>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0">
|
||||
<rng:define name="any">
|
||||
<rng:element>
|
||||
<rng:anyName/>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:attribute>
|
||||
<rng:anyName/>
|
||||
</rng:attribute>
|
||||
<rng:text/>
|
||||
<rng:ref name="any"/>
|
||||
</rng:choice>
|
||||
</rng:zeroOrMore>
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<rng:start>
|
||||
<rng:ref name="any" />
|
||||
</rng:start>
|
||||
</rng:grammar>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0">
|
||||
<rng:define name="any">
|
||||
<rng:element>
|
||||
<rng:anyName/>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:attribute>
|
||||
<rng:anyName/>
|
||||
</rng:attribute>
|
||||
<rng:text/>
|
||||
<rng:ref name="any"/>
|
||||
</rng:choice>
|
||||
</rng:zeroOrMore>
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<rng:start>
|
||||
<rng:ref name="any" />
|
||||
</rng:start>
|
||||
</rng:grammar>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0">
|
||||
<rng:define name="any">
|
||||
<rng:element>
|
||||
<rng:anyName/>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:attribute>
|
||||
<rng:anyName/>
|
||||
</rng:attribute>
|
||||
<rng:text/>
|
||||
<rng:ref name="any"/>
|
||||
</rng:choice>
|
||||
</rng:zeroOrMore>
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<rng:start>
|
||||
<rng:ref name="any" />
|
||||
</rng:start>
|
||||
</rng:grammar>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0">
|
||||
<rng:define name="any">
|
||||
<rng:element>
|
||||
<rng:anyName/>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
<rng:attribute>
|
||||
<rng:anyName/>
|
||||
</rng:attribute>
|
||||
<rng:text/>
|
||||
<rng:ref name="any"/>
|
||||
</rng:choice>
|
||||
</rng:zeroOrMore>
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<rng:start>
|
||||
<rng:ref name="any" />
|
||||
</rng:start>
|
||||
</rng:grammar>
|
||||
@@ -308,6 +308,7 @@
|
||||
<rng:ref name="overload"/>
|
||||
<rng:ref name="access_rights"/>
|
||||
<rng:optional><rng:attribute name="string"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="name"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="attrs"/></rng:optional>
|
||||
<rng:zeroOrMore>
|
||||
<rng:choice>
|
||||
@@ -396,6 +397,7 @@
|
||||
<rng:ref name="button"/>
|
||||
<rng:ref name="group"/>
|
||||
<rng:ref name="graph"/>
|
||||
<rng:ref name="gallery"/>
|
||||
<rng:ref name="html"/>
|
||||
<rng:element name="newline"><rng:empty/></rng:element>
|
||||
</rng:choice>
|
||||
@@ -438,6 +440,7 @@
|
||||
<rng:optional><rng:attribute name="required"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="readonly"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="view_mode"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="search_mode"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="widget"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="context"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="states"/></rng:optional>
|
||||
@@ -468,6 +471,7 @@
|
||||
<rng:ref name="button"/>
|
||||
<rng:ref name="group"/>
|
||||
<rng:ref name="graph"/>
|
||||
<rng:ref name="gallery"/>
|
||||
<rng:ref name="filter"/>
|
||||
<rng:ref name="notebook"/>
|
||||
<rng:ref name="html"/>
|
||||
@@ -530,6 +534,18 @@
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<rng:define name="gallery">
|
||||
<rng:element name="gallery">
|
||||
<rng:optional><rng:attribute name="string"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="width"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="height"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="col"/></rng:optional>
|
||||
<rng:oneOrMore>
|
||||
<rng:ref name="field"/>
|
||||
</rng:oneOrMore>
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<rng:define name="button">
|
||||
<rng:element name="button">
|
||||
<rng:ref name="overload"/>
|
||||
@@ -559,6 +575,7 @@
|
||||
<rng:ref name="graph" />
|
||||
<rng:ref name="calendar" />
|
||||
<rng:ref name="gantt" />
|
||||
<rng:ref name="gallery" />
|
||||
<rng:ref name="xpath" />
|
||||
<rng:ref name="page" />
|
||||
<rng:ref name="separator"/>
|
||||
@@ -627,6 +644,7 @@
|
||||
<rng:ref name="calendar" />
|
||||
<rng:ref name="data" />
|
||||
<rng:ref name="gantt" />
|
||||
<rng:ref name="gallery" />
|
||||
<rng:ref name="xpath" />
|
||||
<rng:ref name="page" />
|
||||
<rng:ref name="separator"/>
|
||||
|
||||
+10
-3
@@ -65,12 +65,19 @@ class osv_pool(netsvc.Service):
|
||||
for key in self._sql_error.keys():
|
||||
if key in inst[0]:
|
||||
self.abortResponse(1, _('Constraint Error'), 'warning', _(self._sql_error[key]))
|
||||
if inst.pgcode == errorcodes.NOT_NULL_VIOLATION:
|
||||
if inst.pgcode in (errorcodes.NOT_NULL_VIOLATION, errorcodes.FOREIGN_KEY_VIOLATION, errorcodes.RESTRICT_VIOLATION):
|
||||
msg = _('The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set')
|
||||
self.logger.debug("IntegrityError", exc_info=True)
|
||||
try:
|
||||
context = inst.pgerror.split('"public".')[1]
|
||||
model_name = table = context.split('"')[1]
|
||||
errortxt = inst.pgerror.replace('«','"').replace('»','"')
|
||||
if '"public".' in errortxt:
|
||||
context = errortxt.split('"public".')[1]
|
||||
model_name = table = context.split('"')[1]
|
||||
else:
|
||||
last_quote_end = errortxt.rfind('"')
|
||||
last_quote_begin = errortxt.rfind('"', 0, last_quote_end)
|
||||
model_name = table = errortxt[last_quote_begin+1:last_quote_end].strip()
|
||||
print "MODEL", last_quote_begin, last_quote_end, model_name
|
||||
model = table.replace("_",".")
|
||||
model_obj = self.get(model)
|
||||
if model_obj:
|
||||
|
||||
@@ -64,7 +64,7 @@ class _rml_styles(object,):
|
||||
for style in node.findall('paraStyle'):
|
||||
sname = style.get('name')
|
||||
self.styles[sname] = self._para_style_update(style)
|
||||
|
||||
|
||||
self.styles_obj[sname] = reportlab.lib.styles.ParagraphStyle(sname, self.default_style["Normal"], **self.styles[sname])
|
||||
|
||||
for variable in node.findall('initialize'):
|
||||
@@ -809,6 +809,8 @@ class _rml_template(object):
|
||||
if story_cnt > 0:
|
||||
fis.append(platypus.PageBreak())
|
||||
fis += r.render(node_story)
|
||||
# Reset Page Number with new story tag
|
||||
fis.append(PageReset())
|
||||
story_cnt += 1
|
||||
if self.localcontext:
|
||||
fis.append(PageCount())
|
||||
|
||||
@@ -68,6 +68,24 @@ def _obj(pool, cr, uid, model_str, context=None):
|
||||
model = pool.get(model_str)
|
||||
return lambda x: model.browse(cr, uid, x, context=context)
|
||||
|
||||
def _fix_multiple_roots(node):
|
||||
"""
|
||||
Surround the children of the ``node`` element of an XML field with a
|
||||
single root "data" element, to prevent having a document with multiple
|
||||
roots once parsed separately.
|
||||
|
||||
XML nodes should have one root only, but we'd like to support
|
||||
direct multiple roots in our partial documents (like inherited view architectures).
|
||||
As a convention we'll surround multiple root with a container "data" element, to be
|
||||
ignored later when parsing.
|
||||
"""
|
||||
|
||||
if len(node) > 1:
|
||||
data_node = etree.Element("data")
|
||||
for child in node:
|
||||
data_node.append(child)
|
||||
node.append(data_node)
|
||||
|
||||
def _eval_xml(self, node, pool, cr, uid, idref, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -115,6 +133,7 @@ def _eval_xml(self, node, pool, cr, uid, idref, context=None):
|
||||
if not id in idref:
|
||||
idref[id]=self.id_get(cr, False, id)
|
||||
return s % idref
|
||||
_fix_multiple_roots(node)
|
||||
return '<?xml version="1.0"?>\n'\
|
||||
+_process("".join([etree.tostring(n, encoding='utf-8')
|
||||
for n in node]),
|
||||
|
||||
@@ -374,6 +374,14 @@ class YamlInterpreter(object):
|
||||
elif column._type == "many2many":
|
||||
ids = [self.get_id(xml_id) for xml_id in expression]
|
||||
value = [(6, 0, ids)]
|
||||
elif column._type == "date":
|
||||
# enforce ISO format for date values, to be locale-agnostic during tests
|
||||
time.strptime(expression, misc.DEFAULT_SERVER_DATE_FORMAT)
|
||||
value = expression
|
||||
elif column._type == "datetime":
|
||||
# enforce ISO format for datetime values, to be locale-agnostic during tests
|
||||
time.strptime(expression, misc.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
value = expression
|
||||
else: # scalar field
|
||||
if is_eval(expression):
|
||||
value = self.process_eval(expression)
|
||||
|
||||
Reference in New Issue
Block a user