Skip to content

Commit

Permalink
Merge pull request #37925 from frappe/mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-37879

refactor: flag to toggle billed amy update in DN for Credit Note (backport #37879)
  • Loading branch information
ruthra-kumar authored Nov 6, 2023
2 parents fd7a768 + 61573f2 commit 2119534
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion erpnext/accounts/doctype/sales_invoice/sales_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"is_return",
"return_against",
"update_billed_amount_in_sales_order",
"update_billed_amount_in_delivery_note",
"is_debit_note",
"amended_from",
"accounting_dimensions_section",
Expand Down Expand Up @@ -2153,6 +2154,13 @@
"fieldname": "use_company_roundoff_cost_center",
"fieldtype": "Check",
"label": "Use Company default Cost Center for Round off"
},
{
"default": "0",
"depends_on": "eval: doc.is_return",
"fieldname": "update_billed_amount_in_delivery_note",
"fieldtype": "Check",
"label": "Update Billed Amount in Delivery Note"
}
],
"icon": "fa fa-file-text",
Expand All @@ -2165,7 +2173,7 @@
"link_fieldname": "consolidated_invoice"
}
],
"modified": "2023-07-25 16:02:18.988799",
"modified": "2023-11-03 14:39:38.012346",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
Expand Down
3 changes: 3 additions & 0 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def on_submit(self):

self.update_status_updater_args()
self.update_prevdoc_status()

self.update_billing_status_in_dn()
self.clear_unallocated_mode_of_payments()

Expand Down Expand Up @@ -1429,6 +1430,8 @@ def make_gle_for_rounding_adjustment(self, gl_entries):
)

def update_billing_status_in_dn(self, update_modified=True):
if self.is_return and not self.update_billed_amount_in_delivery_note:
return
updated_delivery_notes = []
for d in self.get("items"):
if d.dn_detail:
Expand Down
2 changes: 2 additions & 0 deletions erpnext/stock/doctype/delivery_note/test_delivery_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ def test_returned_qty_in_return_dn(self):

dn1 = create_delivery_note(is_return=1, return_against=dn.name, qty=-3)
si1 = make_sales_invoice(dn1.name)
si1.update_billed_amount_in_delivery_note = True
si1.insert()
si1.submit()
dn1.reload()
Expand All @@ -1037,6 +1038,7 @@ def test_returned_qty_in_return_dn(self):

dn2 = create_delivery_note(is_return=1, return_against=dn.name, qty=-4)
si2 = make_sales_invoice(dn2.name)
si2.update_billed_amount_in_delivery_note = True
si2.insert()
si2.submit()
dn2.reload()
Expand Down

0 comments on commit 2119534

Please sign in to comment.