Skip to content

Commit

Permalink
Merge pull request #1172 from resilient-tech/version-14-hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit authored Oct 20, 2023
2 parents 1ab9476 + ba8d116 commit 17137ab
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 92 deletions.
26 changes: 10 additions & 16 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributor Covenant Code of Conduct

## Our Pledge
Expand All @@ -18,24 +17,19 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Expand Down
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Simple, yet powerful compliance solutions for Indian businesses

</div>



## Introduction

India Compliance has been designed to make compliance with Indian rules and regulations simple, swift and reliable. To this end, it has been carefully integrated with GST APIs to simplify recurring compliance processes.
Expand All @@ -19,35 +17,29 @@ It builds on top of [ERPNext](https://github.com/frappe/erpnext) and the [Frappe

## Key Features

- End-to-end GST e-Waybill management
- Automated GST e-Invoice generation and cancellation
- Autofill Party and Address details by entering their GSTIN
- Configurable features based on business needs
- Powerful validations to ensure correct compliance
- End-to-end GST e-Waybill management
- Automated GST e-Invoice generation and cancellation
- Advanced purchase reconciliation based on GSTR-2B and GSTR-2A
- Autofill Party and Address details by entering their GSTIN
- Configurable features based on business needs
- Powerful validations to ensure correct compliance

For a detailed overview of these features, please [refer to the documentation](https://docs.erpnext.com/docs/v14/user/manual/en/regional/india).

## Installation

Once you've [set up a Frappe site](https://frappeframework.com/docs/v14/user/en/installation/), installing India Compliance is simple:


1. Download the app using the Bench CLI.
1. Download the app using the Bench CLI.

```bash
bench get-app --branch [branch name] https://github.com/resilient-tech/india-compliance.git
```

Replace `[branch name]` with the appropriate branch as per your setup:

| Frappe Branch | India Compliance Branch |
|---------------|-------------------------|
| version-14 | version-14 |
| develop | next |

If it isn't specified, the `--branch` option will default to `next`.
Replace `[branch name]` with the branch that you're using for Frappe Framework and ERPNext.
If it isn't specified, the `--branch` option will default to **develop**.

2. Install the app on your site.
2. Install the app on your site.

```bash
bench --site [site name] install-app india_compliance
Expand All @@ -59,13 +51,12 @@ Some of the automation features available in India Compliance require access to

## Planned Features

- Advanced purchase reconciliation based on GSTR-2B and GSTR-2A
- Quick and easy filing process for GSTR-1 and GSTR-3B
- Quick and easy filing process for GSTR-1 and GSTR-3B

## Contributing

- [Issue Guidelines](https://github.com/frappe/erpnext/wiki/Issue-Guidelines)
- [Pull Request Requirements](https://github.com/frappe/erpnext/wiki/Contribution-Guidelines)
- [Issue Guidelines](https://github.com/frappe/erpnext/wiki/Issue-Guidelines)
- [Pull Request Requirements](https://github.com/frappe/erpnext/wiki/Contribution-Guidelines)

## License

Expand Down
4 changes: 0 additions & 4 deletions india_compliance/gst_india/api_classes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
from india_compliance.gst_india.api_classes.e_invoice import EInvoiceAPI
from india_compliance.gst_india.api_classes.e_waybill import EWaybillAPI
from india_compliance.gst_india.api_classes.public import PublicAPI
from india_compliance.gst_india.api_classes.returns import GSTR2aAPI, GSTR2bAPI
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def setUp(self):
filters = {"company": "_Test Indian Registered Company"}

for doctype in ("Sales Invoice", "Purchase Invoice", "GSTR 3B Report"):
frappe.db.delete("Sales Invoice", filters=filters)
frappe.db.delete(doctype, filters=filters)

@classmethod
def tearDownClass(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,9 @@ def get_cleaner_bill_no(bill_no, fy):
return inv

@staticmethod
def get_dict_for_key(key, list):
def get_dict_for_key(key, args_list):
new_dict = frappe._dict()
for data in list:
for data in args_list:
new_dict.setdefault(data[key], {})[data.name] = data

return new_dict
Expand All @@ -1290,7 +1290,7 @@ def update_cess_amount(doc):
doc.cess = doc.get("cess", 0) + doc.get("cess_non_advol", 0)

@staticmethod
def get_periods(date_range, return_type: ReturnType, reversed=False):
def get_periods(date_range, return_type: ReturnType, reversed_order=False):
"""Returns a list of month (formatted as `MMYYYY`) in a fiscal year"""
if not date_range:
return []
Expand All @@ -1300,7 +1300,9 @@ def get_periods(date_range, return_type: ReturnType, reversed=False):

# latest to oldest
return tuple(
BaseUtil._reversed(BaseUtil._get_periods(date_range[0], end_date), reversed)
BaseUtil._reversed(
BaseUtil._get_periods(date_range[0], end_date), reversed_order
)
)

@staticmethod
Expand Down
3 changes: 2 additions & 1 deletion india_compliance/gst_india/overrides/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ def on_update_after_submit(doc, method=None):
if doc.ewaybill or doc.irn:
frappe.msgprint(
_(
"You have already generated e-Waybill/e-Invoice for this document. This could result in mismatch of item details in e-Waybill/e-Invoice with print format.",
"You have already generated e-Waybill/e-Invoice for this document."
" This could result in mismatch of item details in e-Waybill/e-Invoice with print format.",
),
title="Possible Inconsistent Item Details",
indicator="orange",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ frappe.pages["india-compliance-account"].on_page_load = async function (wrapper)
"india_compliance_account.bundle.css",
]);

icAccountPage = new india_compliance.pages.IndiaComplianceAccountPage(wrapper, PAGE_NAME);
new india_compliance.pages.IndiaComplianceAccountPage(wrapper);
};
12 changes: 6 additions & 6 deletions india_compliance/gst_india/print_format/e_waybill/e_waybill.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
}
}

.print-format tbody > tr > td,
.print-format tbody > tr > th {
.print-format tbody>tr>td,
.print-format tbody>tr>th {
padding: 6px !important;
border-top: None;
border-top: none;
color: black;
}

Expand All @@ -30,7 +30,7 @@

.print-format .page-layout {
font-size: 12px;
line-height: 1.42857143;
line-height: 1.4286;
box-sizing: border-box;
transform-origin: top center;
width: 95%;
Expand All @@ -49,7 +49,7 @@

.print-format .vehicle-info td,
.print-format .vehicle-info th {
border: 0px !important;
border: 0 !important;
border-top: 1px solid black !important;
}

Expand All @@ -67,4 +67,4 @@
margin-top: 5px;
width: 95px !important;
image-rendering: -webkit-optimize-contrast;
}
}
9 changes: 4 additions & 5 deletions india_compliance/gst_india/report/gst_balance/gst_balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function set_gstin_options(report) {
const gstin_field = report.get_filter("company_gstin");
gstin_field.set_data(options);

if (options.length == 1) gstin_field.set_value(options[0]);
if (options.length === 1) gstin_field.set_value(options[0]);
}

function toggle_filters(report) {
Expand All @@ -85,9 +85,8 @@ function add_custom_button_to_update_gstin(report) {
if (!voucher_types.length) return;

report._gst_accounts = company_accounts;
report.page.add_inner_button(
__("Update GSTIN"),
() => update_gstin_message(report, voucher_types)
report.page.add_inner_button(__("Update GSTIN"), () =>
update_gstin_message(report, voucher_types)
);
});
}
Expand All @@ -107,7 +106,7 @@ async function update_gstin_message(report, voucher_types) {

frappe.msg_dialog.custom_onhide = () => {
report.refresh();
}
};
}

function get_update_gstin_message(report, voucher_types) {
Expand Down
2 changes: 1 addition & 1 deletion india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def validate_pincode(address):
first_three_digits = cint(address.pincode[:3])
pincode_range = STATE_PINCODE_MAPPING[address.state]

if type(pincode_range[0]) == int:
if isinstance(pincode_range[0], int):
pincode_range = (pincode_range,)

for lower_limit, upper_limit in pincode_range:
Expand Down
3 changes: 2 additions & 1 deletion india_compliance/gst_india/utils/e_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ def generate_e_invoice(docname, throw=True, force=False):

frappe.msgprint(
_(
"Government services are currently slow, resulting in a Gateway Timeout error. We apologize for the inconvenience caused. Your e-invoice generation will be automatically retried every 5 minutes."
"Government services are currently slow, resulting in a Gateway Timeout error."
" We apologize for the inconvenience caused. Your e-invoice generation will be automatically retried every 5 minutes."
),
_("Warning"),
indicator="yellow",
Expand Down
5 changes: 3 additions & 2 deletions india_compliance/gst_india/utils/test_e_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_validate_transaction(self):
si = create_sales_invoice(do_not_submit=True)
item_row = si.get("items")[0]

for index in range(0, 1000):
for _ in range(0, 1000):
si.append(
"items",
{
Expand Down Expand Up @@ -634,7 +634,8 @@ def test_invoice_update_after_submit(self):

self.assertEqual(
json.loads(frappe.message_log[-1]).get("message"),
"You have already generated e-Waybill/e-Invoice for this document. This could result in mismatch of item details in e-Waybill/e-Invoice with print format.",
"You have already generated e-Waybill/e-Invoice for this document."
" This could result in mismatch of item details in e-Waybill/e-Invoice with print format.",
)

@responses.activate
Expand Down
3 changes: 2 additions & 1 deletion india_compliance/gst_india/utils/test_e_waybill.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ def test_invoice_update_after_submit(self):

self.assertEqual(
json.loads(frappe.message_log[-1]).get("message"),
"You have already generated e-Waybill/e-Invoice for this document. This could result in mismatch of item details in e-Waybill/e-Invoice with print format.",
"You have already generated e-Waybill/e-Invoice for this document."
" This could result in mismatch of item details in e-Waybill/e-Invoice with print format.",
)

@change_settings("GST Settings", {"enable_e_waybill_from_dn": 1})
Expand Down
10 changes: 6 additions & 4 deletions india_compliance/hooks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from . import __version__ as app_version

app_name = "india_compliance"
app_title = "India Compliance"
app_publisher = "Resilient Tech"
Expand Down Expand Up @@ -188,8 +186,12 @@
"India": {
"erpnext.controllers.taxes_and_totals.get_itemised_tax_breakup_header": "india_compliance.gst_india.overrides.transaction.get_itemised_tax_breakup_header",
"erpnext.controllers.taxes_and_totals.get_itemised_tax_breakup_data": "india_compliance.gst_india.overrides.transaction.get_itemised_tax_breakup_data",
"erpnext.controllers.taxes_and_totals.get_regional_round_off_accounts": "india_compliance.gst_india.overrides.transaction.get_regional_round_off_accounts",
"erpnext.controllers.accounts_controller.update_gl_dict_with_regional_fields": "india_compliance.gst_india.overrides.gl_entry.update_gl_dict_with_regional_fields",
"erpnext.controllers.taxes_and_totals.get_regional_round_off_accounts": (
"india_compliance.gst_india.overrides.transaction.get_regional_round_off_accounts"
),
"erpnext.controllers.accounts_controller.update_gl_dict_with_regional_fields": (
"india_compliance.gst_india.overrides.gl_entry.update_gl_dict_with_regional_fields"
),
"erpnext.controllers.accounts_controller.get_advance_payment_entries_for_regional": (
"india_compliance.gst_india.overrides.payment_entry.get_advance_payment_entries_for_regional"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
create_company_fixtures as create_income_tax_fixtures,
)

"""
This patch is used to create company fixtures for Indian Companies created before installing India Compliance.
"""


def execute():
"""
This patch is used to create company fixtures for Indian Companies created before installing India Compliance.
"""

company_list = frappe.get_all(
"Company", filters={"country": "India"}, pluck="name", order_by="lft asc"
)
Expand Down
22 changes: 11 additions & 11 deletions india_compliance/public/js/quick_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ class GSTQuickEntryForm extends frappe.ui.form.QuickEntryForm {
constructor(...args) {
super(...args);
this.skip_redirect_on_error = true;
this.api_enabled = india_compliance.is_api_enabled() && gst_settings.autofill_party_info;
this.api_enabled =
india_compliance.is_api_enabled() && gst_settings.autofill_party_info;
}

async setup() {
Expand All @@ -23,11 +24,11 @@ class GSTQuickEntryForm extends frappe.ui.form.QuickEntryForm {
fieldtype: "Section Break",
description: this.api_enabled
? __(
`When you enter a GSTIN, the permanent address linked to it is
`When you enter a GSTIN, the permanent address linked to it is
autofilled.<br>
Change the {0} to autofill other addresses.`,
[frappe.meta.get_label("Address", "pincode")]
)
[frappe.meta.get_label("Address", "pincode")]
)
: "",
collapsible: 0,
},
Expand Down Expand Up @@ -79,7 +80,8 @@ class GSTQuickEntryForm extends frappe.ui.form.QuickEntryForm {
ignore_validation: true,
onchange: () => {
const d = this.dialog;
if (this.api_enabled && !gst_settings.sandbox_mode) return autofill_fields(d);
if (this.api_enabled && !gst_settings.sandbox_mode)
return autofill_fields(d);

d.set_value(
"gst_category",
Expand Down Expand Up @@ -296,8 +298,8 @@ class AddressQuickEntryForm extends GSTQuickEntryForm {

return {
party_type: party_type,
party: party
}
party: party,
};
}
}

Expand All @@ -316,7 +318,7 @@ async function autofill_fields(dialog) {
const gstin = dialog.doc._gstin;
const gstin_field = dialog.get_field("_gstin");

if (!gstin || gstin.length != 15) {
if (!gstin || gstin.length !== 15) {
const pincode_field = dialog.fields_dict._pincode;
pincode_field.set_data([]);
pincode_field.df.onchange = null;
Expand All @@ -339,9 +341,7 @@ function set_gstin_description(gstin_field, status) {
return;
}

gstin_field.set_description(
india_compliance.get_gstin_status_desc(status)
);
gstin_field.set_description(india_compliance.get_gstin_status_desc(status));
}

function setup_pincode_field(dialog, gstin_info) {
Expand Down
Loading

0 comments on commit 17137ab

Please sign in to comment.