mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
refactor: Use db.set_single_value (#35668)
I just applied semgrep autofix. Untested completed, review before merging.
```yaml
- id: frappe-set-value-semantics
patterns:
- pattern-either:
- pattern: frappe.db.set_value($DOCTYPE, None, $...AFTER)
- pattern: frappe.db.set_value($DOCTYPE, $DOCTYPE, $...AFTER)
fix: frappe.db.set_single_value($DOCTYPE, $...AFTER)
message: |
If $DOCTYPE is a single doctype then using `frappe.db.set_value` is discouraged for setting values in DB. Use db.set_single_value for single doctype instead.
languages: [python]
severity: ERROR
```
This commit is contained in:
@@ -53,9 +53,7 @@ class TestOpportunity(unittest.TestCase):
|
||||
self.assertEqual(opportunity_doc.total, 2200)
|
||||
|
||||
def test_carry_forward_of_email_and_comments(self):
|
||||
frappe.db.set_value(
|
||||
"CRM Settings", "CRM Settings", "carry_forward_communication_and_comments", 1
|
||||
)
|
||||
frappe.db.set_single_value("CRM Settings", "carry_forward_communication_and_comments", 1)
|
||||
lead_doc = make_lead()
|
||||
lead_doc.add_comment("Comment", text="Test Comment 1")
|
||||
lead_doc.add_comment("Comment", text="Test Comment 2")
|
||||
|
||||
Reference in New Issue
Block a user