mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 05:59:18 +00:00
[regional] ability to send gst reminders to all parties
This commit is contained in:
0
erpnext/templates/pages/regional/__init__.py
Normal file
0
erpnext/templates/pages/regional/__init__.py
Normal file
0
erpnext/templates/pages/regional/india/__init__.py
Normal file
0
erpnext/templates/pages/regional/india/__init__.py
Normal file
37
erpnext/templates/pages/regional/india/update-gstin.html
Normal file
37
erpnext/templates/pages/regional/india/update-gstin.html
Normal file
@@ -0,0 +1,37 @@
|
||||
{% extends "templates/web.html" %}
|
||||
|
||||
{% block title %}Update GSTIN{% endblock %}
|
||||
|
||||
{% block header %}<h2>Update GSTIN</h2>{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
<h3>{{ party.name }}</h3>
|
||||
{% if invalid_gstin %}
|
||||
<p class='alert alert-danger' style='max-width: 300px;'>
|
||||
Invalid GSTIN
|
||||
</p>
|
||||
<p>
|
||||
<a href="?party={{ party.name }}">Edit Again</a>
|
||||
</p>
|
||||
{% elif updated %}
|
||||
<p class='alert alert-success' style='max-width: 300px;'>
|
||||
<i class='octicon octicon-check'></i> GSTIN Updated
|
||||
</p>
|
||||
<p>
|
||||
<a href="?party={{ party.name }}">Edit Again</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<p class='text-muted'>Please update your GSTIN for us to issue correct tax invoice</p>
|
||||
<form method='GET' action='/regional/india/update-gstin.html'>
|
||||
<input type='hidden' value='{{ party.name }}' name='party'>
|
||||
{% for address in party.__onload.addr_list %}
|
||||
<div class='bordered' style='max-width: 300px; margin-bottom: 15px;'>
|
||||
{{ address.display }}
|
||||
<p><input type='text' class='form-control'
|
||||
value='{{ address.gstin }}' name='{{ address.name }}' placeholder='GSTIN'></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<p><input type='submit' class='btn btn-primary' value='Update'></p>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
40
erpnext/templates/pages/regional/india/update_gstin.py
Normal file
40
erpnext/templates/pages/regional/india/update_gstin.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
party = frappe.form_dict.party
|
||||
|
||||
try:
|
||||
update_gstin(context)
|
||||
except frappe.ValidationError:
|
||||
context.invalid_gstin = 1
|
||||
|
||||
party_type = 'Customer'
|
||||
party = frappe.db.get_value('Customer', party)
|
||||
|
||||
if not party:
|
||||
party_type = 'Supplier'
|
||||
party = frappe.db.get_value('Supplier', party)
|
||||
|
||||
if not party:
|
||||
frappe.throw(_("Not Found"), frappe.DoesNotExistError)
|
||||
|
||||
context.party = frappe.get_doc(party_type, party)
|
||||
context.party.onload()
|
||||
|
||||
|
||||
def update_gstin(context):
|
||||
dirty = False
|
||||
for key, value in frappe.form_dict.items():
|
||||
if key != 'party':
|
||||
address_name = frappe.get_value('Address', key)
|
||||
if address_name:
|
||||
address = frappe.get_doc('Address', address_name)
|
||||
address.gstin = value
|
||||
address.save(ignore_permissions=True)
|
||||
dirty = True
|
||||
|
||||
if dirty:
|
||||
frappe.db.commit()
|
||||
context.updated = True
|
||||
Reference in New Issue
Block a user