Skip to content

Commit

Permalink
Merge pull request #1646 from resilient-tech/version-15-hotfix
Browse files Browse the repository at this point in the history
chore: release v15
  • Loading branch information
vorasmit authored Jan 31, 2024
2 parents 7e4f238 + 577697f commit 04fa1ed
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 52 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ dec2438be2d63eff24da45d6c936ec846d8ab0df

# refactor window.ic => window.india_compliance
38a53480c70a2c820049f023cbabbdaa3ea8aad6

# updated black in pre-commit
d8c2469651974cc82a2bb50c93e22f723cbb5b42
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fail_fast: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.5.0
hooks:
- id: trailing-whitespace
files: "india_compliance.*"
Expand All @@ -16,17 +16,17 @@ repos:
- id: check-ast

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-isort, flake8-bugbear]
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -950,9 +950,9 @@ def get_manually_matched_data(self, purchase_name: str, inward_supply_name: str)
reconciliation_data = [
frappe._dict(
{
"_inward_supply": inward_supplies[0]
if inward_supplies
else frappe._dict(),
"_inward_supply": (
inward_supplies[0] if inward_supplies else frappe._dict()
),
"_purchase_invoice": purchases.get(purchase_name, frappe._dict()),
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,16 @@ def get_import_history(self, return_type, date_range, for_download=True):
status = status.replace("Downloaded", "Uploaded")

_dict = {
"Classification": category.value
if return_type is ReturnType.GSTR2A
else "ALL",
"Classification": (
category.value if return_type is ReturnType.GSTR2A else "ALL"
),
"Status": status,
columns[-1]: "✅  "
+ download.last_updated_on.strftime("%d-%m-%Y %H:%M:%S")
if download
else "",
columns[-1]: (
"✅  "
+ download.last_updated_on.strftime("%d-%m-%Y %H:%M:%S")
if download
else ""
),
}
if _dict not in data[period]:
data[period].append(_dict)
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
6 changes: 3 additions & 3 deletions india_compliance/gst_india/overrides/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,9 @@ def test_invalid_gst_account_outstate(self):

def test_invalid_gst_account_instate(self):
if self.is_sales_doctype:
self.transaction_details.customer = (
self.transaction_details.party_name
) = "_Test Registered Composition Customer"
self.transaction_details.customer = self.transaction_details.party_name = (
"_Test Registered Composition Customer"
)
else:
self.transaction_details.supplier = "_Test Registered InterState Supplier"

Expand Down
3 changes: 2 additions & 1 deletion india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ def get_place_of_supply(party_details, doctype):
party_details.customer_address,
("gst_state_number", "gst_state"),
)
return f"{gst_state_number}-{gst_state}"
if gst_state_number and gst_state:
return f"{gst_state_number}-{gst_state}"

party_gstin = party_details.billing_address_gstin or party_details.company_gstin
else:
Expand Down
6 changes: 3 additions & 3 deletions india_compliance/gst_india/utils/e_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ def update_payment_details(self):

self.transaction_details.update(
{
"payee_name": self.sanitize_value(self.doc.company)
if paid_amount
else "",
"payee_name": (
self.sanitize_value(self.doc.company) if paid_amount else ""
),
"mode_of_payment": self.get_mode_of_payment(),
"paid_amount": paid_amount,
"credit_days": credit_days,
Expand Down
16 changes: 10 additions & 6 deletions india_compliance/gst_india/utils/e_waybill.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,11 @@ def _generate_e_waybill(doc, throw=True, force=False):
return

frappe.msgprint(
_("e-Waybill generated successfully")
if result.validUpto or result.EwbValidTill
else _("e-Waybill (Part A) generated successfully"),
(
_("e-Waybill generated successfully")
if result.validUpto or result.EwbValidTill
else _("e-Waybill (Part A) generated successfully")
),
indicator="green",
alert=True,
)
Expand Down Expand Up @@ -1560,9 +1562,11 @@ def get_transaction_data(self):
self.transaction_details.update(
{
"company_gstin": REGISTERED_GSTIN,
"name": random_string(6).lstrip("0")
if not frappe.flags.in_test
else "test_invoice_no",
"name": (
random_string(6).lstrip("0")
if not frappe.flags.in_test
else "test_invoice_no"
),
}
)

Expand Down
8 changes: 5 additions & 3 deletions india_compliance/gst_india/utils/transaction_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,11 @@ def update_item_tax_details(self, item_details, item):

# considers senarios where same item is there multiple times
tax_amount = self.get_progressive_item_tax_amount(
tax_rate * item.qty
if row.charge_type == "On Item Quantity"
else tax_rate * item.taxable_value / 100,
(
tax_rate * item.qty
if row.charge_type == "On Item Quantity"
else tax_rate * item.taxable_value / 100
),
tax,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ def execute():

settings.db_set(
"generate_e_waybill_with_e_invoice",
0
if (settings.auto_generate_e_invoice and not settings.auto_generate_e_waybill)
else 1,
(
0
if (
settings.auto_generate_e_invoice
and not settings.auto_generate_e_waybill
)
else 1
),
)

0 comments on commit 04fa1ed

Please sign in to comment.