From 082fdd143419a36ebbbb1f17ce6ce186157785c4 Mon Sep 17 00:00:00 2001 From: tarteo Date: Tue, 26 Mar 2024 15:16:34 +0100 Subject: [PATCH] Simple implementation of subscription trial period --- argocd_sale/tests/test_free_period.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/argocd_sale/tests/test_free_period.py b/argocd_sale/tests/test_free_period.py index f5ff8e8..6536088 100644 --- a/argocd_sale/tests/test_free_period.py +++ b/argocd_sale/tests/test_free_period.py @@ -41,7 +41,25 @@ def test_next_payment_date(self): sub.generate_invoice() sub._invoice_paid_hook() self.assertEqual( - sub.invoice_ids[0].amount_untaxed, + sub.invoice_ids[0].amount_untaxed, # It's order newest to oldest 30.0, "Next invoice should be the normal price", ) + + sub2 = self.env["sale.subscription"].create( + { + "template_id": sub_tmpl.id, + "sale_subscription_line_ids": [ + Command.create({"product_id": sub_product.id}) + ], + "partner_id": partner_id.id, + "pricelist_id": partner_id.property_product_pricelist.id, + } + ) + sub2.generate_invoice() + sub2._invoice_paid_hook() + self.assertEqual( + sub2.invoice_ids.amount_untaxed, + 30.0, + "Invoice of new second subscription must be the normal price", + )