6.2 -> 6.4 Upgrade: ParsingError: in record 'account_statement.journal_statement'

After upgrading from 6.2 to 6.4, database upgrade fail to complete.

trytond-admin -c trytond.conf -d luthierio --all 
Traceback (most recent call last):
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/convert.py", line 464, in parse_xmlstream
    self.sax_parser.parse(source)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 111, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python3.7/xml/sax/xmlreader.py", line 125, in parse
    self.feed(buffer)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 217, in feed
    self._parser.Parse(data, isFinal)
  File "../Modules/pyexpat.c", line 471, in EndElement
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 336, in end_element
    self._cont_handler.endElement(name)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/convert.py", line 519, in endElement
    self.taghandler = self.taghandler.endElement(name)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/convert.py", line 315, in endElement
    self.model.__name__, self.values, self.xml_id)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/convert.py", line 695, in import_record
    self.create_records(model, [values], [fs_id])
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/convert.py", line 701, in create_records
    records = Model.create(vlist)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelsql.py", line 161, in wrapper
    return func(cls, *args, **kwargs)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelsql.py", line 718, in create
    field.set(cls, fname, *fargs)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/fields/function.py", line 153, in set
    setter(Model.browse(ids), name, value)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/multivalue.py", line 94, in _multivalue_setter
    Value.save(to_save)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/descriptors.py", line 33, in newfunc
    return self.func(owner, *args, **kwargs)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelstorage.py", line 1910, in save
    news = cls.create([save_values[r] for r in to_create])
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelsql.py", line 161, in wrapper
    return func(cls, *args, **kwargs)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelsql.py", line 726, in create
    cls._validate(sub_records)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelstorage.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelstorage.py", line 1327, in _validate
    validate_domain(field)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelstorage.py", line 1251, in validate_domain
    field, list(sub_records), Relation, sub_domain)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/model/modelstorage.py", line 1309, in validate_relation_domain
    msg, domain=(invalid_domain, field_def))
trytond.model.modelstorage.DomainValidationError: The value for field "Sequence" in "Journal Sequence" is not valid according to its domain. - 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/tryton/venv_6.4/bin/trytond-admin", line 23, in <module>
    admin.run(options)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/admin.py", line 58, in run
    activatedeps=options.activatedeps)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/pool.py", line 167, in init
    activatedeps=activatedeps)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/modules/__init__.py", line 438, in load_modules
    _load_modules(update)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/modules/__init__.py", line 406, in _load_modules
    load_module_graph(graph, pool, update, lang)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/modules/__init__.py", line 252, in load_module_graph
    tryton_parser.parse_xmlstream(fp)
  File "/root/tryton/venv_6.4/lib/python3.7/site-packages/trytond/convert.py", line 466, in parse_xmlstream
    raise ParsingError("in %s" % self.current_state()) from e
trytond.convert.ParsingError: in record 'account_statement.journal_statement'

Later in the client I’ve also few errors but a successful upgrade should be the first step!
Could you help to fix?

It sounds like your “Default Account Journal” sequence has a company set. This prevents the creation of the “Statement” journal.
I guess we should force no company on ‘sequence_account_journal’.

Indeed the upgrade is successfull after I remove the company from these sequences. Not sure to understand implications but it works now.