Skip to content

Commit

Permalink
[MIG] account_move_line_accounting_description: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlokr committed Sep 9, 2024
1 parent 969888f commit 6fb8c69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions account_move_line_accounting_description/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
class AccountMoveLine(models.Model):
_inherit = "account.move.line"

external_name = fields.Char()
external_name = fields.Char(compute="_compute_name_fields", store=True)

@api.onchange("product_id")
def _onchange_product_id(self):
super()._onchange_product_id()
@api.depends("product_id")
def _compute_name_fields(self):
for line in self:
line.external_name = line.name
if line.product_id.accounting_description:
line.name = line.product_id.accounting_description
return
else:
line.name = line.external_name
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests import Form
from odoo.tests.common import SavepointCase
from odoo.tests.common import TransactionCase


class TestAccountLineDescription(SavepointCase):
class TestAccountLineDescription(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand All @@ -20,7 +20,7 @@ def setUpClass(cls):
cls.product_with_acc_desc.categ_id = consumable_cat
cls.product_without_acc_desc.categ_id = consumable_cat

cls.product_with_acc_desc.accounting_description = "Product1_acc_desc"
cls.product_with_acc_desc.accounting_description = "Virtual Interior Design"

cls.account_move = cls.env["account.move"]

Expand Down

0 comments on commit 6fb8c69

Please sign in to comment.