diff --git a/l10n_es_ticketbai/models/account_move.py b/l10n_es_ticketbai/models/account_move.py index d3a9c33d025..3ca16373573 100644 --- a/l10n_es_ticketbai/models/account_move.py +++ b/l10n_es_ticketbai/models/account_move.py @@ -478,8 +478,10 @@ def validate_refund_invoices(): refund_invoices = self.sudo().filtered( lambda x: x.tbai_enabled and "out_refund" == x.move_type - and not x.tbai_refund_type - or x.tbai_refund_type == RefundType.differences.value + and ( + not x.tbai_refund_type + or x.tbai_refund_type == RefundType.differences.value + ) and x.tbai_send_invoice ) diff --git a/l10n_es_ticketbai_batuz/models/account_move.py b/l10n_es_ticketbai_batuz/models/account_move.py index ba00ab83fcc..64d2f9c617b 100644 --- a/l10n_es_ticketbai_batuz/models/account_move.py +++ b/l10n_es_ticketbai_batuz/models/account_move.py @@ -371,6 +371,18 @@ def _get_lroe_tax_line_req(self, tax): ) return re_tax + def _get_lroe_concept_group_account(self, tax_line): + concepto = "" + lines_with_tax = self.line_ids.filtered( + lambda l: tax_line["tax"].id in l.tax_ids.ids + ) + if lines_with_tax: + for line in lines_with_tax: + concepto = line.account_id.group_id.code_prefix_start + if concepto: + break + return concepto + @api.model def _get_lroe_tax_dict(self, tax_line, tax_lines, deductible=True): """Get the LROE tax dictionary for the passed tax line. @@ -400,11 +412,12 @@ def _get_lroe_tax_dict(self, tax_line, tax_lines, deductible=True): ] ) else: + concept = self._get_lroe_concept_group_account(tax_line) tax_dict = OrderedDict( [ ("Epigrafe", self.company_id.main_activity_iae), # TODO: 140 - BienAfectoIRPFYOIVA --> valor por defecto "N" - # TODO: 140 - Concepto --> grupo de cuenta contable L20 + ("Concepto", concept), # TODO: 140 - ReferenciaBien ("InversionSujetoPasivo", "N"), # TODO: 140 - OperacionEnRecargoDeEquivalenciaORegimenSimplificado @@ -412,7 +425,7 @@ def _get_lroe_tax_dict(self, tax_line, tax_lines, deductible=True): ("TipoImpositivo", str(tax_type)), ("CuotaIVASoportada", cuota), ("CuotaIVADeducible", cuota * int(deductible)), - # TODO: 140 - ImporteGastoIRPF + ("ImporteGastoIRPF", base), # TODO: 140 - CriterioCobrosYPagos ] )