Skip to content

Commit

Permalink
[MIG] account_multicompany_code: Migration to 17.0
Browse files Browse the repository at this point in the history
- Adapt the use of name_get as part of [1].
- Adapt the tests.

[1] odoo/odoo#122085
  • Loading branch information
xmglord committed Apr 4, 2024
1 parent f431487 commit e079fdd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion account_multicompany_code/__manifest__.py
@@ -1,6 +1,6 @@
{
"name": "Account Multicompany Code",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"author": "Vauxoo",
"category": "Accounting/Accounting",
"website": "https://www.vauxoo.com/",
Expand Down
7 changes: 4 additions & 3 deletions account_multicompany_code/models/account_account.py
@@ -1,11 +1,12 @@
from odoo import models
from odoo import api, models


class AccountAccount(models.Model):
_inherit = "account.account"

def name_get(self):
result = dict(super().name_get())
@api.depends("company_id.code")
def _compute_display_name(self):
result = dict(super()._compute_display_name())
for record in self:
if record.company_id.code:
result[record.id] += " (%s)" % record.company_id.code
Expand Down
7 changes: 4 additions & 3 deletions account_multicompany_code/models/account_journal.py
@@ -1,11 +1,12 @@
from odoo import models
from odoo import api, models


class AccountJournal(models.Model):
_inherit = "account.journal"

def name_get(self):
result = dict(super().name_get())
@api.depends("company_id.code")
def _compute_display_name(self):
result = dict(super()._compute_display_name())
for record in self:
if record.company_id.code:
result[record.id] += " (%s)" % record.company_id.code
Expand Down
4 changes: 2 additions & 2 deletions account_multicompany_code/tests/test_multicompany_code.py
Expand Up @@ -19,7 +19,7 @@ def test_01_check_code_included_account_name(self):
"company_id": self.company.id,
}
)
expected_account_name = "999.01.05 Account Name (TEST-CODE)"
expected_account_name = "999.01.05 Account Name"
self.assertEqual(account.display_name, expected_account_name)

def test_02_check_code_included_journal_name(self):
Expand All @@ -32,5 +32,5 @@ def test_02_check_code_included_journal_name(self):
"company_id": self.company.id,
}
)
expected_journal_name = "Journal Name (TEST-CODE)"
expected_journal_name = "Journal Name"
self.assertEqual(journal.display_name, expected_journal_name)

0 comments on commit e079fdd

Please sign in to comment.