refactor: checkbox to toggle always standalone credit note
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 88b28ad..ac14d98 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -25,6 +25,7 @@
"is_consolidated",
"is_return",
"return_against",
+ "update_outstanding_for_self",
"update_billed_amount_in_sales_order",
"update_billed_amount_in_delivery_note",
"is_debit_note",
@@ -2171,6 +2172,14 @@
"fieldtype": "Check",
"label": "Don't Create Loyalty Points",
"no_copy": 1
+ },
+ {
+ "default": "1",
+ "depends_on": "eval: doc.is_return && doc.return_against",
+ "description": "Credit Note will update it's own outstanding amount, even if \"Return Against\" is specified.",
+ "fieldname": "update_outstanding_for_self",
+ "fieldtype": "Check",
+ "label": "Update Outstanding for Self"
}
],
"icon": "fa fa-file-text",
@@ -2183,7 +2192,7 @@
"link_fieldname": "consolidated_invoice"
}
],
- "modified": "2024-03-01 09:21:54.201289",
+ "modified": "2024-03-11 14:20:34.874192",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
@@ -2238,4 +2247,4 @@
"title_field": "title",
"track_changes": 1,
"track_seen": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index e2cbf5e..36bc97f 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -220,6 +220,7 @@
unrealized_profit_loss_account: DF.Link | None
update_billed_amount_in_delivery_note: DF.Check
update_billed_amount_in_sales_order: DF.Check
+ update_outstanding_for_self: DF.Check
update_stock: DF.Check
use_company_roundoff_cost_center: DF.Check
write_off_account: DF.Link | None
@@ -1232,7 +1233,9 @@
"debit_in_account_currency": base_grand_total
if self.party_account_currency == self.company_currency
else grand_total,
- "against_voucher": self.name,
+ "against_voucher": self.name
+ if self.is_return and self.return_against and self.update_outstanding_for_self
+ else self.return_against,
"against_voucher_type": self.doctype,
"cost_center": self.cost_center,
"project": self.project,