Skip to content

Commit

Permalink
[FIX][account_fiscal_year_closing] fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
matteoopenf committed Jul 13, 2022
1 parent 3444eeb commit 74a9f59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
14 changes: 2 additions & 12 deletions account_fiscal_year_closing/models/account_fiscalyear_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,23 +554,13 @@ class AccountFiscalyearClosingMapping(models.Model):
@api.model
def create(self, vals):
if "dest_account_id" in vals:
model = self.env["account.account.type"]
if isinstance(vals["dest_account_id"], list):
dest_account_id = vals["dest_account_id"][0]
elif isinstance(vals["dest_account_id"], model):
dest_account_id = vals["dest_account_id"].id
vals["dest_account_id"] = dest_account_id
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:
model = self.env["account.account.type"]
if isinstance(vals["dest_account_id"], list):
dest_account_id = vals["dest_account_id"][0]
elif isinstance(vals["dest_account_id"], model):
dest_account_id = vals["dest_account_id"].id
vals["dest_account_id"] = dest_account_id
vals["dest_account_id"] = vals["dest_account_id"][0]
res = super(AccountFiscalyearClosingMapping, self).write(vals)
return res

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def test_account_closing(self):
0,
{
"src_accounts": w,
"dest_account_id": self.a_pf_closing.id,
"dest_account_id": [self.a_pf_closing.id],
},
)
for w in inc_accounts + exp_accounts
Expand All @@ -323,7 +323,7 @@ def test_account_closing(self):
{
"name": "profit & loss",
"src_accounts": "pf_acc",
"dest_account_id": self.a_bal_closing.id,
"dest_account_id": [self.a_bal_closing.id],
},
),
],
Expand Down

0 comments on commit 74a9f59

Please sign in to comment.