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].

[1] odoo/odoo#122085
  • Loading branch information
xmglord committed Apr 4, 2024
1 parent 95820ee commit e8963d2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 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
15 changes: 8 additions & 7 deletions account_multicompany_code/models/account_account.py
@@ -1,12 +1,13 @@
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())
for record in self:
if record.company_id.code:
result[record.id] += " (%s)" % record.company_id.code
return list(result.items())
@api.depends("company_id.code")
def _compute_display_name(self):
res = super()._compute_display_name()
for record in self.filtered("company_id.code"):
record.display_name += " (%s)" % record.company_id.code

return res
15 changes: 8 additions & 7 deletions account_multicompany_code/models/account_journal.py
@@ -1,12 +1,13 @@
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())
for record in self:
if record.company_id.code:
result[record.id] += " (%s)" % record.company_id.code
return list(result.items())
@api.depends("company_id.code")
def _compute_display_name(self):
res = super()._compute_display_name()
for record in self.filtered("company_id.code"):
record.display_name += " (%s)" % record.company_id.code

return res

0 comments on commit e8963d2

Please sign in to comment.