11# Copyright 2018 Tecnativa - Sergio Teruel
22# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+ from odoo import Command
34from odoo .tests import Form , tagged
45
56from odoo .addons .account .tests .common import AccountTestInvoicingCommon
@@ -11,9 +12,21 @@ class TestSaleElaboration(AccountTestInvoicingCommon):
1112 def setUpClass (cls ):
1213 super ().setUpClass ()
1314 cls .Elaboration = cls .env ["product.elaboration" ]
15+ cls .ElaborationProfile = cls .env ["product.elaboration.profile" ]
16+ cls .category_1 = cls .env ["product.category" ].create ({"name" : "Meat" })
17+ cls .category_2 = cls .env ["product.category" ].create ({"name" : "Fish" })
1418 cls .product = cls .env ["product.product" ].create (
1519 {"name" : "test" , "tracking" : "none" , "list_price" : 1000 }
1620 )
21+ cls .product_2 = cls .env ["product.product" ].create (
22+ {"name" : "test 2" , "tracking" : "none" , "list_price" : 1000 }
23+ )
24+ cls .product_3 = cls .env ["product.product" ].create (
25+ {"name" : "test 2" , "tracking" : "none" , "list_price" : 1000 }
26+ )
27+ cls .product .categ_id = cls .category_1
28+ cls .product_2 .categ_id = cls .category_2
29+ cls .product_3 .categ_id = cls .category_1
1730 cls .product_elaboration_A = cls .env ["product.product" ].create (
1831 {
1932 "name" : "Product Elaboration A" ,
@@ -65,9 +78,25 @@ def setUpClass(cls):
6578 "product_id" : cls .product_elaboration_B .id ,
6679 }
6780 )
81+ cls .elaboration_profile_a = cls .ElaborationProfile .create (
82+ {
83+ "name" : "Elaboration Profile A" ,
84+ "elaboration_ids" : [
85+ Command .set ([cls .elaboration_a .id , cls .elaboration_b .id ])
86+ ],
87+ }
88+ )
89+ cls .elaboration_profile_b = cls .ElaborationProfile .create (
90+ {
91+ "name" : "Elaboration Profile B" ,
92+ "elaboration_ids" : [Command .set (cls .elaboration_a .ids )],
93+ }
94+ )
95+ cls .product .elaboration_profile_id = cls .elaboration_profile_a
6896 cls .order = cls ._create_sale_order (
6997 cls , [(cls .product , 10 , [cls .elaboration_a ])]
7098 )
99+ cls .category_1 .elaboration_profile_id = cls .elaboration_profile_b
71100
72101 def _create_sale_order (self , products_info ):
73102 order_form = Form (self .env ["sale.order" ])
0 commit comments