Skip to content

Commit

Permalink
[14.0][FIX] l10n_es_ticketbai: Fixed tbai refund type
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanHRN committed Sep 19, 2023
1 parent dff4e83 commit a272470
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions l10n_es_ticketbai/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,17 @@ def _compute_tbai_description(self):
description += " - ".join(filter(None, names))
invoice.tbai_description_operation = (description or "")[:250] or "/"

def action_switch_invoice_into_refund_credit_note(self):
super().action_switch_invoice_into_refund_credit_note()

Check warning on line 631 in l10n_es_ticketbai/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_ticketbai/models/account_move.py#L631

Added line #L631 was not covered by tests
for move in self:
if "out_refund" == move.move_type:
vals = {"tbai_refund_type": RefundType.differences.value}

Check warning on line 634 in l10n_es_ticketbai/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_ticketbai/models/account_move.py#L634

Added line #L634 was not covered by tests
if move.partner_id.aeat_anonymous_cash_customer:
vals["tbai_refund_key"] = RefundCode.R5.value

Check warning on line 636 in l10n_es_ticketbai/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_ticketbai/models/account_move.py#L636

Added line #L636 was not covered by tests
else:
vals["tbai_refund_key"] = RefundCode.R1.value
move.write(vals)

Check warning on line 639 in l10n_es_ticketbai/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_ticketbai/models/account_move.py#L638-L639

Added lines #L638 - L639 were not covered by tests


class AccountMoveLine(models.Model):
_inherit = "account.move.line"
Expand Down

0 comments on commit a272470

Please sign in to comment.