-
Notifications
You must be signed in to change notification settings - Fork 10.3k
fix: validation considers moving average by default instead of set va… #52246
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
Conversation
📝 WalkthroughWalkthroughSelling price validation now runs per-item and per-row, deriving Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@erpnext/controllers/selling_controller.py`:
- Around line 334-340: The comparison currently uses item.base_net_rate <
item.incoming_rate without numeric coercion; update the check to use flt() on
both sides (e.g., flt(item.base_net_rate) < flt(item.incoming_rate)) so the
comparison is consistent with the earlier flt() usage (see other comparison
flt(item.base_net_rate) < flt(last_purchase_rate_in_sales_uom)) and keep the
throw_message(...) call unchanged; locate this in the same validation block
where item.base_net_rate, item.incoming_rate, and throw_message are used.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #52246 +/- ##
========================================
Coverage 79.24% 79.25%
========================================
Files 1168 1168
Lines 122699 122695 -4
========================================
+ Hits 97237 97239 +2
+ Misses 25462 25456 -6
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@erpnext/stock/doctype/delivery_note/test_delivery_note.py`:
- Around line 2866-2881: The test test_validate_selling_price incorrectly sets
dn.items[0].stock_qty (which is recomputed) so it has no effect; change the
assignment to update dn.items[0].qty (or adjust the conversion factor) before
calling dn.save so the incoming rate recalculation is driven by the persisted
quantity; keep references to create_delivery_note, dn.save and
IntegrationTestCase.change_settings as-is.
5f4cc5c to
69200a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@erpnext/controllers/selling_controller.py`:
- Around line 541-543: The condition directly accesses self._action and can
raise AttributeError on flows where _action isn't set; update the guard to use a
defensive lookup (e.g., replace direct self._action usage in the condition that
currently reads "self._action in ['save', 'submit'] or not d.incoming_rate or
self.is_internal_transfer()" with a safe access like getattr(self, '_action',
None) (or self.get('_action') if this object implements .get) so the expression
becomes robust in non-save/submit flows while preserving the checks against
d.incoming_rate and self.is_internal_transfer().
fc98f08 to
30c0ec1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@erpnext/controllers/selling_controller.py`:
- Around line 307-308: The get_link_to_form call for the Single DocType is
missing the docname parameter, causing inconsistent navigation; update the
get_link_to_form invocation used with Selling Settings to include the docname by
changing get_link_to_form("Selling Settings") to get_link_to_form("Selling
Settings", "Selling Settings") so it matches other usages (e.g., the one at line
822) and ensures correct navigation for the Single DocType.
(cherry picked from commit 135a433) # Conflicts: # erpnext/stock/doctype/delivery_note/test_delivery_note.py
(cherry picked from commit 135a433)
…-52246 fix: validation considers moving average by default instead of set va… (backport #52246)
Reference support ticket