fix: review points when added more then once. (#23239)
* fix: review points when added more then once. previously when user added review more then once it didn't work properly because of apply_only_once check which is only meant for rule based points changed that behaviour to only check when called from energy_point_rule by checking if doc.rule is set.
This commit is contained in:
parent
a4cbe36cbe
commit
83f2227cdb
1 changed files with 6 additions and 7 deletions
|
|
@ -189,13 +189,12 @@ def get_alert_dict(doc):
|
|||
|
||||
def create_energy_points_log(ref_doctype, ref_name, doc, apply_only_once=False):
|
||||
doc = frappe._dict(doc)
|
||||
|
||||
log_exists = check_if_log_exists(
|
||||
ref_doctype, ref_name, doc.rule, None if apply_only_once else doc.user
|
||||
)
|
||||
|
||||
if log_exists:
|
||||
return frappe.get_doc("Energy Point Log", log_exists)
|
||||
if doc.rule:
|
||||
log_exists = check_if_log_exists(
|
||||
ref_doctype, ref_name, doc.rule, None if apply_only_once else doc.user
|
||||
)
|
||||
if log_exists:
|
||||
return frappe.get_doc("Energy Point Log", log_exists)
|
||||
|
||||
new_log = frappe.new_doc("Energy Point Log")
|
||||
new_log.reference_doctype = ref_doctype
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue