-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: improved the conditions for determining voucher subtypes (cherry picked from commit 00eee16) * fix: patch (cherry picked from commit d76cc21) # Conflicts: # erpnext/patches.txt * test: test voucher subtype for sales invoice (cherry picked from commit ad6cc35) * chore: resolve conflict * fix: NoneType while updating ordered_qty in SO for removed items (cherry picked from commit 442cdd7) * refactor: add "margin_type" and "margin_rate_or_amount" to no copy (cherry picked from commit 70f090c) * fix: item not set in the batch quick entry form (backport #44028) (#44031) fix: item not set in the batch quick entry form (#44028) (cherry picked from commit 0399ccc) Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> * fix: calculate percentage received and delivered considering over-receipt and over-delivery (backport #43870) (#44030) fix: calculate percentage received and delivered considering over-receipt and over-delivery (#43870) (cherry picked from commit adba116) Co-authored-by: Nabin Hait <nabinhait@gmail.com> * fix: sort by ascending to get the first period closing voucher (backport #44029) (#44035) fix: sort by ascending to get the first period closing voucher (#44029) (cherry picked from commit 42dcdcd) Co-authored-by: Venkatesh <47534423+venkat102@users.noreply.github.com> --------- Co-authored-by: ljain112 <ljain112@gmail.com> Co-authored-by: Smit Vora <smitvora203@gmail.com> Co-authored-by: ruthra kumar <ruthra@erpnext.com> Co-authored-by: bhaveshkumar.j <bhaveshkumar.j@sritindia.com> Co-authored-by: Ravindu Nethmina <117300601+NethminaHiker360@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> Co-authored-by: Venkatesh <47534423+venkat102@users.noreply.github.com>
- Loading branch information
1 parent
4819535
commit f5610e2
Showing
8 changed files
with
120 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
erpnext/patches/v15_0/update_sub_voucher_type_in_gl_entries.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
update_purchase_invoices() | ||
update_sales_invoices() | ||
update_sales_debit_notes() | ||
|
||
|
||
def update_purchase_invoices(): | ||
invoices = frappe.get_all( | ||
"Purchase Invoice", | ||
filters={"docstatus": 1, "is_return": 0}, | ||
pluck="name", | ||
) | ||
|
||
if not invoices: | ||
return | ||
|
||
update_gl_entry(doctype="Purchase Invoice", invoices=invoices, value="Purchase Invoice") | ||
|
||
|
||
def update_sales_invoices(): | ||
invoices = frappe.get_all( | ||
"Sales Invoice", | ||
filters={"docstatus": 1, "is_return": 0, "is_debit_note": 0}, | ||
pluck="name", | ||
) | ||
if not invoices: | ||
return | ||
|
||
update_gl_entry(doctype="Sales Invoice", invoices=invoices, value="Sales Invoice") | ||
|
||
|
||
def update_sales_debit_notes(): | ||
invoices = frappe.get_all( | ||
"Sales Invoice", | ||
filters={"docstatus": 1, "is_debit_note": 1}, | ||
pluck="name", | ||
) | ||
|
||
if not invoices: | ||
return | ||
|
||
update_gl_entry(doctype="Sales Invoice", invoices=invoices, value="Debit Note") | ||
|
||
|
||
def update_gl_entry(doctype, invoices, value): | ||
gl_entry = frappe.qb.DocType("GL Entry") | ||
( | ||
frappe.qb.update(gl_entry) | ||
.set("voucher_subtype", value) | ||
.where(gl_entry.voucher_subtype.isnotnull()) | ||
.where(gl_entry.voucher_no.isin(invoices)) | ||
.where(gl_entry.voucher_type == doctype) | ||
.run() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters