Skip to content
Open
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
2 changes: 1 addition & 1 deletion sale_order_invoicing_policy/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": "",
"version": "12.0.1.0.0",
"category": "Sale",
"website": "https://www.quartile.co/",
"website": "https://www.quartile.co",
"author": "Quartile Limited",
"license": "AGPL-3",
"installable": True,
Expand Down
1 change: 1 addition & 0 deletions sale_order_invoicing_policy/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_sale_order_invoicing_policy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests.common import TransactionCase


class TestSaleOrderInvoicingPolicy(TransactionCase):
def setUp(self):
super(TestSaleOrderInvoicingPolicy, self).setUp()
self.partner = self.env.ref("base.res_partner_2")
self.product1 = self.env["product.product"].create(
{"name": "Test Product", "type": "consu"}
)

def test_sale_order_invoicing_policy_order(self):
sale_order = self.env["sale.order"].create(
{
"partner_id": self.partner.id,
"invoice_policy": "order",
"order_line": [
(
0,
0,
{
"product_id": self.product1.id,
"product_uom_qty": 2,
"price_unit": 100,
},
)
],
}
)
sale_order.action_confirm()
self.assertEqual(sale_order.order_line.qty_to_invoice, 2)

def test_sale_order_invoicing_policy_delivery(self):
sale_order = self.env["sale.order"].create(
{
"partner_id": self.partner.id,
"invoice_policy": "delivery",
"order_line": [
(
0,
0,
{
"product_id": self.product1.id,
"product_uom_qty": 2,
"price_unit": 100,
},
)
],
}
)
sale_order.action_confirm()
self.assertEqual(sale_order.order_line.qty_to_invoice, 0)