← Back to Pull requests

[18.0][FIX] account_payment_return: 'memo' field in account.payment #882

Merged
LauraCForgeFlow merged 1 files (3 lines) on Sep 23, 2025 14:57 UTC
View on GitHub
LauraCForgeFlow LauraCForgeFlow commented on Sep 23, 2025 08:45 UTC
Author

Model account.payment does not have a ref field anymore, it has been substituted by memo.

Since line_id in prepare_values_returned_widget can be either an account.payment or an account.move.line instance, we check whether we need to use the memo or the ref field.

Diff: 3 lines (+2 / -1) across 1 files Reviewer: AlexPForgeFlow Review duration: 371m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.34) × (1 − Review Confidence (0.87)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.34 · 3 lines diff across 1 files
0.34
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.84 · 5 substantive comment(s)
0.84
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
87%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.083
Sensitive Paths sensitive_paths
0.034
Real PR Conversation Timeline
14 items
AlexPForgeFlow AlexPForgeFlow approved these changes on Sep 23, 2025 08:55 UTC
Approved Reviewer

Approved these changes.

GuillemCForgeFlow GuillemCForgeFlow approved these changes on Sep 23, 2025 08:59 UTC
Approved Reviewer

lgtm 👍🏿

AaronHForgeFlow AaronHForgeFlow approved these changes on Sep 23, 2025 09:01 UTC
Approved Reviewer

:+1:

MiquelRForgeFlow MiquelRForgeFlow commented on code on Sep 23, 2025 09:22 UTC
Code Review
account_payment_return/models/account_move.py:1
@@ -33,6 +33,7 @@ def prepare_values_returned_widget(self, line_id, amount, is_return=False):
             payment_method_name = line_id.payment_method_line_id.name
         except AttributeError:
             payment_method_name = False
+        ref = line_id.memo if hasattr(line_id, "memo") else line_id.ref

        ref = line_id.memo if hasattr(line_id, "memo") and line_id.memo else line_id.ref

If memo is empty, let's fill with ref.

LauraCForgeFlow LauraCForgeFlow commented on code on Sep 23, 2025 09:43 UTC
Code Review
account_payment_return/models/account_move.py:1
@@ -33,6 +33,7 @@ def prepare_values_returned_widget(self, line_id, amount, is_return=False):
             payment_method_name = line_id.payment_method_line_id.name
         except AttributeError:
             payment_method_name = False
+        ref = line_id.memo if hasattr(line_id, "memo") else line_id.ref

I don't think that will work, since if line_id has the memo field (so hasattr(line_id, "memo") returns True), the record won't have the ref field. If we try to fill it with ref we might get an error.

pedrobaeza pedrobaeza commented on Sep 23, 2025 11:04 UTC
Reviewer

AFAIK memo is a multi-line field, so it can't be used.

LauraCForgeFlow LauraCForgeFlow commented on Sep 23, 2025 14:44 UTC
Author

@pedrobaeza memo in (at least in the account.payment model) is a char field, so the same field type as ref for account.move.line, see source.

MiquelRForgeFlow MiquelRForgeFlow commented on code on Sep 23, 2025 14:51 UTC
Code Review
account_payment_return/models/account_move.py:1
@@ -33,6 +33,7 @@ def prepare_values_returned_widget(self, line_id, amount, is_return=False):
             payment_method_name = line_id.payment_method_line_id.name
         except AttributeError:
             payment_method_name = False
+        ref = line_id.memo if hasattr(line_id, "memo") else line_id.ref

if line_id has the memo field, the record won't have the ref field

Why?

If we try to fill it with ref we might get an error.

Why?

(I don't know, I am just asking to know it better)

pedrobaeza pedrobaeza approved these changes on Sep 23, 2025 14:54 UTC
Approved Reviewer

/ocabot merge patch

OCA-git-bot OCA-git-bot commented on Sep 23, 2025 14:54 UTC
Bot

On my way to merge this fine PR!
Prepared branch 18.0-ocabot-merge-pr-882-by-pedrobaeza-bump-patch, awaiting test results.

pedrobaeza pedrobaeza commented on code on Sep 23, 2025 14:55 UTC
Code Review
account_payment_return/models/account_move.py:1
@@ -33,6 +33,7 @@ def prepare_values_returned_widget(self, line_id, amount, is_return=False):
             payment_method_name = line_id.payment_method_line_id.name
         except AttributeError:
             payment_method_name = False
+        ref = line_id.memo if hasattr(line_id, "memo") else line_id.ref

Check the initial comment in the PR with the explanation: https://github.com/OCA/account-payment/pull/882#issue-3444296421

LauraCForgeFlow LauraCForgeFlow commented on code on Sep 23, 2025 14:56 UTC
Code Review
account_payment_return/models/account_move.py:1
@@ -33,6 +33,7 @@ def prepare_values_returned_widget(self, line_id, amount, is_return=False):
             payment_method_name = line_id.payment_method_line_id.name
         except AttributeError:
             payment_method_name = False
+        ref = line_id.memo if hasattr(line_id, "memo") else line_id.ref

Because the line_id parameter in this method can be, either a record of the account.payment model, or a record of the account.move.line model.

If line_id is an account.payment, then it will have the memo field, and id won't have the ref field. That's why trying to get the ref field in that case will throw an error, since the attribute does not exist for that record or model.

However, if line_id is an account.move.line, then it won't have the memo field, but it will have ref. So that covers the other scenario.

Hope it is clear now!! :)

OCA-git-bot OCA-git-bot commented on Sep 23, 2025 14:57 UTC
Bot

Congratulations, your PR was merged at 32e1305c83eb3edb55c735151a7c6aa033656574. Thanks a lot for contributing to OCA. ❤️

Assignees
LauraCForgeFlow LauraCForgeFlow
Labels
risk: low confidence: 87.1% reviewed sensitive_module
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 34.5% (LOW) · Higher = larger blast radius
34.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 87.1% · Lower = rushed or shallow review
87.1%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 4.4% · Safe to merge
4.4%