diff --git a/account_financial_report/models/res_config_settings.py b/account_financial_report/models/res_config_settings.py index 56826b0e927..087ed337ffc 100644 --- a/account_financial_report/models/res_config_settings.py +++ b/account_financial_report/models/res_config_settings.py @@ -1,14 +1,36 @@ # Copyright 2023 Tecnativa - Carolina Fernandez # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -from odoo import fields, models +from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" - default_age_partner_config_id = fields.Many2one( + age_partner_config_id = fields.Many2one( "account.age.report.configuration", string="Intervals configuration", - default_model="aged.partner.balance.report.wizard", ) + + def set_values(self): + self.env["ir.default"].sudo().set( + "aged.partner.balance.report.wizard", + "age_partner_config_id", + self.age_partner_config_id.id, + company_id=self.env.company.id, + ) + return super().set_values() + + @api.model + def get_values(self): + res = super(ResConfigSettings, self).get_values() + res.update( + age_partner_config_id=self.env["ir.default"] + .sudo() + .get( + "aged.partner.balance.report.wizard", + "age_partner_config_id", + company_id=self.env.company.id, + ) + ) + return res diff --git a/account_financial_report/view/res_config_settings_views.xml b/account_financial_report/view/res_config_settings_views.xml index 91509e85fa1..bdcd3f1f151 100644 --- a/account_financial_report/view/res_config_settings_views.xml +++ b/account_financial_report/view/res_config_settings_views.xml @@ -28,11 +28,11 @@