55# Copyright 2011,2024 Tecnativa - Pedro M. Baeza
66# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
77import json
8- import logging
8+
9+ from unidecode import unidecode
910
1011from odoo import api , exceptions , fields , models
1112from odoo .exceptions import UserError , ValidationError
1415
1516from odoo .addons .l10n_es_aeat .models .aeat_mixin import round_by_keys
1617
17- _logger = logging .getLogger (__name__ )
18-
1918SII_STATES = [
2019 ("sent_modified" , "Registered in SII but last modifications not sent" ),
2120 ("cancelled" , "Cancelled" ),
@@ -35,7 +34,7 @@ class SiiMixin(models.AbstractModel):
3534 comodel_name = "res.company" ,
3635 string = "Company" ,
3736 )
38- sii_description = fields .Text (
37+ sii_description = fields .Char (
3938 string = "SII computed description" ,
4039 compute = "_compute_sii_description" ,
4140 default = "/" ,
@@ -797,6 +796,10 @@ def _send_document_to_sii(self):
797796 for document in self .filtered (
798797 lambda i : i .state in self ._get_valid_document_states ()
799798 ):
799+ # Filter the SII description for avoiding manual invalid inputs
800+ text = unidecode (document .sii_description )
801+ if text != document .sii_description :
802+ document .sii_description = text
800803 if document .aeat_state == "not_sent" :
801804 tipo_comunicacion = "A0"
802805 else :
0 commit comments