onesteinbv / addons-project-nextcloud

1 stars 0 forks source link

Make configuration multicompany compliant #48

Open astirpe opened 1 year ago

astirpe commented 1 year ago

Looking at the definition of fields in res.config.settings:

    nextcloud_url = fields.Char(string="Server URL")
    nextcloud_login = fields.Char(
        string="Login", config_parameter="nextcloud_odoo_sync.nextcloud_login"
    )
    nextcloud_password = fields.Char(
        string="Password", config_parameter="nextcloud_odoo_sync.nextcloud_password"
    )

the nextcloud_url is only stored in res.config.settings which is a transient model. So when the transient record is automatically canceled by Odoo from the database, the nextcloud_url value is lost. Proposal: add the nextcloud_url in res.company and refer to it as related field from res.config.settings.

The fields nextcloud_login and nextcloud_password are stored as config_parameter, but this way they are not multicompany compliant because config_parameter is global. Proposal: add nextcloud_login and nextcloud_password in res.company and refer to them as related field from res.config.settings.

Every time nextcloud_url, nextcloud_login and nextcloud_password are called by the user, they must be read from the actual company of the current user. In case of cron jobs, all the companies should be considered.