-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[17.0][UT] purchase_product_pack: test purchase order
- Loading branch information
1 parent
31c2f69
commit 7c7d755
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from odoo.tests.common import TransactionCase | ||
from odoo.exceptions import UserError | ||
|
||
class TestPurchaseOrder(TransactionCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.purchase_order = cls.env["purchase.order"].create({ | ||
"partner_id": cls.env.ref("base.res_partner_12").id, | ||
}) | ||
|
||
cls.product = cls.env["product.product"].create({ | ||
'name': 'Test Product', | ||
'type': 'consu', | ||
}) | ||
|
||
cls.pack_product = cls.env["product.product"].create({ | ||
'name': 'Pack Product', | ||
'type': 'consu', | ||
'pack_ok': True, | ||
'pack_type': 'detailed', | ||
}) | ||
|
||
def test_copy_data(self): | ||
order_line = self.env["purchase.order.line"].create({ | ||
'order_id': self.purchase_order.id, | ||
'product_id': self.product.id, | ||
'name': self.product.name, | ||
'product_qty': 1, | ||
'price_unit': 100, | ||
}) | ||
|
||
data = self.purchase_order.copy_data() | ||
self.assertTrue(data) | ||
self.assertIn('order_line', data[0]) | ||
self.assertEqual(len(data[0]['order_line']), 1) | ||
self.assertEqual(data[0]['order_line'][0][2]['product_id'], self.product.id) | ||
|
||
|