forked from Vauxoo/addons-vauxoo
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] account_multicompany_code: Migration to 17.0
- Adapt the use of name_get as part of [1]. [1] odoo/odoo#122085
- Loading branch information
Showing
3 changed files
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |