33
44import logging
55
6- from odoo import _ , models
6+ from odoo import models
77
88from odoo .addons .report_xlsx_helper .report .report_xlsx_format import (
99 FORMATS ,
@@ -29,30 +29,30 @@ def _get_template(self, declaration):
2929
3030 template = {
3131 "product" : {
32- "header" : {"type" : "string" , "value" : _ ("Product" )},
32+ "header" : {"type" : "string" , "value" : self . env . _ ("Product" )},
3333 "line" : {
3434 "value" : self ._render ("line.product_id and line.product_id.name" )
3535 },
3636 "width" : 36 ,
3737 },
3838 "product_origin_country_code" : {
39- "header" : {"type" : "string" , "value" : _ ("Product C/O Code" )},
39+ "header" : {"type" : "string" , "value" : self . env . _ ("Product C/O Code" )},
4040 "line" : {
4141 "type" : "string" ,
4242 "value" : self ._render ("line.product_origin_country_code or ''" ),
4343 },
4444 "width" : 10 ,
4545 },
4646 "product_origin_country" : {
47- "header" : {"type" : "string" , "value" : _ ("Product C/O" )},
47+ "header" : {"type" : "string" , "value" : self . env . _ ("Product C/O" )},
4848 "line" : {
4949 "type" : "string" ,
5050 "value" : self ._render ("line.product_origin_country_id.name or ''" ),
5151 },
5252 "width" : 28 ,
5353 },
5454 "hs_code" : {
55- "header" : {"type" : "string" , "value" : _ ("Intrastat Code" )},
55+ "header" : {"type" : "string" , "value" : self . env . _ ("Intrastat Code" )},
5656 "line" : {
5757 "type" : "string" ,
5858 "value" : self ._render ("line.hs_code_id.local_code" ),
@@ -62,7 +62,7 @@ def _get_template(self, declaration):
6262 "src_dest_country_code" : {
6363 "header" : {
6464 "type" : "string" ,
65- "value" : _ ("Country Code of Origin/Destination" ),
65+ "value" : self . env . _ ("Country Code of Origin/Destination" ),
6666 },
6767 "line" : {
6868 "type" : "string" ,
@@ -73,7 +73,7 @@ def _get_template(self, declaration):
7373 "src_dest_country" : {
7474 "header" : {
7575 "type" : "string" ,
76- "value" : _ ("Country of Origin/Destination" ),
76+ "value" : self . env . _ ("Country of Origin/Destination" ),
7777 },
7878 "line" : {
7979 "type" : "string" ,
@@ -84,7 +84,7 @@ def _get_template(self, declaration):
8484 "amount_company_currency" : {
8585 "header" : {
8686 "type" : "string" ,
87- "value" : _ ("Fiscal Value" ),
87+ "value" : self . env . _ ("Fiscal Value" ),
8888 "format" : FORMATS ["format_theader_yellow_right" ],
8989 },
9090 "line" : {
@@ -97,7 +97,7 @@ def _get_template(self, declaration):
9797 "accessory_cost" : {
9898 "header" : {
9999 "type" : "string" ,
100- "value" : _ ("Accessory Costs" ),
100+ "value" : self . env . _ ("Accessory Costs" ),
101101 "format" : FORMATS ["format_theader_yellow_right" ],
102102 },
103103 "line" : {
@@ -112,20 +112,23 @@ def _get_template(self, declaration):
112112 "transaction_code" : {
113113 "header" : {
114114 "type" : "string" ,
115- "value" : _ ("Intrastat Transaction Code" ),
115+ "value" : self . env . _ ("Intrastat Transaction Code" ),
116116 },
117117 "line" : {"value" : self ._render ("line.transaction_id.code" )},
118118 "width" : 10 ,
119119 },
120120 "transaction" : {
121- "header" : {"type" : "string" , "value" : _ ("Intrastat Transaction" )},
121+ "header" : {
122+ "type" : "string" ,
123+ "value" : self .env ._ ("Intrastat Transaction" ),
124+ },
122125 "line" : {"value" : self ._render ("line.transaction_id.display_name" )},
123126 "width" : 36 ,
124127 },
125128 "weight" : {
126129 "header" : {
127130 "type" : "string" ,
128- "value" : _ ("Weight" ),
131+ "value" : self . env . _ ("Weight" ),
129132 "format" : FORMATS ["format_theader_yellow_right" ],
130133 },
131134 "line" : {
@@ -138,7 +141,7 @@ def _get_template(self, declaration):
138141 "suppl_unit_qty" : {
139142 "header" : {
140143 "type" : "string" ,
141- "value" : _ ("Suppl. Unit Qty" ),
144+ "value" : self . env . _ ("Suppl. Unit Qty" ),
142145 "format" : FORMATS ["format_theader_yellow_right" ],
143146 },
144147 "line" : {
@@ -151,47 +154,53 @@ def _get_template(self, declaration):
151154 "width" : 18 ,
152155 },
153156 "suppl_unit" : {
154- "header" : {"type" : "string" , "value" : _ ("Suppl. Unit" )},
157+ "header" : {"type" : "string" , "value" : self . env . _ ("Suppl. Unit" )},
155158 "line" : {"value" : self ._render ("line.intrastat_unit_id.name or ''" )},
156159 "width" : 14 ,
157160 },
158161 "incoterm" : {
159- "header" : {"type" : "string" , "value" : _ ("Incoterm" )},
162+ "header" : {"type" : "string" , "value" : self . env . _ ("Incoterm" )},
160163 "line" : {"value" : self ._render ("line.incoterm_id.name or ''" )},
161164 "width" : 14 ,
162165 },
163166 "transport_code" : {
164- "header" : {"type" : "string" , "value" : _ ("Transport Mode Code" )},
167+ "header" : {
168+ "type" : "string" ,
169+ "value" : self .env ._ ("Transport Mode Code" ),
170+ },
165171 "line" : {"value" : self ._render ("line.transport_id.code or ''" )},
166172 "width" : 10 ,
167173 },
168174 "transport" : {
169- "header" : {"type" : "string" , "value" : _ ("Transport Mode" )},
175+ "header" : {"type" : "string" , "value" : self . env . _ ("Transport Mode" )},
170176 "line" : {"value" : self ._render ("line.transport_id.name or ''" )},
171177 "width" : 14 ,
172178 },
173179 "region" : {
174- "header" : {"type" : "string" , "value" : _ ("Intrastat Region" )},
180+ "header" : {"type" : "string" , "value" : self . env . _ ("Intrastat Region" )},
175181 "line" : {"value" : self ._render ("line.region_id.name or ''" )},
176182 "width" : 28 ,
177183 },
178184 "region_code" : {
179- "header" : {"type" : "string" , "value" : _ ("Intrastat Region Code" )},
185+ "header" : {
186+ "type" : "string" ,
187+ "value" : self .env ._ ("Intrastat Region Code" ),
188+ },
180189 "line" : {"value" : self ._render ("line.region_code or ''" )},
181190 "width" : 10 ,
182191 },
183192 "vat" : {
184- "header" : {"type" : "string" , "value" : _ ("VAT" )},
193+ "header" : {"type" : "string" , "value" : self . env . _ ("VAT" )},
185194 "line" : {"value" : self ._render ("line.vat or ''" )},
186195 "width" : 20 ,
187196 },
188197 "partner_id" : {
189- "header" : {"type" : "string" , "value" : _ ("Partner" )},
198+ "header" : {"type" : "string" , "value" : self . env . _ ("Partner" )},
190199 "line" : {"value" : self ._render ("line.partner_id.display_name or ''" )},
191200 "width" : 28 ,
192201 },
193202 "invoice" : {
194- "header" : {"type" : "string" , "value" : _ ("Invoice" )},
203+ "header" : {"type" : "string" , "value" : self . env . _ ("Invoice" )},
195204 "line" : {"value" : self ._render ("line.invoice_id.name" )},
196205 "width" : 18 ,
197206 },
@@ -214,16 +223,16 @@ def _get_ws_params(self, wb, data, declarations):
214223 dname = " " .join ([decl .year_month , type2label [decl .declaration_type ]])
215224 res += [
216225 {
217- "ws_name" : " " .join ([dname , _ ("comput." )]),
226+ "ws_name" : " " .join ([dname , self . env . _ ("comput." )]),
218227 "generate_ws_method" : "_intrastat_report_computation" ,
219- "title" : " : " .join ([dname , _ ("Computation Lines" )]),
228+ "title" : " : " .join ([dname , self . env . _ ("Computation Lines" )]),
220229 "wanted_list" : wanted_list_computation ,
221230 "col_specs" : template ,
222231 },
223232 {
224- "ws_name" : " " .join ([dname , _ ("decl." )]),
233+ "ws_name" : " " .join ([dname , self . env . _ ("decl." )]),
225234 "generate_ws_method" : "_intrastat_report_declaration" ,
226- "title" : " : " .join ([dname , _ ("Declaration Lines" )]),
235+ "title" : " : " .join ([dname , self . env . _ ("Declaration Lines" )]),
227236 "wanted_list" : wanted_list_declaration ,
228237 "col_specs" : template ,
229238 },
@@ -235,11 +244,15 @@ def _report_title(self, ws, row_pos, ws_params, data, declaration):
235244
236245 def _empty_report (self , ws , row_pos , ws_params , data , declaration , report ):
237246 if report == "computation" :
238- lines = _ ("Computation Lines" )
247+ lines = self . env . _ ("Computation Lines" )
239248 else :
240- lines = _ ("Declaration Lines" )
249+ lines = self . env . _ ("Declaration Lines" )
241250 no_entries = (
242- _ ("No" ) + " " + lines + " " + _ ("for period %s" ) % declaration .year_month
251+ self .env ._ ("No" )
252+ + " "
253+ + lines
254+ + " "
255+ + self .env ._ ("for period %s" , declaration .year_month )
243256 )
244257 ws .write_string (row_pos , 0 , no_entries , FORMATS ["format_left_bold" ])
245258
0 commit comments