From 41d2aa44ea9bb621ac3891a4689fa18bcf2bc78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 20 Sep 2013 00:36:00 +0200 Subject: [PATCH] Ignore "noupdate" attribute when installing a new module issue2854 review631004 --- trytond/convert.py | 5 +++-- trytond/modules/__init__.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/trytond/convert.py b/trytond/convert.py index d3e5e36517..259db7f37a 100644 --- a/trytond/convert.py +++ b/trytond/convert.py @@ -389,7 +389,7 @@ class Fs2bdAccessor: class TrytondXmlHandler(sax.handler.ContentHandler): - def __init__(self, pool, module,): + def __init__(self, pool, module, module_state): "Register known taghandlers, and managed tags." sax.handler.ContentHandler.__init__(self) @@ -399,6 +399,7 @@ class TrytondXmlHandler(sax.handler.ContentHandler): self.fs2db = Fs2bdAccessor(self.ModelData, pool) self.to_delete = self.populate_to_delete() self.noupdate = None + self.module_state = module_state self.grouped = None self.grouped_creations = defaultdict(dict) self.skip_data = False @@ -570,7 +571,7 @@ class TrytondXmlHandler(sax.handler.ContentHandler): if module == self.module and fs_id in self.to_delete: self.to_delete.remove(fs_id) - if self.noupdate: + if self.noupdate and self.module_state != 'to install': return # this record is already in the db: diff --git a/trytond/modules/__init__.py b/trytond/modules/__init__.py index 7bcf65ab2d..6dbebf4520 100644 --- a/trytond/modules/__init__.py +++ b/trytond/modules/__init__.py @@ -238,7 +238,8 @@ def load_module_graph(graph, pool, lang=None): models_to_update_history.add(model.__name__) #Instanciate a new parser for the package: - tryton_parser = convert.TrytondXmlHandler(pool=pool, module=module) + tryton_parser = convert.TrytondXmlHandler(pool=pool, module=module, + module_state=package_state) for filename in package.info.get('xml', []): filename = filename.replace('/', os.sep)