Skip to content

[17.0][IMP] account_statement_import_online_paypal: map cart item_code#890

Open
tendil wants to merge 4 commits intoOCA:17.0from
cetmix:17.0-t5213-account_statement_import_online_paypal-map_odoo_order_name_to_payment
Open

[17.0][IMP] account_statement_import_online_paypal: map cart item_code#890
tendil wants to merge 4 commits intoOCA:17.0from
cetmix:17.0-t5213-account_statement_import_online_paypal-map_odoo_order_name_to_payment

Conversation

@tendil
Copy link

@tendil tendil commented Jan 16, 2026

Improvement import so Sales Order reference is preserved for matching.

PayPal transactions can include the Odoo-paid Sales Order name in cart_info.item_details[].item_code.
PR extracts those item_code values and writes them into the bank statement line narration, improving downstream payment matching and reducing manual reconciliation.

Additionally, the PR stores the original PayPal transaction JSON payload on each imported bank statement line in the technical field transaction_details (including fee lines), so we can later use the full provider data for troubleshooting and matching logic without re-fetching from PayPal.

Additionally, for PayPal transfer/withdrawal transactions the PR prepends PayPal’s bank reference to payment_ref to improve identification and matching.

…arration

This commit adds PayPal cart parsing to improve payment matching.

Steps to reproduce:
- Configure PayPal.com online bank statement provider with valid Client ID/Secret;
- Ensure PayPal transactions include `cart_info.item_details.item_code` (used by Odoo as Sales Order name);
- Pull an online bank statement for a date range containing such transactions.

Expected result:
- Bank statement line `narration` contains the PayPal `item_code` (e.g. `AG-052216`) so it can be used later for matching.

Current result:
- `item_code` is ignored and `narration` is not populated with Sales Order reference.

Task: 5213
@OCA-git-bot
Copy link
Contributor

Hi @alexey-pelykh,
some modules you are maintaining are being modified, check this out!

@tendil tendil changed the title [IMP] account_statement_import_online_paypal: map cart item_code [17.0][IMP] account_statement_import_online_paypal: map cart item_code Jan 16, 2026
Steps to reproduce:
- Configure PayPal.com online bank statement provider with valid Client ID/Secret;
- Open the related "Online Bank Statement Providers -> PayPal" and click *Pull Online Bank Statement*;
- Select any date range and click *Pull*.

Expected result:
- Imported bank statement lines contain the original PayPal transaction payload in the technical field `transaction_details.

Current result:
- Only a subset of PayPal data is available (e.g., `raw_data`), while full transaction JSON is not preserved on statement lines.

Result:
- Store the original PayPal transaction payload into `account.bank.statement.line.transaction_details` for both the main line and the fee line.
- Tests updated accordingly to validate the new structure.

Task: 5213
Copy link
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

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

TEchnically looks ok, just a non blocking comment.

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

…ls as JSON string

Enterprise account_online_synchronization expects account.bank.statement.line.transaction_details
to be a JSON-encoded string and calls json.loads() during create().

- Our PayPal provider started returning transaction_details as a Python dict, which causes
TypeError: the JSON object must be str, bytes or bytearray, not dict in enterprise flow.
- This fix ensures PayPal statement import always stores transaction_details as a JSON string
to stay compatible with enterprise logic, without modifying enterprise code.
- Tests updated accordingly (transaction_parse_* and pull assertions now expect JSON string).

Task: 5213
…to payment_ref

Enterprise account_online_synchronization expects account.bank.statement.line.transaction_details
to be a JSON-encoded string and calls json.loads() during create().

- When importing PayPal statements, some transfer/withdrawal transactions (e.g. T0400) don’t contain enough info in `payment_ref` for downstream matching.
- Update PayPal line generation to prepend PayPal `bank_reference_id` (when present) to `payment_ref` alongside the `transaction_id` for those transfer lines only, so the bank statement line contains an identifiable reference like:
<bank_reference_id> <transaction_id>.

Task: 5213
@tendil tendil force-pushed the 17.0-t5213-account_statement_import_online_paypal-map_odoo_order_name_to_payment branch from ae8f2b1 to 3fc25e4 Compare February 4, 2026 10:41
@ivs-cetmix
Copy link
Member

Hi @etobella @OCA/banking-maintainers would appreciate you having a look at this before merged. We left 4 separate commits on purpose to make the history tracking more convenient. It would be also easier to cherry-pick them in other versions.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants