Skip to content

Commit

Permalink
[MIG] account_analytic_tag_default: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JasminSForgeFlow committed Mar 21, 2022
1 parent 257db21 commit 2638c86
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion account_analytic_tag_default/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Account Analytic Tag Default",
"summary": "Set default tags on analytic accounts.",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-analytic",
Expand Down
2 changes: 2 additions & 0 deletions account_analytic_tag_default/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class AccountMoveLine(models.Model):
@api.depends("analytic_account_id")
def _compute_analytic_tag_ids(self):
for rec in self:
if not rec._origin and rec.analytic_tag_ids:
continue
if rec.analytic_account_id.default_analytic_tag_ids:
rec.analytic_tag_ids = rec.analytic_account_id.default_analytic_tag_ids
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def setUp(self):
)

def test_01_create_entry_no_tags(self):
invoice = self.move_obj.with_context(default_type="out_invoice").create(
invoice = self.move_obj.with_context(default_move_type="out_invoice").create(
{
"type": "out_invoice",
"move_type": "out_invoice",
"company_id": self.company.id,
"journal_id": self.journal.id,
"partner_id": self.partner1.id,
Expand All @@ -65,9 +65,9 @@ def test_01_create_entry_no_tags(self):
self.assertEqual(invoice.invoice_line_ids.analytic_tag_ids, self.tag_03)

def test_02_create_entry_with_different_tags(self):
invoice = self.move_obj.with_context(default_type="out_invoice").create(
invoice = self.move_obj.with_context(default_move_type="out_invoice").create(
{
"type": "out_invoice",
"move_type": "out_invoice",
"company_id": self.company.id,
"journal_id": self.journal.id,
"partner_id": self.partner1.id,
Expand Down

0 comments on commit 2638c86

Please sign in to comment.