|
1 | 1 | # Copyright 2023 Tecnativa - Carolina Fernandez
|
2 | 2 | # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
3 | 3 |
|
4 |
| -from odoo import fields, models |
| 4 | +from odoo import api, fields, models |
5 | 5 |
|
6 | 6 |
|
7 | 7 | class ResConfigSettings(models.TransientModel):
|
8 | 8 | _inherit = "res.config.settings"
|
9 | 9 |
|
10 |
| - default_age_partner_config_id = fields.Many2one( |
| 10 | + age_partner_config_id = fields.Many2one( |
11 | 11 | "account.age.report.configuration",
|
12 | 12 | string="Intervals configuration",
|
13 |
| - default_model="aged.partner.balance.report.wizard", |
14 | 13 | )
|
| 14 | + |
| 15 | + def set_values(self): |
| 16 | + company = self.env.company |
| 17 | + self.env["ir.default"].sudo().set( |
| 18 | + "aged.partner.balance.report.wizard", |
| 19 | + "age_partner_config_id", |
| 20 | + self.age_partner_config_id.id, |
| 21 | + company_id=company.id, |
| 22 | + ) |
| 23 | + return super().set_values() |
| 24 | + |
| 25 | + @api.model |
| 26 | + def get_values(self): |
| 27 | + res = super(ResConfigSettings, self).get_values() |
| 28 | + company = self.env.company |
| 29 | + res.update( |
| 30 | + age_partner_config_id=self.env["ir.default"] |
| 31 | + .sudo() |
| 32 | + .get( |
| 33 | + "aged.partner.balance.report.wizard", |
| 34 | + "age_partner_config_id", |
| 35 | + company_id=company.id, |
| 36 | + ) |
| 37 | + ) |
| 38 | + return res |
0 commit comments