mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 20:49:19 +00:00
fix: Inward supplies liable to reverse charge
This commit is contained in:
@@ -28,6 +28,9 @@ class GSTR3BReport(Document):
|
|||||||
self.get_outward_supply_details("Sales Invoice")
|
self.get_outward_supply_details("Sales Invoice")
|
||||||
self.set_outward_taxable_supplies()
|
self.set_outward_taxable_supplies()
|
||||||
|
|
||||||
|
self.get_outward_supply_details("Purchase Invoice", reverse_charge=True)
|
||||||
|
self.set_supplies_liable_to_reverse_charge()
|
||||||
|
|
||||||
itc_details = self.get_itc_details()
|
itc_details = self.get_itc_details()
|
||||||
self.set_itc_details(itc_details)
|
self.set_itc_details(itc_details)
|
||||||
self.get_itc_reversal_entries()
|
self.get_itc_reversal_entries()
|
||||||
@@ -129,7 +132,7 @@ class GSTR3BReport(Document):
|
|||||||
WHERE p.docstatus = 1 and p.name = i.parent
|
WHERE p.docstatus = 1 and p.name = i.parent
|
||||||
and p.is_opening = 'No'
|
and p.is_opening = 'No'
|
||||||
and p.gst_category != 'Registered Composition'
|
and p.gst_category != 'Registered Composition'
|
||||||
and (i.is_nil_exempt = 1 or i.is_non_gst = 1 or p.gst_catgory = 'Registered Composition') and
|
and (i.is_nil_exempt = 1 or i.is_non_gst = 1 or p.gst_category = 'Registered Composition') and
|
||||||
month(p.posting_date) = %s and year(p.posting_date) = %s
|
month(p.posting_date) = %s and year(p.posting_date) = %s
|
||||||
and p.company = %s and p.company_gstin = %s
|
and p.company = %s and p.company_gstin = %s
|
||||||
GROUP BY p.place_of_supply, i.is_nil_exempt, i.is_non_gst""",
|
GROUP BY p.place_of_supply, i.is_nil_exempt, i.is_non_gst""",
|
||||||
@@ -170,7 +173,7 @@ class GSTR3BReport(Document):
|
|||||||
condition = ''
|
condition = ''
|
||||||
|
|
||||||
if reverse_charge:
|
if reverse_charge:
|
||||||
condition += 'AND reverse_charge = Y'
|
condition += "AND reverse_charge = 'Y'"
|
||||||
|
|
||||||
invoice_details = frappe.db.sql("""
|
invoice_details = frappe.db.sql("""
|
||||||
SELECT
|
SELECT
|
||||||
@@ -318,8 +321,18 @@ class GSTR3BReport(Document):
|
|||||||
self.set_inter_state_supply(inter_state_supply_details)
|
self.set_inter_state_supply(inter_state_supply_details)
|
||||||
|
|
||||||
def set_supplies_liable_to_reverse_charge(self):
|
def set_supplies_liable_to_reverse_charge(self):
|
||||||
# ToDo:
|
for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
|
||||||
pass
|
for rate, items in items_based_on_rate.items():
|
||||||
|
for item_code, taxable_value in self.invoice_items.get(inv).items():
|
||||||
|
if item_code in items:
|
||||||
|
if inv in self.cgst_sgst_invoices:
|
||||||
|
tax_rate = rate/2
|
||||||
|
self.report_dict['sup_details']['isup_rev']['camt'] += (taxable_value * tax_rate /100)
|
||||||
|
self.report_dict['sup_details']['isup_rev']['samt'] += (taxable_value * tax_rate /100)
|
||||||
|
self.report_dict['sup_details']['isup_rev']['txval'] += taxable_value
|
||||||
|
else:
|
||||||
|
self.report_dict['sup_details']['isup_rev']['iamt'] += (taxable_value * rate /100)
|
||||||
|
self.report_dict['sup_details']['isup_rev']['txval'] += taxable_value
|
||||||
|
|
||||||
def set_inter_state_supply(self, inter_state_supply):
|
def set_inter_state_supply(self, inter_state_supply):
|
||||||
for key, value in iteritems(inter_state_supply):
|
for key, value in iteritems(inter_state_supply):
|
||||||
|
|||||||
@@ -728,16 +728,19 @@ def update_itc_availed_fields(doc, method):
|
|||||||
if country != 'India':
|
if country != 'India':
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Initialize values
|
||||||
|
doc.itc_integrated_tax = doc.itc_state_tax = doc.itc_central_tax = doc.itc_cess_amount = 0
|
||||||
gst_accounts = get_gst_accounts(doc.company, only_non_reverse_charge=1)
|
gst_accounts = get_gst_accounts(doc.company, only_non_reverse_charge=1)
|
||||||
|
|
||||||
for tax in doc.get('taxes'):
|
for tax in doc.get('taxes'):
|
||||||
if tax.account_head in gst_accounts.get('igst_account'):
|
if tax.account_head in gst_accounts.get('igst_account'):
|
||||||
doc.itc_integrated_tax += tax.base_tax_amount_after_discount_amount
|
doc.itc_integrated_tax += flt(tax.base_tax_amount_after_discount_amount)
|
||||||
if tax.account_head in gst_accounts.get('sgst_account'):
|
if tax.account_head in gst_accounts.get('sgst_account'):
|
||||||
doc.itc_state_tax += tax.base_tax_amount_after_discount_amount
|
doc.itc_state_tax += flt(tax.base_tax_amount_after_discount_amount)
|
||||||
if tax.account_head in gst_accounts.get('cgst_account'):
|
if tax.account_head in gst_accounts.get('cgst_account'):
|
||||||
doc.itc_central_tax += tax.base_tax_amount_after_discount_amount
|
doc.itc_central_tax += flt(tax.base_tax_amount_after_discount_amount)
|
||||||
if tax.account_head in gst_accounts.get('cess_account'):
|
if tax.account_head in gst_accounts.get('cess_account'):
|
||||||
doc.itc_cess_amount += tax.base_tax_amount_after_discount_amount
|
doc.itc_cess_amount += flt(tax.base_tax_amount_after_discount_amount)
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_regional_round_off_accounts(company, account_list):
|
def get_regional_round_off_accounts(company, account_list):
|
||||||
|
|||||||
Reference in New Issue
Block a user