Skip to content

Commit 67c77f4

Browse files
pedrobaezayankinmax
authored andcommitted
[IMP] purchase_product_pack: Don't depend on demo data for tests + simplification
Demo data can make tests to fail in integration environments or locally modified ones, so let's remove them and use data created on the test itself. We also improve the containerization of the elements of the tests. In the same movement, we have simplified the code of the test for doing the same with less lines and in a clearer way.
1 parent df48829 commit 67c77f4

File tree

5 files changed

+109
-248
lines changed

5 files changed

+109
-248
lines changed

purchase_product_pack/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Purchase Product Pack
1111
!! This file is generated by oca-gen-addon-readme !!
1212
!! changes will be overwritten. !!
1313
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14-
!! source digest: sha256:c2dac7004783b8033eccca5252ad883ba2106fc36f774bb5680b539f372092be
14+
!! source digest: sha256:174830ce41fbd8cb9d00dc617945dbe3dbdf80407c03659afcd2516798284699
1515
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1616
1717
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

purchase_product_pack/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
33
{
44
"name": "Purchase Product Pack",
5-
"version": "18.0.1.0.0",
5+
"version": "18.0.1.0.1",
66
"category": "Purchase",
77
"summary": "This module allows you to buy product packs",
88
"website": "https://github.com/OCA/product-pack",

purchase_product_pack/static/description/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ <h1>Purchase Product Pack</h1>
372372
!! This file is generated by oca-gen-addon-readme !!
373373
!! changes will be overwritten. !!
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375-
!! source digest: sha256:c2dac7004783b8033eccca5252ad883ba2106fc36f774bb5680b539f372092be
375+
!! source digest: sha256:174830ce41fbd8cb9d00dc617945dbe3dbdf80407c03659afcd2516798284699
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377377
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-pack/tree/18.0/purchase_product_pack"><img alt="OCA/product-pack" src="https://img.shields.io/badge/github-OCA%2Fproduct--pack-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-pack-18-0/product-pack-18-0-purchase_product_pack"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-pack&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>This module adds <em>Product Pack</em> functionality to purchase orders. You
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2025 Tecnativa - Pedro M. Baeza
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo.addons.product_pack.tests.common import ProductPackCommon
5+
6+
7+
class TestPurchaseProductPackBase(ProductPackCommon):
8+
@classmethod
9+
def setUpClass(cls):
10+
super().setUpClass()
11+
cls.partner = cls.env["res.partner"].create({"name": "Test purchase pack"})
12+
cls.pack.standard_price = 5
13+
cls.component1.standard_price = 12
14+
cls.component2.standard_price = 18
15+
cls.purchase_order = cls.env["purchase.order"].create(
16+
{"partner_id": cls.partner.id}
17+
)
18+
19+
def _add_po_line(self, product=None, sequence=10):
20+
product = product or self.pack
21+
return self.env["purchase.order.line"].create(
22+
{
23+
"order_id": self.purchase_order.id,
24+
"name": product.name,
25+
"product_id": product.id,
26+
"product_qty": 1,
27+
"sequence": sequence,
28+
}
29+
)

0 commit comments

Comments
 (0)