[ADD] sale_order_line_date_next_reception
This commit is contained in:
2
sale_order_line_date_next_reception/tests/__init__.py
Normal file
2
sale_order_line_date_next_reception/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# from . import test_sale_line_number
|
||||
from . import test_sale_line_reception_date
|
||||
@@ -0,0 +1,58 @@
|
||||
# Copyright 2024 Akretion (http://www.akretion.com).
|
||||
# @author Mathieu DELVA <mathieu.delva@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
||||
class TestSaleLineReceptionDate(TransactionCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.partner = self.env.ref("base.res_partner_12")
|
||||
self.product_id = self.env.ref("product.product_product_5")
|
||||
|
||||
self.purchase_order = self.env["purchase.order"].create(
|
||||
{
|
||||
"partner_id": self.partner.id,
|
||||
"date_order": datetime.today() + relativedelta(days=10),
|
||||
"order_line": [(0, 0, {
|
||||
"product_id": self.product_id.id,
|
||||
"product_qty": 5,
|
||||
})]
|
||||
})
|
||||
|
||||
def test_date_next_reception(self):
|
||||
self.purchase_order.button_confirm()
|
||||
self.sale_order = self.env["sale.order"].create(
|
||||
{
|
||||
"partner_id": self.partner.id,
|
||||
"order_line": [(0, 0, {
|
||||
"product_id": self.product_id.id,
|
||||
"product_uom_qty": 2
|
||||
})]
|
||||
})
|
||||
self.assertEqual(self.purchase_order.date_planned.date(), self.sale_order.order_line.date_next_reception)
|
||||
|
||||
def test_2_date_next_reception(self):
|
||||
self.purchase_order.button_confirm()
|
||||
self.purchase_order2 = self.env["purchase.order"].create(
|
||||
{
|
||||
"partner_id": self.partner.id,
|
||||
"date_order": datetime.today() + relativedelta(days=4),
|
||||
"order_line": [(0, 0, {
|
||||
"product_id": self.product_id.id,
|
||||
"product_qty": 5,
|
||||
})]
|
||||
})
|
||||
self.sale_order = self.env["sale.order"].create(
|
||||
{
|
||||
"partner_id": self.partner.id,
|
||||
"order_line": [(0, 0, {
|
||||
"product_id": self.product_id.id,
|
||||
"product_uom_qty": 2
|
||||
})]
|
||||
})
|
||||
self.purchase_order2.button_confirm()
|
||||
self.assertEqual(self.purchase_order2.date_planned.date(), self.sale_order.order_line.date_next_reception)
|
||||
Reference in New Issue
Block a user