Skip to content

Conversation

@elshafei-developer
Copy link
Contributor

Before

image

After

image

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

This pull request applies a localization fix to the get_company_default function in erpnext/accounts/utils.py. The error message now translates the field label by wrapping the field label retrieval with the _() translation function. The change modifies the message formatting from the original implementation to _("...").format(_(frappe.get_meta("Company").get_label(fieldname)), company). The control flow, exception type, and runtime behavior remain unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

needs-tests

Suggested reviewers

  • ruthra-kumar

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: adding a missing translation function for a company default error message.
Description check ✅ Passed The description includes before/after screenshots that demonstrate the localization change, which relates to the changeset's objective of fixing the error message translation.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72aa27a and 0950e67.

📒 Files selected for processing (1)
  • erpnext/accounts/utils.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-16T05:33:58.723Z
Learnt from: Abdeali099
Repo: frappe/erpnext PR: 51078
File: erpnext/accounts/doctype/financial_report_template/financial_report_engine.py:486-491
Timestamp: 2025-12-16T05:33:58.723Z
Learning: In ERPNext/Frappe codebase, query.run(as_dict=True) returns frappe._dict objects that support both dict-style access (obj["key"]) and attribute-style access (obj.key). Therefore, attribute access on query results is valid and will not raise AttributeError. When reviewing Python code, prefer attribute access (obj.key) for readability where the key is known to exist, but ensure existence checks or fallback handling if there is any doubt about missing keys.

Applied to files:

  • erpnext/accounts/utils.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: linters
  • GitHub Check: Python Unit Tests (1)
  • GitHub Check: Python Unit Tests (2)
  • GitHub Check: Summary
🔇 Additional comments (1)
erpnext/accounts/utils.py (1)

1143-1153: LGTM! Field label localization fix applied correctly.

The addition of _() around frappe.get_meta("Company").get_label(fieldname) ensures that the field label is properly translated in the error message, improving the user experience for non-English users. This change completes the localization of the error message.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added accounts needs-tests This PR needs automated unit-tests. labels Jan 5, 2026
@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.11%. Comparing base (9cb5768) to head (0950e67).
⚠️ Report is 100 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #51507   +/-   ##
========================================
  Coverage    79.10%   79.11%           
========================================
  Files         1179     1179           
  Lines       121359   121359           
========================================
+ Hits         96006    96011    +5     
+ Misses       25353    25348    -5     
Files with missing lines Coverage Δ
erpnext/accounts/utils.py 75.63% <ø> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rohitwaghchaure rohitwaghchaure merged commit 20f6e37 into frappe:develop Jan 8, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accounts needs-tests This PR needs automated unit-tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants