Skip to content

[IMP] payment_authorize: avoid setting VOID transactions as canceled I#3817#633

Open
jqbeltran2 wants to merge 1 commit intoVauxoo:16.0-ircfrom
vauxoo-dev:16.0-zero-prm-for-void-jqbeltran2
Open

[IMP] payment_authorize: avoid setting VOID transactions as canceled I#3817#633
jqbeltran2 wants to merge 1 commit intoVauxoo:16.0-ircfrom
vauxoo-dev:16.0-zero-prm-for-void-jqbeltran2

Conversation

@jqbeltran2
Copy link
Copy Markdown

@jqbeltran2 jqbeltran2 commented Aug 6, 2025

Description of the issue/feature this PR addresses:

https://gitlab.com/ircanada/ircodoo/-/issues/3721

https://gitlab.com/ircanada/ircodoo/-/issues/3817

This commit removes calls to _set_canceled() for VOID-type transactions.
For proper reconciliation, VOID transactions must remain in the posted state
and should not be marked as canceled in the payment.transaction record.

To identify voided payment.transaction records, the context "transaction_voided" is provided where previously they were marked as canceled.

Unit tests were adjusted accordingly.

Current behavior before PR:

The payment.transaction and account.payment records related to an invoice were being canceled when generating a VOID transaction.

Desired behavior after PR is merged:

Both payment.transaction and account.payment records related to an invoice should remain in the posted state to allow automatic reconciliation of the invoice for the client's requirements.

@jqbeltran2 jqbeltran2 changed the title [IMP] payment_authorize: avoid setting VOID transactions as canceled I#3721 [IMP] payment_authorize: avoid setting VOID transactions as canceled I#3817 Aug 6, 2025
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could avoid this patch

Using a inherit class and using _set_canceled

I mean,

class ...
    _inherit = "payment.transaction"

    def _set_canceled(...):
        if self.provider_code == 'authorize':
            self.transaction_status = 'voided'
        else:
            return super()._set_canceled()

Or something similar

cc @fernandahf

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all scenarios where it's canceled are because of a void; it could be declined by the provider. How do we know what the difference is?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use a context in the patch and process this context in the inherited method

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I utilized the context

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid creating fields in this part

Better using the module inherited

Maybe if you need to patch the method, you could use a context in order to be re-used in the method inherited

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I defined the field in our inherit

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original tests are not ran in the pipeline

So, this change is not needed neither

If you need a custom tests, you can create them in the custom modules

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I deleted the unit tests changes

@jqbeltran2 jqbeltran2 force-pushed the 16.0-zero-prm-for-void-jqbeltran2 branch from dd04aaf to 6c0b8c2 Compare August 7, 2025 02:45
@moylop260
Copy link
Copy Markdown

I don't understood the new implementation

I was thinking about using the same
method

I mean,

self.with_context(avoid_cancel=True)._set_canceled()

This commit removes calls to _set_canceled() for VOID-type transactions.
For proper reconciliation, VOID transactions must remain in the posted state and should not be marked as canceled in the payment.transaction record.

To identify voided payment.transaction records, the context "transaction_voided" is provided.
@jqbeltran2 jqbeltran2 force-pushed the 16.0-zero-prm-for-void-jqbeltran2 branch from 6c0b8c2 to d5fce03 Compare August 7, 2025 20:12
@jqbeltran2
Copy link
Copy Markdown
Author

Changes applied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants