DomainValidationError when upgrading to 6.6

Hello,

seeing that 6.8 got released, I suddenly noticed that I was still running 6.2 :slight_smile:

So I updated that to 6.4, then proceeded to upgrade that to 6.6, but the trytond-admin --all -vv command gave an error in the account_be module:

81723 139655579260736 [2023-05-18 20:15:00,060] INFO trytond.modules account_be:loading account_be_fr.xml
Traceback (most recent call last):
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/convert.py", line 464, in parse_xmlstream
    self.sax_parser.parse(source)
  File "/usr/lib/python3.9/xml/sax/expatreader.py", line 111, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python3.9/xml/sax/xmlreader.py", line 125, in parse
    self.feed(buffer)
  File "/usr/lib/python3.9/xml/sax/expatreader.py", line 217, in feed
    self._parser.Parse(data, isFinal)
  File "../Modules/pyexpat.c", line 459, in EndElement
  File "/usr/lib/python3.9/xml/sax/expatreader.py", line 336, in end_element
    self._cont_handler.endElement(name)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/convert.py", line 510, in endElement
    self.write_records(module, model, *actions)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/convert.py", line 746, in write_records
    Model.write(*to_update)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/model/modelsql.py", line 233, in wrapper
    return func(cls, *args, **kwargs)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/model/modelsql.py", line 1287, in write
    cls._validate(sub_records, field_names=all_field_names)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/model/modelstorage.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/model/modelstorage.py", line 1379, in _validate
    validate_domain(field)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/model/modelstorage.py", line 1282, in validate_domain
    validate_relation_domain(
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/model/modelstorage.py", line 1358, in validate_relation_domain
    raise DomainValidationError(
trytond.model.modelstorage.DomainValidationError: The value "Plan de types de compte (Belgique)\Passif\Dettes\VIII. Dettes à plus d'un an\D. Autres dettes\Dettes" for field "Type" in "179 - Dettes diverses" of "Account Template" is not valid according to its domain. - 

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

Traceback (most recent call last):
  File "/home/hobbes/tryton/tryton-6.6-prod/bin/trytond-admin", line 31, in <module>
    admin.run(options)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/admin.py", line 57, in run
    pool.init(update=options.update, lang=list(lang),
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/pool.py", line 165, in init
    restart = not load_modules(
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/modules/__init__.py", line 451, in load_modules
    _load_modules(update)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/modules/__init__.py", line 419, in _load_modules
    load_module_graph(graph, pool, update, lang)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/modules/__init__.py", line 255, in load_module_graph
    tryton_parser.parse_xmlstream(fp)
  File "/home/hobbes/tryton/tryton-6.6-prod/lib/python3.9/site-packages/trytond/convert.py", line 466, in parse_xmlstream
    raise ParsingError("in %s" % self.current_state()) from e
trytond.convert.ParsingError: in ?

Do I have to do something when upgrading to convert my account plan to the new template ? Or is the template plan itself somehow borked ?

Thanks

This is strange because the field “Type” on “Account Template” has no domain in standard module.
Have you any custom module that adds a constraint?

Just to clarify, there is no need to upgrade to each version in separate steps. You can upgrade from 6.2 to 6.8 by running all the migration steps and performing a single update on the database.

Nope, no custom module. Here is the list of modules that I used to install:

trytond==6.6.*
trytond-account==6.6.*
trytond-account-invoice==6.6.*
trytond-account-invoice-stock==6.6.*
trytond-account-payment==6.6.*
trytond-account-product==6.6.*
trytond-account-be==6.6.*
trytond-account-statement==6.6.*
trytond-account-dunning==6.6.*
trytond-account-dunning-email==6.6.*
trytond-account-deposit==6.6.*
trytond-bank==6.6.*
trytond-company==6.6.*
trytond-country==6.6.*
trytond-currency==6.6.*
trytond-party==6.6.*
trytond-product==6.6.*
trytond-product-price-list==6.6.*
trytond-purchase==6.6.*
trytond-purchase-request==6.6.*
trytond-purchase-shipment-cost==6.6.*
trytond-purchase-history==6.6.*
trytond-purchase-amendment==6.6.*
trytond-sale==6.6.*
trytond-sale-amendment==6.6.*
trytond-sale-history==6.6.*
trytond-sale-subscription==6.6.*
trytond-sale-shipment-cost==6.6.*
trytond-stock==6.6.*
trytond-stock-supply==6.6.*

The only thing that I note is that «Plan de types de compte (Belgique)\Passif\Dettes\VIII. Dettes à plus d’un an\D. Autres dettes\Dettes» does not exist in the 6.4 Belgian accounting template plan, it was added in 6.6. In 6.4, the tree stops at «Plan de types de compte (Belgique)\Passif\Dettes\VIII. Dettes à plus d’un an\D. Autres dettes»

Thanks

oh cool, I didn’t know that, much simpler :slight_smile:

I’ll try a direct upgrade and see what happens.

Thanks

I was wrong there is actually a domain on “Type” field which requires to have the same type as the parent if the parent has one.
Normally the account 17 which is the parent should not have a type. Did you modify the template to add such type?

not to my knowledge, but in the account_be_fr.xml file for 6.2 they do have a type, and it’s not the same:

        <record id="17_fr" model="account.account.template">
            <field name="name">Dettes à plus d'un an</field>
            <field name="code">17</field>
            <field name="type" ref="passif_VIII_fr"/>
            <field name="closed" eval="True"/>
            <field name="parent" ref="1_fr"/>
        </record>
...

        <record id="179_fr" model="account.account.template">
            <field name="name">Dettes diverses</field>
            
            <field name="code">179</field>
            <field name="type" ref="passif_VIII_D_fr"/>
            <field name="closed" eval="True"/>
            <field name="parent" ref="17_fr"/>
        </record>

I also noticed something strange in the 6.4 installation, probably related to that modification in the plan template:

  • when in the account template tree, I can develop the tree for the Belgian PCN to the 17 branch without problem
  • I then toggle to form view for the 17 branch, and it does have a type: «Plan de types de compte (Belgique)\Passif\Dettes\VIII. Dettes à plus d’un an»). Probably inherited from 6.2 ?
  • I toggle back to tree view
  • as soon as I develop the 17 branch further, tryton proposes to save the form. I didn’t modify anything, I just developped the branch, but tryton considers that I changed something and wants to save
  • if I push the reload button, tryton proposes to save, not save, cancel
  • I don’t save, just reload the tree, and the save button is still activated

As long as the 17 branch is developped, whatever the action I want to do in that tree/form view, tryton will always propose to save. I don’t save since I don’t know what it wants to save.

As soon as I fold the 17 branch of the tree, that behaviour stops.

Is that related to the 6.2 plan template that I seem to have inherited ? Why does 6.4 happily lives with it, but not 6.6 ? Do I have to do something to convert my old template to the new one ? Is this desirable ?

Thanks

I filled Can not update chart template from older versions (#12280) · Issues · Tryton / Tryton · GitLab

ok thanks, I’ll stay on 6.4 until that is released.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.