File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- from . import common
21from . import test_all
Original file line number Diff line number Diff line change 11# Copyright 2021 ACSONE SA/NV
22# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33
4+ from odoo .tests import new_test_user
45
5- class IntrastatCommon :
6+ from odoo .addons .base .tests .common import BaseCommon
7+
8+
9+ class IntrastatCommon (BaseCommon ):
610 @classmethod
711 def setUpClass (cls ):
812 super ().setUpClass ()
9- cls .env = cls .env (context = dict (cls .env .context , tracking_disable = True ))
1013 cls .chart_template_obj = cls .env ["account.chart.template" ]
1114 cls .mail_obj = cls .env ["mail.mail" ]
1215
13- cls .demo_user = cls .env .ref ("base.user_demo" )
14- cls .demo_company = cls .env .ref ("base.main_company" )
16+ cls .demo_user = new_test_user (
17+ cls .env ,
18+ login = "test-user" ,
19+ email = "test@test.com" ,
20+ )
21+ cls .demo_company = cls .company
1522
1623 cls .shipping_cost = cls .env ["product.product" ].create (
1724 {
1825 "name" : "Shipping costs TEST" ,
1926 "default_code" : "TEST_SHIP" ,
2027 "type" : "service" ,
2128 "is_accessory_cost" : True ,
22- "categ_id" : cls .env .ref ("product.product_category_services" ),
29+ "categ_id" : cls .env .ref ("product.product_category_services" ). id ,
2330 }
2431 )
Original file line number Diff line number Diff line change @@ -47,10 +47,6 @@ def test_get_data(self, template_code):
4747class TestIntrastatBase (IntrastatCommon ):
4848 """Tests for this module"""
4949
50- @classmethod
51- def setUpClass (cls ):
52- super ().setUpClass ()
53-
5450 def test_company (self ):
5551 # add 'Demo user' to intrastat_remind_user_ids
5652 self .demo_company .write (
@@ -69,6 +65,7 @@ def test_no_email(self):
6965 def test_accessory (self ):
7066 with self .assertRaises (ValidationError ):
7167 self .shipping_cost .type = "consu"
68+ self .shipping_cost .is_accessory_cost = True
7269
7370 def test_fiscal_position (self ):
7471 with self .assertRaises (ValidationError ):
You can’t perform that action at this time.
0 commit comments