Skip to content

Commit

Permalink
[FIX] account_fiscal_year_closing - create/write
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mde-scopea committed Mar 14, 2024
1 parent 09da210 commit 2fa2502
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2fa2502

Please sign in to comment.