Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][FIX] l10n_th_account_tax: reverse move tax number #490

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion l10n_th_account_tax/wizard/account_move_reversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,28 @@

def reverse_moves(self):
self.ensure_one()
# Send context to reverse moves for case Full Refund
# because it will auto post moves
if self.move_type == "in_invoice":
self = self.with_context(
tax_invoice_number=self.tax_invoice_number,
tax_invoice_date=self.tax_invoice_date,
)
return super().reverse_moves()
action = super().reverse_moves()

# Reverse moves with Partial Refund or Full refund and new draft invoice
# Update tax invoice number and tax invoice date
if (
self.move_type == "in_invoice"
and self.tax_invoice_number
and self.tax_invoice_date
):
move_resversal = self.env[action["res_model"]].browse(action["res_id"])
if not move_resversal.tax_invoice_ids.mapped("tax_invoice_number"):
move_resversal.tax_invoice_ids.write(

Check warning on line 33 in l10n_th_account_tax/wizard/account_move_reversal.py

View check run for this annotation

Codecov / codecov/patch

l10n_th_account_tax/wizard/account_move_reversal.py#L33

Added line #L33 was not covered by tests
{
"tax_invoice_number": self.tax_invoice_number,
"tax_invoice_date": self.tax_invoice_date,
}
)
return action
Loading