trytond.model.modelstorage.DomainValidationError: The value “1” for field “Payable” in “South African Account Type Chart\Liability\Current Liabilities\Payable” of “Account Type Template” is not valid according to its domain.
That makes sense, thanks @JCavallo ! It does not solve my problem yet, though.
My next question is: Why does Eval('assets', False) evaluate to True? assets is not set for this account template, neither for any of its parents. So I would expect assets to be False or None.
Since I am not very familiar with the details of accounting configuration, my next step would be to debug the create function on the template, and check what parameters it gets.
But this is just debugging, I do not have a real clue as to why the field would be True.
You could try explicitely setting assets to False in your xml file, maybe that would do it (though I would still be curious what set the value to True in the first place).
This works for me as a workaround. The behavior observed is not intuitive, though, especially as I’ve seen other account templates / localization modules where assets was not set to False for payable accounts explicitly.
@fishbein2 The most probable is that a xml record with the same id was loaded which had the assets flag to True. Maybe you iterated / renamed ids in the xml file?
Tryton update does not “unset” field that are not explicitely defined in the xml file, so this can happen (and is a real pain to understand).
What you could try is to create a new DB from sratch, and install your module without your latest commit to see if the problem still happens. I did not mention it earlier because your opening post said that it was already the case, but the symptoms match.
@JCavallo I can confirm your suspicion: To verify, I started with an empty database, with the field assets being unset for the Payable account. The result is that I was able to install the module, and configure the chart of accounts for the new company successfully. (I had to fix another, unrelated issue, though.)
I feel the pain of this scenario, i.e. not being able to “unset” a field by omitting it … fortunately this is a problem of module development only, not so much for users installing modules. At least this is my understanding. What I may decide to do (to avoid this issue going forward): I can change my script that creates account.xml so that it does not rely on default values, but rather writes all values explicitly. Let me know if you think this is a good approach.
Thanks for your help today, @JCavallo and @pokoli ! Tryton has an amazing community, and I hope I can contribute back at some point.
Forcing the values for all field may not be worth it.
As you correctly deduced, it is only a real problem during development, unless you change the fields in a subsequent release, but in that case you will usually be aware of the problem (especially since it already bit you once).