From 9ee07460916a3f67d46dfca72df4fec8ab63188a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Thu, 23 Nov 2023 17:29:38 +0100 Subject: [PATCH] allow multi-company MIS budgets by account --- mis_builder_budget/models/mis_budget_by_account.py | 2 +- mis_builder_budget/models/mis_budget_by_account_item.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mis_builder_budget/models/mis_budget_by_account.py b/mis_builder_budget/models/mis_budget_by_account.py index ff3eea396..16aa16fd0 100644 --- a/mis_builder_budget/models/mis_budget_by_account.py +++ b/mis_builder_budget/models/mis_budget_by_account.py @@ -12,7 +12,7 @@ class MisBudgetByAccount(models.Model): item_ids = fields.One2many( comodel_name="mis.budget.by.account.item", inverse_name="budget_id", copy=True ) - company_id = fields.Many2one(required=True) + company_id = fields.Many2one(required=False) allow_items_overlap = fields.Boolean( help="If checked, overlap between budget items is allowed" ) diff --git a/mis_builder_budget/models/mis_budget_by_account_item.py b/mis_builder_budget/models/mis_budget_by_account_item.py index 7c00e3f6d..cab9e0481 100644 --- a/mis_builder_budget/models/mis_budget_by_account_item.py +++ b/mis_builder_budget/models/mis_budget_by_account_item.py @@ -26,12 +26,13 @@ class MisBudgetByAccountItem(models.Model): ) company_id = fields.Many2one( "res.company", - related="budget_id.company_id", + related="account_id.company_id", + readonly=True, store=True, ) company_currency_id = fields.Many2one( "res.currency", - related="budget_id.company_id.currency_id", + related="account_id.company_id.currency_id", string="Company Currency", help="Utility field to express amount currency", store=True, @@ -40,7 +41,6 @@ class MisBudgetByAccountItem(models.Model): comodel_name="account.account", string="Account", required=True, - # TODO domain (company_id) ) _sql_constraints = [