Skip to content

Commit

Permalink
[MIG] account_asset_batch_compute: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Iniesta committed Mar 13, 2023
1 parent e717bc9 commit 6d8da2a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion account_asset_batch_compute/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Account Asset Batch Compute",
"summary": """
Add the possibility to compute assets in batch""",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,ForgeFlow,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ msgstr ""
#. module: account_asset_batch_compute
#: code:addons/account_asset_batch_compute/models/account_asset.py:0
#, python-format
msgid "Creating move for asset with id %s to %s"
msgid "Creating move for asset with id {rec_id} to {date_end}"
msgstr ""

#. module: account_asset_batch_compute
Expand Down
8 changes: 5 additions & 3 deletions account_asset_batch_compute/models/account_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ def _compute_entries(self, date_end, check_triggers=False):
results = []
log_error = ""
for record in self:
description = _("Creating move for asset with id %s to %s") % (
record.id,
date_end,
description = _(
"Creating move for asset with id {rec_id} to {date_end}"
).format(
rec_id=record.id,
date_end=date_end,
)
record.with_delay(description=description)._compute_entries(
date_end, check_triggers=check_triggers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,35 @@


class TestAccountAssetBatchCompute(TransactionCase):
def setUp(self):
super(TestAccountAssetBatchCompute, self).setUp()
self.wiz_obj = self.env["account.asset.compute"]
self.asset_model = self.env["account.asset"]
self.asset_profile_model = self.env["account.asset.profile"]
self.account_account_type_model = self.env["account.account.type"]
self.account_type_regular = self.account_account_type_model.create(
{"name": "Test Regular", "type": "other", "internal_group": "liability"}
)
self.account = self.env["account.account"].create(
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.wiz_obj = cls.env["account.asset.compute"]
cls.asset_model = cls.env["account.asset"]
cls.asset_profile_model = cls.env["account.asset.profile"]
cls.account = cls.env["account.account"].create(
{
"name": "Test account",
"code": "TAC",
"user_type_id": self.account_type_regular.id,
"account_type": "liability_payable",
}
)
self.journal = self.env["account.journal"].create(
cls.journal = cls.env["account.journal"].create(
{"name": "Test Journal", "code": "TJ", "type": "general"}
)
self.profile = self.asset_profile_model.create(
cls.profile = cls.asset_profile_model.create(
{
"account_expense_depreciation_id": self.account.id,
"account_asset_id": self.account.id,
"account_depreciation_id": self.account.id,
"journal_id": self.journal.id,
"account_expense_depreciation_id": cls.account.id,
"account_asset_id": cls.account.id,
"account_depreciation_id": cls.account.id,
"journal_id": cls.journal.id,
"name": "Test",
}
)
self.asset01 = self.asset_model.create(
cls.asset01 = cls.asset_model.create(
{
"name": "test asset",
"profile_id": self.profile.id,
"profile_id": cls.profile.id,
"purchase_value": 1000,
"salvage_value": 0,
"date_start": time.strftime("2003-01-01"),
Expand All @@ -55,8 +52,8 @@ def setUp(self):
)
today = date.today()
first_day_of_month = date(today.year, today.month, 1)
self.nextmonth = first_day_of_month + relativedelta.relativedelta(months=1)
self.asset01.date_start = first_day_of_month
cls.nextmonth = first_day_of_month + relativedelta.relativedelta(months=1)
cls.asset01.date_start = first_day_of_month

def test_no_batch_processing(self):
wiz = self.wiz_obj.create(
Expand Down

0 comments on commit 6d8da2a

Please sign in to comment.