Skip to content

Commit

Permalink
fix: get correct POS in Payment Entry Doctype
Browse files Browse the repository at this point in the history
(cherry picked from commit 16d5ea0)
  • Loading branch information
ljain112 authored and mergify[bot] committed Jan 31, 2024
1 parent cf1a37d commit 30c494f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
4 changes: 3 additions & 1 deletion india_compliance/gst_india/client_scripts/payment_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ frappe.ui.form.on("Payment Entry", {
);
},

customer_address: update_gst_details,
customer_address(frm) {
update_gst_details(frm);
},
});

function override_get_outstanding_documents(frm) {
Expand Down
30 changes: 12 additions & 18 deletions india_compliance/gst_india/overrides/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from frappe import _
from frappe.contacts.doctype.address.address import get_default_address
from frappe.query_builder.functions import Sum
from frappe.utils import cstr, flt, getdate
from frappe.utils import flt, getdate
from erpnext.accounts.general_ledger import make_gl_entries
from erpnext.accounts.utils import create_payment_ledger_entry
from erpnext.controllers.accounts_controller import get_advance_payment_entries
Expand Down Expand Up @@ -107,6 +107,17 @@ def update_party_details(party_details, doctype, company):
address = get_default_address("Customer", party_details.get("customer"))
party_details.update(customer_address=address)

# update gst details
if address:
party_details.update(
frappe.db.get_value(
"Address",
address,
["gstin as billing_address_gstin"],
as_dict=1,
)
)

# Update address for update
response = {
"customer_address": address, # should be set first as gst_category and gstin is fetched from address
Expand All @@ -116,23 +127,6 @@ def update_party_details(party_details, doctype, company):
return response


def update_place_of_supply(doc):
country = frappe.get_cached_value("Company", doc.company, "country")
if country != "India":
return

address = frappe.db.get_value(
"Address",
doc.get("customer_address"),
["gst_state", "gst_state_number"],
as_dict=1,
)
if address and address.gst_state and address.gst_state_number:
doc.place_of_supply = (
cstr(address.gst_state_number) + "-" + cstr(address.gst_state)
)


def make_gst_revesal_entry_from_advance_payment(doc):
"""
This functionality aims to create a GST reversal entry where GST was paid in advance
Expand Down

0 comments on commit 30c494f

Please sign in to comment.