@@ -158,12 +158,14 @@ def _compute_l10n_latam_document_type(self):
158158 """
159159 uy_cn_dn_docs = self .env ["account.move" ]
160160 if uy_einvoices := self .filtered (
161- lambda m : m .country_code == "UY"
162- and m .move_type in ("out_invoice" , "out_refund" )
163- and m .state == "draft"
164- and not m .posted_before
165- and m .journal_id .l10n_uy_edi_type == "electronic"
166- and m .partner_id .l10n_latam_identification_type_id == self .env .ref ("l10n_uy.it_rut" )
161+ lambda m : (
162+ m .country_code == "UY"
163+ and m .move_type in ("out_invoice" , "out_refund" )
164+ and m .state == "draft"
165+ and not m .posted_before
166+ and m .journal_id .l10n_uy_edi_type == "electronic"
167+ and m .partner_id .l10n_latam_identification_type_id == self .env .ref ("l10n_uy.it_rut" )
168+ )
167169 ):
168170 # Set debit notes
169171 if uy_debit_notes := uy_einvoices .filtered (lambda m : m .debit_origin_id ):
@@ -223,9 +225,9 @@ def uy_ux_action_get_uruware_cfe(self):
223225 # 3. validation that is the same CFE
224226
225227 uy_moves = self .filtered (
226- lambda x : x . country_code == "UY"
227- and x .journal_id .type == "sale"
228- and x . journal_id . l10n_uy_edi_type == "manual"
228+ lambda x : (
229+ x . country_code == "UY" and x .journal_id .type == "sale" and x . journal_id . l10n_uy_edi_type == "manual "
230+ )
229231 )
230232 uy_docs = self .env ["l10n_latam.document.type" ].search ([("country_id.code" , "=" , "UY" )])
231233
@@ -312,10 +314,13 @@ def _l10n_uy_edi_get_line_nom_and_desc(self, aml):
312314 nom_item = aml .name and aml .name [:80 ] or "-"
313315 description = aml .name and aml .name [80 :] or ""
314316
315- if aml .l10n_uy_edi_addenda_ids :
317+ default_item_legends = self ._uy_get_legends_recs ("item" , self )
318+ # Combinamos las addendas de la línea con las definidas por defecto
319+ all_addendas = aml .l10n_uy_edi_addenda_ids | default_item_legends
320+
321+ if all_addendas :
316322 adenda = [
317- " {%s}" % addenda .content if addenda .is_legend else " " + addenda .content
318- for addenda in aml .l10n_uy_edi_addenda_ids
323+ " {%s}" % addenda .content if addenda .is_legend else " " + addenda .content for addenda in all_addendas
319324 ]
320325 description += "" .join (adenda )
321326
@@ -418,7 +423,7 @@ def uy_ux_action_mandatory_legend(self):
418423 A68_InfoAdicionalReceptor = edi_model ._get_legends ("receiver" , self )
419424 B8_DscItem = []
420425 for line in self .invoice_line_ids .filtered (lambda x : x .display_type == "product" ):
421- value = self ._l10n_uy_edi_get_line_desc (line )
426+ value = self ._l10n_uy_edi_get_line_nom_and_desc (line )[ 1 ]
422427 if value :
423428 B8_DscItem .append ("* line (%s) : %s" % (line .display_name , value ))
424429
@@ -461,11 +466,13 @@ def _uy_ux_check_moves_use_documents(self):
461466 """Do not let to create not invoices entries in journals that use documents"""
462467 # TODO simil to _check_moves_use_documents. integrate somehow
463468 not_invoices = self .filtered (
464- lambda x : x .company_id .country_id .code == "UY"
465- and x .journal_id .type in ["sale" , "purchase" ]
466- and x .l10n_latam_use_documents
467- and not x .is_invoice ()
468- and x .state == "posted"
469+ lambda x : (
470+ x .company_id .country_id .code == "UY"
471+ and x .journal_id .type in ["sale" , "purchase" ]
472+ and x .l10n_latam_use_documents
473+ and not x .is_invoice ()
474+ and x .state == "posted"
475+ )
469476 )
470477 if not_invoices :
471478 raise ValidationError (
0 commit comments