From b54b04accdccbfca0acda8e075e0af2c4c6182f8 Mon Sep 17 00:00:00 2001 From: Borruso Date: Fri, 10 May 2024 11:16:14 +0200 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 | 8 ++++++-- 1 file changed, 6 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 7733f2eb936..b51f4d183c1 100644 --- a/account_fiscal_year_closing/models/account_fiscalyear_closing.py +++ b/account_fiscal_year_closing/models/account_fiscalyear_closing.py @@ -553,13 +553,17 @@ class AccountFiscalyearClosingMapping(models.Model): @api.model_create_multi def create(self, vals_list): for vals in vals_list: - if vals.get("dest_account_id", False): + if vals.get("dest_account_id", False) and isinstance( + vals["dest_account_id"], list + ): vals["dest_account_id"] = vals["dest_account_id"][0] res = super(AccountFiscalyearClosingMapping, self).create(vals_list) return res def write(self, vals): - if vals.get("dest_account_id", False): + if vals.get("dest_account_id", False) and isinstance( + vals["dest_account_id"], list + ): vals["dest_account_id"] = vals["dest_account_id"][0] res = super(AccountFiscalyearClosingMapping, self).write(vals) return res