Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion openupgrade_scripts/scripts/account/tests/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
# call sending wizard on some moves asynchronously
action = (
env["account.move"]
.search([("move_type", "=", "out_invoice")])
.search(
[
("move_type", "=", "out_invoice"),
("state", "=", "posted"),
("company_id", "=", env.ref("base.main_company").id),
]
)
.action_send_and_print()
)
env[action["res_model"]].with_context(**action["context"]).create(
Expand Down
25 changes: 25 additions & 0 deletions openupgrade_scripts/scripts/account/tests/test_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from odoo.tests import TransactionCase

from odoo.addons.openupgrade_framework import openupgrade_test


@openupgrade_test
class TestAccountMigration(TransactionCase):
def test_sending_data(self):
"""
Test that me migrate send_and_print_values correctly to sending_data
"""
moves_with_sending_data = self.env["account.move"].search(
[
("sending_data", "!=", False),
]
)
self.assertTrue(moves_with_sending_data)
self.assertEqual(
moves_with_sending_data[0].sending_data["author_user_id"],
self.env.user.id,
)
self.assertEqual(
moves_with_sending_data[0].sending_data["author_partner_id"],
self.env.user.partner_id.id,
)