@@ -16,16 +16,7 @@ def setUp(self):
16
16
self .product_id_1 = self .env .ref ("product.product_product_6" )
17
17
self .product_id_2 = self .env .ref ("product.product_product_7" )
18
18
self .product_id_3 = self .env .ref ("product.product_product_7" )
19
- self .account_receivable = self .env ["account.account" ].search (
20
- [
21
- (
22
- "user_type_id" ,
23
- "=" ,
24
- self .env .ref ("account.data_account_type_receivable" ).id ,
25
- )
26
- ],
27
- limit = 1 ,
28
- )
19
+
29
20
self .account_exception_confirm = self .env ["account.exception.confirm" ]
30
21
self .exception_noemail = self .env .ref (
31
22
"account_move_exception.am_excep_no_email"
@@ -78,20 +69,23 @@ def test_account_move_exception(self):
78
69
# Add an account move to test after AM is confirmed
79
70
# set ignore_exception = False (Done by onchange of line_ids)
80
71
field_onchange = self .AccountMove ._onchange_spec ()
81
- self .assertEqual (field_onchange .get ("line_ids " ), "1" )
72
+ self .assertEqual (field_onchange .get ("invoice_line_ids " ), "1" )
82
73
self .env .cache .invalidate ()
83
74
self .am3New = self .AccountMove .new (self .am_vals .copy ())
84
75
self .am3New .ignore_exception = True
85
76
self .am3New .state = "posted"
86
77
self .am3New .onchange_ignore_exception ()
87
78
self .assertFalse (self .am3New .ignore_exception )
88
- self .am .line_ids .write (
89
- {
90
- "product_id" : self .product_id_3 .id ,
91
- "quantity" : 2 ,
92
- "price_unit" : 30 ,
93
- }
94
- )
79
+ self .env .cache .clear ()
80
+
81
+ # this cannot be done on a posted invoice in 17.0
82
+ # self.am.line_ids.write(
83
+ # {
84
+ # "product_id": self.product_id_3.id,
85
+ # "quantity": 2,
86
+ # "price_unit": 30,
87
+ # }
88
+ # )
95
89
96
90
# Set ignore exception True (Done manually by user)
97
91
self .am .ignore_exception = True
@@ -102,6 +96,11 @@ def test_account_move_exception(self):
102
96
self .am .action_post ()
103
97
self .assertTrue (self .am .state , "posted" )
104
98
99
+ # avoid balance check:(fails because Record does not exist or has been deleted.)
100
+ # for line in self.am.line_ids:
101
+ # line.price_unit = 0.0
102
+ # line.credit = 0.0
103
+
105
104
# Simulation the opening of the wizard account_exception_confirm and
106
105
# set ignore_exception to True
107
106
am_except_confirm = self .account_exception_confirm .with_context (
@@ -112,9 +111,5 @@ def test_account_move_exception(self):
112
111
}
113
112
).create ({"ignore" : True })
114
113
115
- # avoid balance check:
116
- for line in self .am .line_ids :
117
- line .credit = 0.0
118
-
119
114
am_except_confirm .action_confirm ()
120
115
self .assertTrue (self .am .ignore_exception )
0 commit comments