From 2fa250213ba6da8de87724b7dc6602a743e7b69d Mon Sep 17 00:00:00 2001 From: mde-spring <79934758+mde-spring@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:41:15 +0100 Subject: [PATCH] [FIX] account_fiscal_year_closing - create/write When creating from scratch, Mapping is used as an Array instead of simple id (due to many in another many). When coming from a template, id is used To take into account this particularity, check the type before taking the id of the array. --- .../models/account_fiscalyear_closing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_fiscal_year_closing/models/account_fiscalyear_closing.py b/account_fiscal_year_closing/models/account_fiscalyear_closing.py index 3393971387e..94cdf52458b 100644 --- a/account_fiscal_year_closing/models/account_fiscalyear_closing.py +++ b/account_fiscal_year_closing/models/account_fiscalyear_closing.py @@ -553,13 +553,13 @@ class AccountFiscalyearClosingMapping(models.Model): @api.model def create(self, vals): - if "dest_account_id" in vals: + if "dest_account_id" in vals and type(vals["dest_account_id"]) == list: vals["dest_account_id"] = vals["dest_account_id"][0] res = super(AccountFiscalyearClosingMapping, self).create(vals) return res def write(self, vals): - if "dest_account_id" in vals: + if "dest_account_id" in vals and type(vals["dest_account_id"]) == list: vals["dest_account_id"] = vals["dest_account_id"][0] res = super(AccountFiscalyearClosingMapping, self).write(vals) return res