Skip to content

Commit 7c19d7b

Browse files
[ADD] sale_order_invoicing_policy: add tests
1 parent ee63334 commit 7c19d7b

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

sale_order_invoicing_policy/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"summary": "",
66
"version": "12.0.1.0.0",
77
"category": "Sale",
8-
"website": "https://www.quartile.co/",
8+
"website": "https://www.quartile.co",
99
"author": "Quartile Limited",
1010
"license": "AGPL-3",
1111
"installable": True,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_sale_order_invoicing_policy
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright 2023 Quartile Limited
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo.tests.common import TransactionCase
5+
6+
7+
class TestSaleOrderInvoicingPolicy(TransactionCase):
8+
def setUp(self):
9+
super(TestSaleOrderInvoicingPolicy, self).setUp()
10+
self.partner = self.env.ref("base.res_partner_2")
11+
self.product1 = self.env["product.product"].create(
12+
{"name": "Test Product", "type": "consu"}
13+
)
14+
15+
def test_sale_order_invoicing_policy_order(self):
16+
sale_order = self.env["sale.order"].create(
17+
{
18+
"partner_id": self.partner.id,
19+
"invoice_policy": "order",
20+
"order_line": [
21+
(
22+
0,
23+
0,
24+
{
25+
"product_id": self.product1.id,
26+
"product_uom_qty": 2,
27+
"price_unit": 100,
28+
},
29+
)
30+
],
31+
}
32+
)
33+
sale_order.action_confirm()
34+
self.assertEqual(sale_order.order_line.qty_to_invoice, 2)
35+
36+
def test_sale_order_invoicing_policy_delivery(self):
37+
sale_order = self.env["sale.order"].create(
38+
{
39+
"partner_id": self.partner.id,
40+
"invoice_policy": "delivery",
41+
"order_line": [
42+
(
43+
0,
44+
0,
45+
{
46+
"product_id": self.product1.id,
47+
"product_uom_qty": 2,
48+
"price_unit": 100,
49+
},
50+
)
51+
],
52+
}
53+
)
54+
sale_order.action_confirm()
55+
self.assertEqual(sale_order.order_line.qty_to_invoice, 0)

0 commit comments

Comments
 (0)