File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1906,7 +1906,7 @@ def create_credit_note(
19061906 items ,
19071907 PIH ,
19081908 machine_name ,
1909- return_against ,
1909+ return_against = None ,
19101910 payments = None ,
19111911 discount_amount = None ,
19121912 unique_id = None ,
@@ -1962,16 +1962,20 @@ def create_credit_note(
19621962 status = 404 ,
19631963 mimetype = "application/json" ,
19641964 )
1965+ base_offline_invoice_number = None
19651966
19661967 cost_center = None
19671968 source_warehouse = None
19681969 profile_taxes_and_charges = None
1969- return_invoice = frappe .db .exists ("Sales Invoice" , return_against )
1970+ return_invoice = frappe .db .exists ("Sales Invoice" , return_against ) if return_against else None
19701971 offline_no_invoice_id = None
1971- if not return_invoice :
1972+ if offline_invoice_number :
1973+ base_offline_invoice_number = offline_invoice_number .split ("-" )[0 ]
1974+
1975+ if not return_invoice and base_offline_invoice_number :
19721976 offline_no_invoice_id = frappe .db .get_value (
19731977 "Sales Invoice" ,
1974- {"custom_offline_invoice_number" : offline_invoice_number },
1978+ {"custom_offline_invoice_number" : base_offline_invoice_number },
19751979 "name" ,
19761980 )
19771981
You can’t perform that action at this time.
0 commit comments