diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index a33dba8a9fc..7ba775c1797 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -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."), diff --git a/bin/addons/base/ir/ir_ui_view.py b/bin/addons/base/ir/ir_ui_view.py index e0b7d6c3252..62e4bd9dd6e 100644 --- a/bin/addons/base/ir/ir_ui_view.py +++ b/bin/addons/base/ir/ir_ui_view.py @@ -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'), diff --git a/bin/addons/base/res/res_company.py b/bin/addons/base/res/res_company.py index bbc1c78af2b..1bc0f7372ee 100644 --- a/bin/addons/base/res/res_company.py +++ b/bin/addons/base/res/res_company.py @@ -203,7 +203,7 @@ class res_company(osv.osv): return """
- + diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 2b1d39381cc..e49578e9cc6 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -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): diff --git a/bin/addons/base/rng/board.rng b/bin/addons/base/rng/board.rng deleted file mode 100644 index 73477113f62..00000000000 --- a/bin/addons/base/rng/board.rng +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/addons/base/rng/calendar.rng b/bin/addons/base/rng/calendar.rng deleted file mode 100644 index 73477113f62..00000000000 --- a/bin/addons/base/rng/calendar.rng +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/addons/base/rng/form.rng b/bin/addons/base/rng/form.rng deleted file mode 100644 index b8a93c67549..00000000000 --- a/bin/addons/base/rng/form.rng +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/addons/base/rng/graph.rng b/bin/addons/base/rng/graph.rng deleted file mode 100644 index 73477113f62..00000000000 --- a/bin/addons/base/rng/graph.rng +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/addons/base/rng/inherit.rng b/bin/addons/base/rng/inherit.rng deleted file mode 100644 index 73477113f62..00000000000 --- a/bin/addons/base/rng/inherit.rng +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/addons/base/rng/tree.rng b/bin/addons/base/rng/tree.rng deleted file mode 100644 index 73477113f62..00000000000 --- a/bin/addons/base/rng/tree.rng +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/addons/base/rng/view.rng b/bin/addons/base/rng/view.rng index 7de758749e7..a21ed037705 100644 --- a/bin/addons/base/rng/view.rng +++ b/bin/addons/base/rng/view.rng @@ -308,6 +308,7 @@ + @@ -396,6 +397,7 @@ + @@ -438,6 +440,7 @@ + @@ -468,6 +471,7 @@ + @@ -530,6 +534,18 @@ + + + + + + + + + + + + @@ -559,6 +575,7 @@ + @@ -627,6 +644,7 @@ + diff --git a/bin/osv/osv.py b/bin/osv/osv.py index d75c9af564f..11db4096a9a 100644 --- a/bin/osv/osv.py +++ b/bin/osv/osv.py @@ -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: diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py index 9a5fd66517b..ca47423008b 100644 --- a/bin/report/render/rml2pdf/trml2pdf.py +++ b/bin/report/render/rml2pdf/trml2pdf.py @@ -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()) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index a90de107b29..a8749514958 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -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 '\n'\ +_process("".join([etree.tostring(n, encoding='utf-8') for n in node]), diff --git a/bin/tools/yaml_import.py b/bin/tools/yaml_import.py index 87fd2ff432c..8868d153ebf 100644 --- a/bin/tools/yaml_import.py +++ b/bin/tools/yaml_import.py @@ -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)