Skip to content

Commit

Permalink
[UPD] add test for the archive config
Browse files Browse the repository at this point in the history
  • Loading branch information
nayatec committed Oct 24, 2024
1 parent 2f902ef commit 433fec1
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion sale_import_base/tests/test_sale_order_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_create_partner(self):
"""
Base scenario: import Sale Order with standard data
-> Create partner
-> Create delivery, shipping addresses in inactive state
-> Create delivery, shipping addresses in inactive state by default
"""
partner_count = (
self.env["res.partner"].with_context(active_test=False).search_count([])
Expand All @@ -74,6 +74,30 @@ def test_create_partner(self):
self.assertEqual(sale.partner_invoice_id.type, "invoice")
self.assertEqual(sale.partner_invoice_id.active, False)

def test_create_partner_no_archive(self):
"""
Base scenario: import Sale Order with standard data
-> Create partner
-> Create delivery, shipping addresses remains active because
it has been configured with auto_archive_addresses = False
"""
partner_count = (
self.env["res.partner"].with_context(active_test=False).search_count([])
)
chunk_vals = self.get_chunk_vals("all")
channel = self.env["sale.channel"].browse(chunk_vals["record_id"])
channel.auto_archive_addresses = False
self._helper_create_chunk(chunk_vals)
partner_count_after_import = (
self.env["res.partner"].with_context(active_test=False).search_count([])
)
self.assertEqual(partner_count_after_import, partner_count + 3)
sale = self.get_created_sales()
self.assertEqual(sale.partner_shipping_id.type, "delivery")
self.assertEqual(sale.partner_shipping_id.active, True)
self.assertEqual(sale.partner_invoice_id.type, "invoice")
self.assertEqual(sale.partner_invoice_id.active, True)

def test_create_addresses_identical(self):
"""
Test if shipping and invoice addresses are the same,
Expand Down

0 comments on commit 433fec1

Please sign in to comment.