1
1
import logging
2
2
3
- from odoo import _ , api , fields , models
3
+ from odoo import api , fields , models
4
4
from odoo .exceptions import UserError
5
5
6
6
from .avatax_rest_api import AvaTaxRESTService
@@ -214,7 +214,7 @@ def create_transaction(
214
214
if not partner .customer_code :
215
215
if not avatax_config .auto_generate_customer_code :
216
216
raise UserError (
217
- _ (
217
+ self . env . _ (
218
218
"Customer Code for customer %(partner.name)s not defined.\n \n "
219
219
"You can edit the Customer Code in customer profile. "
220
220
'You can fix by clicking "Generate Customer Code" '
@@ -226,12 +226,14 @@ def create_transaction(
226
226
227
227
if not shipping_address :
228
228
raise UserError (
229
- _ ("There is no source shipping address defined for partner %s." )
229
+ self .env ._ (
230
+ "There is no source shipping address defined for partner %s."
231
+ )
230
232
% partner .name
231
233
)
232
234
233
235
if not ship_from_address :
234
- raise UserError (_ ("There is no Company address defined." ))
236
+ raise UserError (self . env . _ ("There is no Company address defined." ))
235
237
236
238
if avatax_config .validation_on_save :
237
239
for address in [partner , shipping_address , ship_from_address ]:
@@ -246,27 +248,31 @@ def create_transaction(
246
248
):
247
249
if not shipping_address .date_validation :
248
250
raise UserError (
249
- _ (
251
+ self . env . _ (
250
252
"Please validate the shipping address for the partner "
251
253
"%(partner.name)s."
252
254
)
253
255
)
254
256
255
257
# if not avatax_config.address_validation:
256
258
if not ship_from_address .date_validation :
257
- raise UserError (_ ("Please validate the origin warehouse address." ))
259
+ raise UserError (
260
+ self .env ._ ("Please validate the origin warehouse address." )
261
+ )
258
262
259
263
if avatax_config .disable_tax_calculation :
260
264
_logger .info (
261
- "Avatax tax calculation is disabled. Skipping %s %s." ,
265
+ self . env . _ ( "Avatax tax calculation is disabled. Skipping %s %s." ) ,
262
266
doc_code ,
263
267
doc_type ,
264
268
)
265
269
return False
266
270
267
271
if commit and avatax_config .disable_tax_reporting :
268
272
_logger .warning (
269
- _ ("Avatax commiting document %s, but it tax reporting is disabled." ),
273
+ self .env ._ (
274
+ "Avatax commiting document %s, but it tax reporting is disabled."
275
+ ),
270
276
doc_code ,
271
277
)
272
278
0 commit comments