Skip to content

Commit

Permalink
refactor: checkbox to toggle always standalone credit note
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Mar 11, 2024
1 parent d2b34ea commit 2cefe2a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 11 additions & 2 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -2238,4 +2247,4 @@
"title_field": "title",
"track_changes": 1,
"track_seen": 1
}
}
5 changes: 4 additions & 1 deletion erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class SalesInvoice(SellingController):
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
Expand Down Expand Up @@ -1232,7 +1233,9 @@ def make_customer_gl_entry(self, gl_entries):
"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,
Expand Down

0 comments on commit 2cefe2a

Please sign in to comment.