Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: flag to toggle billed amy update in DN for Credit Note #37879

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading