@@ -34,6 +34,8 @@ def _get_intrastat_state(self, inv_line):
3434
3535 def _update_computation_line_vals (self , inv_line , line_vals , notedict ):
3636 result = super ()._update_computation_line_vals (inv_line , line_vals , notedict )
37+ if self .company_id .country_id .code != "ES" :
38+ return result
3739 intrastat_state = self ._get_intrastat_state (inv_line )
3840 if intrastat_state :
3941 line_vals ["intrastat_state_id" ] = intrastat_state .id
@@ -71,6 +73,8 @@ def _prepare_invoice_domain(self):
7173 - companies subject to arrivals or dispatches only
7274 """
7375 domain = super ()._prepare_invoice_domain ()[:- 1 ]
76+ if self .company_id .country_id .code != "ES" :
77+ return super ()._prepare_invoice_domain ()
7478 if self .declaration_type == "arrivals" :
7579 domain .append (("move_type" , "in" , ("in_invoice" , "out_refund" )))
7680 elif self .declaration_type == "dispatches" :
@@ -82,6 +86,8 @@ def _generate_xml(self):
8286
8387 def _attach_xml_file (self , xml_string , declaration_name ):
8488 attach_id = super ()._attach_xml_file (xml_string , declaration_name )
89+ if self .company_id .country_id .code != "ES" :
90+ return attach_id
8591 self .ensure_one ()
8692 attach = self .env ["ir.attachment" ].browse (attach_id )
8793 filename = "{}_{}.csv" .format (self .year_month , declaration_name )
@@ -158,19 +164,21 @@ def create_xls(self):
158164 "data" : {"dynamic_report" : True },
159165 }
160166
161- @api .model
162167 def _xls_computation_line_fields (self ):
163168 res = super ()._xls_computation_line_fields ()
169+ if self .company_id .country_id .code != "ES" :
170+ return res
164171 if (
165172 self .env .context .get ("declaration_type" , False ) == "dispatches"
166173 and int (self .env .context .get ("declaration_year" , 0 )) >= 2022
167174 ):
168175 res .append ("partner_vat" )
169176 return res
170177
171- @api .model
172178 def _xls_declaration_line_fields (self ):
173179 res = super ()._xls_declaration_line_fields ()
180+ if self .company_id .country_id .code != "ES" :
181+ return res
174182 if (
175183 self .env .context .get ("declaration_type" , False ) == "dispatches"
176184 and int (self .env .context .get ("declaration_year" , 0 )) >= 2022
@@ -190,6 +198,8 @@ class IntrastatProductComputationLine(models.Model):
190198
191199 def _prepare_grouped_fields (self , fields_to_sum ):
192200 vals = super ()._prepare_grouped_fields (fields_to_sum )
201+ if self .company_id .country_id .code != "ES" :
202+ return vals
193203 vals ["intrastat_state_id" ] = self .intrastat_state_id .id
194204 # TODO: Move set incoterm_id to intrastat_product
195205 vals ["incoterm_id" ] = self .incoterm_id .id
@@ -199,6 +209,8 @@ def _prepare_grouped_fields(self, fields_to_sum):
199209
200210 def _prepare_declaration_line (self ):
201211 vals = super ()._prepare_declaration_line ()
212+ if self .company_id .country_id .code != "ES" :
213+ return vals
202214 # Avoid rounding in weight and fiscal value
203215 vals ["weight" ] = 0.0
204216 vals ["amount_company_currency" ] = 0.0
@@ -215,6 +227,8 @@ def _prepare_declaration_line(self):
215227 @api .model
216228 def _group_line_hashcode_fields (self ):
217229 res = super ()._group_line_hashcode_fields ()
230+ if self .company_id .country_id .code != "ES" :
231+ return res
218232 res ["intrastat_state_id" ] = self .intrastat_state_id .id
219233 if self .declaration_type == "dispatches" and int (self .parent_id .year ) >= 2022 :
220234 res ["partner_vat" ] = self .partner_vat
0 commit comments