Tryton has configuration forms that are used to store most settings that affect the behaviour of the system. There’s also a configuration file but most of the time that configuration file is used for system-specific settings:
- The path of the attachments
- What IP or port it must listen to
- URI of the database
- etc
However, there’s the unit_price_digits setting that does not depend on the system and affects the behaviour of Tryton but that is stored in trytond.conf. It seems to me that it’s easy to mess things to have unit_price_digits in trytond.conf and is not consistent with other settings. Otherwise, why do we store the main language in “ir.configuration”? Or why don’t we have a flag in trytond.conf to set the default invoicing policy of sales?
I think that when unit_price_digits was introduced it was added to the configuration file justified by performance reasons. However, I think recently we’ve seen that getting settings from the configuration file was not cheap either, and anyway we’re doing lots of other database access for getting settings (number of digits of quantities, default accounts, etc) and we even have a cache to manage all that.
So my proposal would be to store “unit_price_digits” as a field in “product.configuration” model.
This ensures that when you restore the database you’ve got almost everything that is necessary to make it work as the backed-up one, except, of course for the system-specific settings that cannot be “copied” from one system to the other because IPs, ports, databases, or paths will probably change.
Thoughts?