Module
l10n_it_riba_oca
Current behavior
When configuring the RiBa collection fees service product (due_cost_service_id) in Settings → Accounting → RiBa Collection Fees in a multi-company environment, the setting does not persist correctly.
The value shown in the settings form always reflects the user's main company (self.env.user.company_id), not the company currently selected in the settings form.
Steps to reproduce
- Have a multi-company setup (Company A, Company B)
- Log in as a user whose main company is Company A
- Switch to Company B in the settings
- Set a product for "RiBa Collection Fees" → Save
- Reopen settings for Company B → the value shows Company A's setting (or blank)
Root cause
The default_get override in ResConfigSettings (models/account_config.py) hardcodes self.env.user.company_id.due_cost_service_id:
@api.model
def default_get(self, fields_list):
res = super().default_get(fields_list)
if res:
res["due_cost_service_id"] = self.env.user.company_id.due_cost_service_id.id
return res
This ignores the company_id field on the settings form (which reflects the company being configured). The related="company_id.due_cost_service_id" field already handles reading/writing to the correct company — the default_get override is a legacy pattern that conflicts with this mechanism.
Expected behavior
The setting should correctly read from and write to the company selected in the settings form, working seamlessly in multi-company environments.
Proposed fix
Remove the default_get override entirely. The related field handles everything correctly on its own.
Version
18.0
Module
l10n_it_riba_oca
Current behavior
When configuring the RiBa collection fees service product (
due_cost_service_id) in Settings → Accounting → RiBa Collection Fees in a multi-company environment, the setting does not persist correctly.The value shown in the settings form always reflects the user's main company (
self.env.user.company_id), not the company currently selected in the settings form.Steps to reproduce
Root cause
The
default_getoverride inResConfigSettings(models/account_config.py) hardcodesself.env.user.company_id.due_cost_service_id:This ignores the
company_idfield on the settings form (which reflects the company being configured). Therelated="company_id.due_cost_service_id"field already handles reading/writing to the correct company — thedefault_getoverride is a legacy pattern that conflicts with this mechanism.Expected behavior
The setting should correctly read from and write to the company selected in the settings form, working seamlessly in multi-company environments.
Proposed fix
Remove the
default_getoverride entirely. Therelatedfield handles everything correctly on its own.Version
18.0