Skip to content

Commit

Permalink
[FIX][account_fiscal_year_closing] fix create and write
Browse files Browse the repository at this point in the history
[FIX][account_fiscal_year_closing] fix precommit

[FIX][account_fiscal_year_closing] fix create and write

[FIX][account_fiscal_year_closing] fix test

[FIX][account_fiscal_year_closing] fix test

[FIX][account_fiscal_year_closing] fix test

[FIX][account_fiscal_year_closing] fix test

[FIX][account_fiscal_year_closing] fix test

[FIX][account_fiscal_year_closing] fix test

[FIX][account_fiscal_year_closing] fix test

[FIX][account_fiscal_year_closing] fix test

[FIX][account_fiscal_year_closing] fix test
  • Loading branch information
matteoopenf committed Jul 13, 2022
1 parent ee16e44 commit a2097ec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions account_fiscal_year_closing/models/account_fiscalyear_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,19 @@ class AccountFiscalyearClosingMapping(models.Model):
string="Destination account",
)

@api.model
def create(self, vals):
if "dest_account_id" in vals:
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:
vals["dest_account_id"] = vals["dest_account_id"][0]
res = super(AccountFiscalyearClosingMapping, self).write(vals)
return res

def dest_move_line_prepare(self, dest, balance, partner_id=False):
self.ensure_one()
move_line = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
from dateutil.relativedelta import relativedelta

from odoo import fields
from odoo.tests import tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon


@tagged("post_install")
class TestAccountFiscalYearClosing(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
Expand Down Expand Up @@ -296,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 @@ -321,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 a2097ec

Please sign in to comment.