frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.11k stars 7.23k forks source link

Sales Invoice and Purchase Invoice V15 error #38709

Closed precihole closed 9 months ago

precihole commented 10 months ago

Information about bug

Hello,

when i click on Allocate Advances Automatically (FIFO) i am getting an error below, image

Module

selling

Version

ERPNext: v15.4.0 (HEAD)

Erpnext Telegram Integration: v1.2.0 (master)

Frappe Framework: v15.4.1 (version-15)

Frappe HR: v15.5.0 (version-15)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
    "erpnext": "15.4.0",
    "erpnext_telegram_integration": "1.2.0",
    "frappe": "15.4.1",
    "hrms": "15.5.0",
    "india_compliance": "15.0.4",
    "insights": "1.2.7",
    "payments": "0.0.1",
    "pl_accounts": "0.0.1",
    "quality_inspection": "0.0.1",
    "raven": "1.3.2"
}

Route

Form/Sales Invoice/new-sales-invoice-bbrapcsust

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1715, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/handler.py", line 328, in run_doc_method
    response = doc.run_method(method)
  File "apps/frappe/frappe/model/document.py", line 950, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1316, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1298, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 947, in fn
    return method_object(*args, **kwargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 975, in set_advances
    res = self.get_advance_entries(
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 1026, in get_advance_entries
    journal_entries = get_advance_journal_entries(
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 2483, in get_advance_journal_entries
    .where(
  File "env/lib/python3.10/site-packages/pypika/utils.py", line 50, in _copy
    result = func(self_copy, *args, **kwargs)
  File "env/lib/python3.10/site-packages/pypika/queries.py", line 930, in where
    if not self._validate_table(criterion):
  File "env/lib/python3.10/site-packages/pypika/queries.py", line 1155, in _validate_table
    for field in term.fields_():
  File "env/lib/python3.10/site-packages/pypika/terms.py", line 57, in fields_
    return set(self.find_(Field))
  File "env/lib/python3.10/site-packages/pypika/terms.py", line 37, in find_
    return [node for node in self.nodes_() if isinstance(node, type)]
  File "env/lib/python3.10/site-packages/pypika/terms.py", line 37, in <listcomp>
    return [node for node in self.nodes_() if isinstance(node, type)]
  File "env/lib/python3.10/site-packages/pypika/terms.py", line 743, in nodes_
    yield from self.left.nodes_()
  File "env/lib/python3.10/site-packages/pypika/terms.py", line 743, in nodes_
    yield from self.left.nodes_()
  File "env/lib/python3.10/site-packages/pypika/terms.py", line 743, in nodes_
    yield from self.left.nodes_()
  [Previous line repeated 1 more time]
  File "env/lib/python3.10/site-packages/pypika/terms.py", line 795, in nodes_
    yield from self.container.nodes_()
AttributeError: 'str' object has no attribute 'nodes_'

Request Data

{
    "type": "POST",
    "args": {
        "docs": "{\"docstatus\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-bbrapcsust\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"rehan@preciholesports.com\",\"naming_series\":\"SINV-.YY.-\",\"e_waybill_status\":\"\",\"company\":\"Precihole Machine Tools Pvt. Ltd.\",\"posting_date\":\"2023-12-13\",\"set_posting_time\":0,\"is_pos\":0,\"is_consolidated\":0,\"is_return\":0,\"reason_for_issuing_document\":\"\",\"update_billed_amount_in_sales_order\":0,\"update_billed_amount_in_delivery_note\":1,\"is_debit_note\":0,\"is_reverse_charge\":0,\"is_export_with_gst\":0,\"currency\":\"INR\",\"selling_price_list\":\"Standard Selling\",\"price_list_currency\":\"INR\",\"ignore_pricing_rule\":0,\"update_stock\":0,\"use_company_roundoff_cost_center\":0,\"disable_rounded_total\":0,\"apply_discount_on\":\"Grand Total\",\"is_cash_or_non_trade_discount\":0,\"total_billing_amount\":0,\"allocate_advances_automatically\":1,\"only_include_allocated_payments\":0,\"write_off_outstanding_amount_automatically\":0,\"redeem_loyalty_points\":0,\"ignore_default_payment_terms_template\":0,\"party_account_currency\":\"INR\",\"is_opening\":\"No\",\"group_same_items\":0,\"invoice_copy\":\"Original for Recipient\",\"mode_of_transport\":\"Road\",\"lr_date\":\"2023-12-13\",\"gst_vehicle_type\":\"Regular\",\"status\":\"Draft\",\"einvoice_status\":\"\",\"is_internal_customer\":0,\"is_discounted\":0,\"repost_required\":0,\"items\":[{\"docstatus\":0,\"doctype\":\"Sales Invoice Item\",\"name\":\"new-sales-invoice-item-rcrmnkpcnb\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"rehan@preciholesports.com\",\"has_item_scanned\":0,\"stock_uom\":\"NOS\",\"margin_type\":\"\",\"is_free_item\":0,\"grant_commission\":0,\"delivered_by_supplier\":0,\"is_fixed_asset\":0,\"enable_deferred_revenue\":0,\"allow_zero_valuation_rate\":0,\"cost_center\":\"Main - PMTPL\",\"page_break\":0,\"parent\":\"new-sales-invoice-bbrapcsust\",\"parentfield\":\"items\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"qty\":0,\"conversion_factor\":0,\"stock_qty\":0,\"price_list_rate\":0,\"base_price_list_rate\":0,\"margin_rate_or_amount\":0,\"rate_with_margin\":0,\"discount_amount\":0,\"base_rate_with_margin\":0,\"rate\":0,\"amount\":0,\"base_rate\":0,\"base_amount\":0,\"stock_uom_rate\":0,\"net_rate\":0,\"net_amount\":0,\"base_net_rate\":0,\"base_net_amount\":0,\"taxable_value\":0,\"weight_per_unit\":0,\"total_weight\":0,\"incoming_rate\":0,\"actual_batch_qty\":0,\"actual_qty\":0,\"delivered_qty\":0}],\"conversion_rate\":1,\"plc_conversion_rate\":1,\"company_tax_id\":null,\"company_address\":\"Precihole Machine Tools Pvt. Ltd.-Billing\",\"debit_to\":\"Debtors - PMTPL\",\"company_gstin\":null,\"company_address_display\":\"524 Bhoomi Industrial Estate,<br>Pimpalghar Ranjnoli,Kalyan - Bhiwandi Rd<br>Bhiwandi<br>\\nMaharashtra, State Code: 27<br>Postal Code: 421311<br>India<br>\\nPhone: 9167240368<br>Email: sales@precihole.com<br>\",\"posting_time\":\"11:37:40\",\"base_net_total\":0,\"net_total\":0,\"base_total\":0,\"total\":0,\"total_qty\":0,\"rounding_adjustment\":0,\"grand_total\":0,\"base_grand_total\":0,\"total_taxes_and_charges\":0,\"base_total_taxes_and_charges\":0,\"base_rounding_adjustment\":0,\"rounded_total\":0,\"base_rounded_total\":0,\"in_words\":\"\",\"base_in_words\":\"\",\"base_discount_amount\":0,\"total_advance\":0,\"write_off_amount\":0,\"paid_amount\":0,\"base_paid_amount\":0,\"payments\":[],\"change_amount\":0,\"base_change_amount\":0,\"outstanding_amount\":0,\"amount_eligible_for_commission\":0,\"total_commission\":null}",
        "method": "set_advances"
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/run_doc_method",
    "request_id": null
}

Response Data

{
    "exception": "AttributeError: 'str' object has no attribute 'nodes_'",
    "exc_type": "AttributeError",
    "_exc_source": "erpnext (app)"
}
precihole commented 10 months ago

@rohitwaghchaure @s-aga-r this issue is also coming in v15.

ruthra-kumar commented 9 months ago

Issue is not replicable. @precihole Could you retry on the latest v15? Closing this. You can reopen, if issue persists.