-
-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] account_financial_report : make aged report configuration worki…
…ng with multi-company
- Loading branch information
1 parent
7a752b3
commit 5853bec
Showing
7 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
account_financial_report/migrations/16.0.1.12.0/post-migrate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import json | ||
|
||
from odoo import SUPERUSER_ID, api | ||
|
||
|
||
def migrate(cr, version): | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
field = env["ir.model.fields"]._get( | ||
"aged.partner.balance.report.wizard", "age_partner_config_id" | ||
) | ||
default = env["ir.default"].search( | ||
[ | ||
("field_id", "=", field.id), | ||
("user_id", "=", False), | ||
("company_id", "=", False), | ||
("condition", "=", False), | ||
], | ||
limit=1, | ||
) | ||
aged_config_id = json.loads(default.json_value) if default else None | ||
if aged_config_id: | ||
config = env["account.age.report.configuration"].browse(aged_config_id) | ||
if config.exists(): | ||
company = config.company_id | ||
if company: | ||
company.write({"age_partner_config_id": config.id}) | ||
default.unlink() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
age_partner_config_id = fields.Many2one( | ||
comodel_name="account.age.report.configuration", | ||
string="Intervals configuration", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters