resilient-tech / india-compliance

Simple, yet powerful compliance solutions for Indian businesses
https://indiacompliance.app
GNU General Public License v3.0
150 stars 137 forks source link

is_non_gst issue #2047

Closed vishdha closed 6 months ago

vishdha commented 6 months ago

Information about bug

WhatsApp Image 2024-04-18 at 12 06 39 PM (1)

Please give solution for this or look for the issue

Version

ERPNext: v14.49.0 (version-14) Frappe Framework: v14.56.0 (version-14) India Compliance: v14.19.4 (version-14)

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
    "ecommerce_integrations": "1.19.3",
    "erpnext": "14.49.0",
    "eshopbox": "0.0.1",
    "frappe": "14.56.0",
    "india_compliance": "14.19.4",
    "payments": "0.0.1"
}

### Route

Form/Purchase Invoice/new-purchase-invoice-iplnsbvqeb

### Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 95, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, in handle
    if cmd != "login":
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
  File "apps/frappe/frappe/__init__.py", line 1622, in call
    {"a": 2}
  File "apps/frappe/frappe/desk/form/save.py", line 31, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 309, in save
    def _save(self, ignore_permissions=None, ignore_version=None) -> "Document":
  File "apps/frappe/frappe/model/document.py", line 331, in _save
    self._set_defaults()
  File "apps/frappe/frappe/model/document.py", line 262, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1055, in run_before_save_methods
    return
  File "apps/frappe/frappe/model/document.py", line 919, in run_method
    def fn(self, *args, **kwargs):
  File "apps/frappe/frappe/model/document.py", line 1281, in composer
  File "apps/frappe/frappe/model/document.py", line 1265, in runner
  File "apps/india_compliance/india_compliance/gst_india/overrides/purchase_invoice.py", line 43, in validate
    if validate_transaction(doc) is False:
  File "apps/india_compliance/india_compliance/gst_india/overrides/transaction.py", line 932, in validate_transaction
    ):
  File "apps/india_compliance/india_compliance/gst_india/overrides/transaction.py", line 990, in ignore_gst_validations
    '<a href="https://docs.erpnext.com/docs/user/manual/en/regional/india/gst-setup">GST'
  File "apps/india_compliance/india_compliance/gst_india/overrides/transaction.py", line 378, in validate_items
    _throw(
AttributeError: 'PurchaseInvoiceItem' object has no attribute 'is_non_gst'

### Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"owner\":\"gaurav.s@farmley.com\",\"docstatus\":0,\"idx\":0,\"naming_series\":\"PI.YY./.MM./.####\",\"supplier\":\"M/S. Riwaayat\",\"supplier_name\":\"M/S. Riwaayat\",\"tax_id\":\"09BZAPA0850L1ZK\",\"company\":\"Connedit Business Solutions Pvt. Ltd.\",\"posting_date\":\"2024-04-18\",\"posting_time\":\"10:36:13.740444\",\"set_posting_time\":0,\"due_date\":\"2024-04-18\",\"is_paid\":0,\"no_double_ledger\":0,\"is_return\":0,\"update_outstanding_for_self\":1,\"update_billed_amount_in_purchase_order\":0,\"update_billed_amount_in_purchase_receipt\":1,\"apply_tds\":0,\"is_reverse_charge\":0,\"branch\":\"Indore\",\"bill_no\":\"GST-03\",\"currency\":\"INR\",\"conversion_rate\":1,\"use_transaction_date_exchange_rate\":0,\"buying_price_list\":\"Standard Buying\",\"price_list_currency\":\"INR\",\"plc_conversion_rate\":1,\"ignore_pricing_rule\":0,\"update_stock\":0,\"set_warehouse\":\"RPC Indore - Reprocessing Warehouse - CBSPL\",\"is_subcontracted\":0,\"total_qty\":231,\"total_net_weight\":4.158,\"base_total\":1714.02,\"base_net_total\":1714.02,\"total\":1714.02,\"net_total\":1714.02,\"tax_withholding_net_total\":1714.02,\"base_tax_withholding_net_total\":1714.02,\"tax_category\":\"Interstate- Purchase\",\"taxes_and_charges\":\"Input GST Out-state - CBSPL\",\"base_taxes_and_charges_added\":205.68,\"base_taxes_and_charges_deducted\":0,\"base_total_taxes_and_charges\":205.68,\"taxes_and_charges_added\":205.68,\"taxes_and_charges_deducted\":0,\"total_taxes_and_charges\":205.68,\"base_grand_total\":1919.7,\"base_rounding_adjustment\":0.3,\"base_rounded_total\":1920,\"base_in_words\":\"\",\"grand_total\":1919.7,\"rounding_adjustment\":0.3,\"use_company_roundoff_cost_center\":0,\"rounded_total\":1920,\"in_words\":\"\",\"total_advance\":0,\"outstanding_amount\":1920,\"disable_rounded_total\":0,\"apply_discount_on\":\"Grand Total\",\"base_discount_amount\":0,\"additional_discount_percentage\":0,\"discount_amount\":0,\"other_charges_calculation\":\"<div class=\\\"tax-break-up\\\" style=\\\"overflow-x: auto;\\\">\\n\\t<table class=\\\"table table-bordered table-hover\\\">\\n\\t\\t<thead>\\n\\t\\t\\t<tr>\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t<th class=\\\"text-left\\\">HSN/SAC</th>\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t<th class=\\\"text-right\\\">Taxable Amount</th>\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t<th class=\\\"text-right\\\">IGST ITC</th>\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t</tr>\\n\\t\\t</thead>\\n\\t\\t<tbody>\\n\\t\\t\\t\\n\\t\\t\\t\\t<tr>\\n\\t\\t\\t\\t\\t<td>20089700</td>\\n\\t\\t\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t₹ 1,714.02\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t</td>\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t(12.0%)\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t₹ 205.68\\n\\t\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t</td>\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t</tr>\\n\\t\\t\\t\\n\\t\\t</tbody>\\n\\t</table>\\n</div>\",\"gst_breakup_table\":null,\"base_paid_amount\":0,\"paid_amount\":0,\"allocate_advances_automatically\":0,\"only_include_allocated_payments\":0,\"write_off_amount\":0,\"base_write_off_amount\":0,\"supplier_address\":\"M/S. Riwaayat-Billing\",\"address_display\":\"Plot NO.28 Khasra NO.328, Lambardar Complex<br>Vivekanand Marg, Ghaziabad<br>Ghaziabad<br>\\nUttar Pradesh<br>201005<br>India<br>\\n\",\"supplier_gstin\":\"09BZAPA0850L1ZK\",\"gst_category\":\"Registered Regular\",\"supplier_gst_state_number\":\"09\",\"contact_person\":\"M/S. Riwaayat-M/S. Riwaayat\",\"contact_display\":\"M/S. Riwaayat\",\"contact_mobile\":\"8920106324\",\"contact_email\":\"msriwaayat@gmail.com\",\"shipping_address\":\"Indore Office-Billing\",\"shipping_address_display\":\"Godown No-5 and 6<br>Khasra No 17/2/2, and 3, 51/1/2, Kaji, Palasiya<br>Indore<br>\\nMadhya Pradesh<br>452016<br>India<br>\\n\",\"billing_address\":\"Indore Office-Billing\",\"company_gst_state_number\":\"23\",\"billing_address_display\":\"Godown No-5 and 6<br>Khasra No 17/2/2, and 3, 51/1/2, Kaji, Palasiya<br>Indore<br>\\nMadhya Pradesh<br>452016<br>India<br>\\n\",\"company_gstin\":\"23AAHCC0850A1ZF\",\"place_of_supply\":\"23-Madhya Pradesh\",\"payment_terms_template\":\"ADVANCE\",\"ignore_default_payment_terms_template\":0,\"tc_name\":\"Purchase Order Terms\",\"terms\":\"**Terms & Conditions :- **    1. The validity of the purchase order is 30 days.   2. In case of the above-mentioned order is rejected due to following reasons but not limited to: Non-adherence to agreed terms of service, divergence from the agreed-upon quality of the commodity or supplied stock, costs incurred to return the aforementioned supply and dispatching the new material with the correct specification will be borne the vendor as per actual.   3. If there is a delay in supply of the order which amounts to more than 5 days (or under the discretion of purchase manager) from the date PO release date, Farmley will not be held responsible or in any way liable for cancellation of said Order/Sauda/PO.    4. Payment against the material supplied (as per PO) will be made in accordance to agreed terms i.e. ___ days after delivery/dispatch   5. The address of delivery is subject to change prior to pick-up.   6. Adherence of process, guidelines and any other instructions will be observed strictly and should be limited to the exact scope as laid out in our master agreement signed between the parties   7. Any disputes of legal nature will be limited to and settled in Delhi's jurisdiction only   \",\"status\":\"Draft\",\"per_received\":0,\"credit_to\":\"31000 - Sundry Creditors - CBSPL\",\"party_account_currency\":\"INR\",\"is_opening\":\"No\",\"repost_required\":0,\"letter_head\":\"Letter Head Farmley\",\"group_same_items\":0,\"language\":\"en\",\"distance\":0,\"mode_of_transport\":\"Road\",\"lr_date\":\"2024-04-18\",\"gst_vehicle_type\":\"Regular\",\"itc_classification\":\"All Other ITC\",\"ineligibility_reason\":\"\",\"reconciliation_status\":\"\",\"itc_integrated_tax\":0,\"itc_central_tax\":0,\"itc_state_tax\":0,\"itc_cess_amount\":0,\"on_hold\":0,\"is_internal_supplier\":0,\"is_old_subcontracting_flow\":0,\"export_type\":\"With Payment of Tax\",\"invoice_copy\":\"Original for Recipient\",\"reverse_charge\":\"N\",\"doctype\":\"Purchase Invoice\",\"tax_withheld_vouchers\":[],\"items\":[{\"owner\":\"gaurav.s@farmley.com\",\"docstatus\":0,\"idx\":1,\"item_code\":\"Dry Fruit Mix_15-2849\",\"item_name\":\"Paan Mix Farmley Pillow Pouch 18g\",\"description\":\"<div><table><tbody><tr><td>Paan Mix Farmley Pillow Pouch 18g</td></tr></tbody></table></div>\",\"gst_hsn_code\":\"20089700\",\"is_ineligible_for_itc\":0,\"item_group\":\"Dry Fruit Mix\",\"image\":\"\",\"received_qty\":0,\"qty\":231,\"rejected_qty\":0,\"uom\":\"UNT\",\"conversion_factor\":0.018,\"stock_uom\":\"KGS\",\"stock_qty\":4.158,\"price_list_rate\":0,\"base_price_list_rate\":0,\"margin_type\":\"\",\"margin_rate_or_amount\":0,\"rate_with_margin\":0,\"discount_percentage\":0,\"discount_amount\":0,\"base_rate_with_margin\":0,\"rate\":7.42,\"amount\":1714.02,\"item_tax_template\":\"P 12I - CBSPL\",\"base_rate\":7.42,\"base_amount\":1714.02,\"stock_uom_rate\":0,\"is_free_item\":0,\"apply_tds\":1,\"net_rate\":7.42,\"net_amount\":1714.02,\"base_net_rate\":7.42,\"base_net_amount\":1714.02,\"taxable_value\":0,\"igst_rate\":0,\"cgst_rate\":0,\"sgst_rate\":0,\"cess_rate\":0,\"cess_non_advol_rate\":0,\"igst_amount\":0,\"cgst_amount\":0,\"sgst_amount\":0,\"cess_amount\":0,\"cess_non_advol_amount\":0,\"valuation_rate\":412.222222,\"item_tax_amount\":0,\"landed_cost_voucher_amount\":0,\"rm_supp_cost\":0,\"warehouse\":\"RPC Indore - Reprocessing Warehouse - CBSPL\",\"expense_account\":\"Stock Received But Not Billed - CBSPL\",\"is_fixed_asset\":0,\"enable_deferred_expense\":0,\"allow_zero_valuation_rate\":0,\"item_tax_rate\":\"{\\\"18700 - IGST ITC - CBSPL\\\": 12.0}\",\"include_exploded_items\":0,\"purchase_order\":\"PO-24-04-0122\",\"po_detail\":\"8bde7b0225\",\"purchase_receipt\":\"PR24/04/0101\",\"pr_detail\":\"02d34c869f\",\"weight_per_unit\":1,\"total_weight\":4.158,\"weight_uom\":\"KGS\",\"page_break\":0,\"parentfield\":\"items\",\"parenttype\":\"Purchase Invoice\",\"doctype\":\"Purchase Invoice Item\",\"__islocal\":1,\"__unsaved\":1,\"parent\":\"new-purchase-invoice-yipaqhobor\",\"name\":\"new-purchase-invoice-item-svkaiowyaa\"}],\"pricing_rules\":[],\"advances\":[],\"taxes\":[{\"owner\":\"gaurav.s@farmley.com\",\"docstatus\":0,\"idx\":1,\"category\":\"Total\",\"add_deduct_tax\":\"Add\",\"charge_type\":\"On Net Total\",\"included_in_print_rate\":0,\"included_in_paid_amount\":0,\"account_head\":\"18700 - IGST ITC - CBSPL\",\"description\":\"IGST ITC\",\"rate\":0,\"account_currency\":\"INR\",\"tax_amount\":205.68,\"tax_amount_after_discount_amount\":205.68,\"total\":1919.7,\"base_tax_amount\":205.68,\"base_total\":1919.7,\"base_tax_amount_after_discount_amount\":205.68,\"item_wise_tax_detail\":\"{\\\"Dry Fruit Mix_15-2849\\\":[12,205.68]}\",\"parentfield\":\"taxes\",\"parenttype\":\"Purchase Invoice\",\"doctype\":\"Purchase Taxes and Charges\",\"__islocal\":1,\"__unsaved\":1,\"parent\":\"new-purchase-invoice-yipaqhobor\",\"name\":\"new-purchase-taxes-and-charges-afrlluxmfw\"}],\"payment_schedule\":[{\"docstatus\":0,\"doctype\":\"Payment Schedule\",\"name\":\"new-payment-schedule-sxwzkhrxpv\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"gaurav.s@farmley.com\",\"discount_type\":\"Percentage\",\"discounted_amount\":0,\"parent\":\"new-purchase-invoice-yipaqhobor\",\"parentfield\":\"payment_schedule\",\"parenttype\":\"Purchase Invoice\",\"idx\":1,\"payment_term\":\"ADVANCE\",\"description\":null,\"invoice_portion\":100,\"payment_amount\":1920,\"base_payment_amount\":1920,\"discount\":0,\"outstanding\":1920,\"mode_of_payment\":null,\"due_date\":\"2024-04-18\",\"discount_date\":\"2024-04-09\"}],\"advance_tax\":[],\"supplied_items\":[],\"__islocal\":1,\"__onload\":{\"make_payment_via_journal_entry\":0,\"backflush_based_on\":\"BOM\",\"supplier_tds\":null,\"load_after_mapping\":true,\"ignore_price_list\":true},\"__unsaved\":1,\"name\":\"new-purchase-invoice-yipaqhobor\",\"__last_sync_on\":\"2024-04-18T05:06:14.110Z\",\"workflow_state\":\"Draft\",\"change_amount\":0,\"base_change_amount\":0,\"bill_date\":\"2024-04-09\"}",
        "action": "Save"
    },
    "btn": {
        "jQuery360055966334563737231": {
            "events": {
                "click": [
                    {
                        "type": "click",
                        "origType": "click",
                        "guid": 9826,
                        "namespace": ""
                    }
                ]
            }
        }
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs"
}

### Response Data

{
    "exception": "AttributeError: 'PurchaseInvoiceItem' object has no attribute 'is_non_gst'"
}

Code of Conduct

vorasmit commented 6 months ago

Looks like custom field may be deleted. Creating custom fields again should resolve this issue.

Enter the following command in bench directory to create missing custom fields:

bench execute india_compliance.gst_india.setup.create_custom_fields