55
66from odoo import Command
77
8- from odoo .addons .edi_oca .tests .common import EDIBackendCommonComponentTestCase
8+ from odoo .addons .edi_component_oca .tests .common import EDIBackendCommonComponentTestCase
99
1010
1111class TestsPurchaseEDIConfiguration (EDIBackendCommonComponentTestCase ):
@@ -19,8 +19,28 @@ def setUpClass(cls):
1919 "default_code" : "1234567" ,
2020 }
2121 )
22- cls .exc_type_out = cls .env .ref ("edi_purchase_oca.demo_edi_exc_type_order_out" )
23- cls .edi_conf = cls .env .ref ("edi_purchase_oca.demo_edi_configuration_confirmed" )
22+ cls .exc_type_out = cls ._create_exchange_type (
23+ name = "Demo Purchase Order out" ,
24+ code = "demo_PurchaseOrder_out" ,
25+ direction = "output" ,
26+ exchange_filename_pattern = "{record_name}-{type.code}-{dt}" ,
27+ exchange_file_ext = "xml" ,
28+ )
29+ cls .edi_conf = cls .env ["edi.configuration" ].create (
30+ {
31+ "name" : "Demo PO send" ,
32+ "type_id" : cls .exc_type_out .id ,
33+ "backend_id" : cls .backend .id ,
34+ "model_id" : cls .env ["ir.model" ]._get_id ("purchase.order" ),
35+ "trigger_id" : cls .env .ref (
36+ "edi_purchase_oca.edi_conf_trigger_purchase_order_state_change"
37+ ).id ,
38+ "snippet_do" : (
39+ "if record.state == 'purchase':\n "
40+ " record._edi_send_via_edi(conf.type_id)"
41+ ),
42+ }
43+ )
2444 cls .partner .edi_purchase_conf_ids = cls .edi_conf
2545
2646 @mock .patch ("odoo.addons.edi_core_oca.models.edi_backend.EDIBackend._validate_data" )
0 commit comments