zaviagodev / frappe

MIT License
0 stars 1 forks source link

TypeError: cannot unpack non-iterable NoneType object #135

Closed chomchuen closed 11 months ago

chomchuen commented 11 months ago

Found this when selecting an item in item table.

Image


App Versions

{
    "apps_maintainer": "0.0.1",
    "business_automations": "0.0.1",
    "erpnext": "15.6.0",
    "frappe": "15.5.0",
    "test_app": "0.0.1"
}

Route

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

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/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/erpnext/erpnext/stock/get_item_details.py", line 117, in get_item_details
    bin_details = get_bin_details(args.item_code, out.warehouse, include_child_warehouses=True)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/erpnext/erpnext/stock/get_item_details.py", line 1148, in get_bin_details
    warehouses = get_child_warehouses(warehouse) if include_child_warehouses else [warehouse]
  File "apps/erpnext/erpnext/stock/doctype/warehouse/warehouse.py", line 221, in get_child_warehouses
    children = get_descendants_of("Warehouse", warehouse, ignore_permissions=True, order_by="lft")
  File "apps/frappe/frappe/utils/nestedset.py", line 397, in get_descendants_of
    lft, rgt = frappe.db.get_value(doctype, name, ["lft", "rgt"])
TypeError: cannot unpack non-iterable NoneType object

Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"docstatus\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-ievtxlqahb\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"custom_payment_type\":\"Recieve\",\"custom_channel23232\":\"Unpaid\",\"custom_channel\":\"TikTok Shop\",\"posting_date\":\"2023-12-18\",\"naming_series\":\"ACC-SINV-.YYYY.-\",\"company\":\"Zaviago\",\"set_posting_time\":0,\"is_pos\":0,\"is_consolidated\":0,\"is_return\":0,\"update_billed_amount_in_sales_order\":0,\"update_billed_amount_in_delivery_note\":1,\"is_debit_note\":0,\"currency\":\"THB\",\"selling_price_list\":\"Standard Selling\",\"price_list_currency\":\"THB\",\"ignore_pricing_rule\":0,\"update_stock\":1,\"set_warehouse\":\"Stores - WS\",\"apply_discount_on\":\"Grand Total\",\"is_cash_or_non_trade_discount\":0,\"use_company_roundoff_cost_center\":0,\"disable_rounded_total\":0,\"total_billing_amount\":0,\"allocate_advances_automatically\":0,\"only_include_allocated_payments\":0,\"write_off_outstanding_amount_automatically\":0,\"redeem_loyalty_points\":0,\"custom_shipping_provider\":\"J&T Express\",\"custom_provider_status\":\"Awaiting Collection\",\"ignore_default_payment_terms_template\":0,\"party_account_currency\":\"THB\",\"is_opening\":\"No\",\"group_same_items\":0,\"status\":\"Draft\",\"is_internal_customer\":0,\"is_discounted\":0,\"repost_required\":0,\"items\":[{\"docstatus\":0,\"doctype\":\"Sales Invoice Item\",\"name\":\"new-sales-invoice-item-tfzswcyyeo\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"has_item_scanned\":0,\"stock_uom\":\"Nos\",\"margin_type\":\"\",\"is_free_item\":0,\"grant_commission\":1,\"delivered_by_supplier\":0,\"is_fixed_asset\":0,\"enable_deferred_revenue\":0,\"allow_zero_valuation_rate\":0,\"cost_center\":\"Main - Z\",\"page_break\":0,\"parent\":\"new-sales-invoice-ievtxlqahb\",\"parentfield\":\"items\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"warehouse\":\"Stores - WS\",\"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,\"weight_per_unit\":0,\"total_weight\":0,\"incoming_rate\":0,\"actual_batch_qty\":0,\"actual_qty\":0,\"delivered_qty\":0,\"item_code\":\"apple15\",\"weight_uom\":\"\",\"barcode\":null,\"pricing_rules\":\"\"}],\"posting_time\":\"09:17:44\",\"conversion_rate\":1,\"plc_conversion_rate\":1,\"company_tax_id\":null,\"company_address\":null,\"company_address_display\":null,\"debit_to\":\"Debtors - Z\",\"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,\"tax_id\":null,\"customer_name\":\"Muzammal rasool\",\"loyalty_program\":\"Zaviago Club\",\"represents_company\":null,\"customer\":\"Muzammal rasool\",\"due_date\":\"2023-12-18\",\"customer_address\":\"Muzammal rasool-Billing\",\"address_display\":\"Street 3<br>\\nChak Jhumra<br>Faisalabad<br>\\nPunjab<br>0007<br>Pakistan<br>\\n<br>\\n\",\"shipping_address_name\":\"Muzammal rasool-Billing\",\"shipping_address\":\"Street 3<br>\\nChak Jhumra<br>Faisalabad<br>\\nPunjab<br>0007<br>Pakistan<br>\\n<br>\\n\",\"tax_category\":\"\",\"contact_person\":\"Muzammal rasool-Muzammal rasool\",\"contact_display\":\"Muzammal rasool\",\"contact_email\":\"muzammal@zaviago.com\",\"contact_mobile\":\"03015935652\",\"customer_group\":\"Government\",\"territory\":\"All Territories\",\"language\":\"en\",\"payment_terms_template\":null,\"sales_team\":[]}",
        "args": "{\"item_code\":\"apple15\",\"barcode\":null,\"set_warehouse\":\"Stores - WS\",\"warehouse\":\"Stores - WS\",\"customer\":\"Muzammal rasool\",\"currency\":\"THB\",\"update_stock\":1,\"conversion_rate\":1,\"price_list\":\"Standard Selling\",\"price_list_currency\":\"THB\",\"plc_conversion_rate\":1,\"company\":\"Zaviago\",\"is_pos\":0,\"is_return\":0,\"ignore_pricing_rule\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-ievtxlqahb\",\"qty\":1,\"net_rate\":0,\"stock_qty\":0,\"conversion_factor\":0,\"weight_per_unit\":0,\"weight_uom\":\"\",\"stock_uom\":\"Nos\",\"pos_profile\":\"\",\"cost_center\":\"Main - Z\",\"tax_category\":\"\",\"child_docname\":\"new-sales-invoice-item-tfzswcyyeo\"}"
    },
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/erpnext.stock.get_item_details.get_item_details",
    "request_id": null
}

Response Data

{
    "exception": "TypeError: cannot unpack non-iterable NoneType object",
    "exc_type": "TypeError",
    "_exc_source": "erpnext (app)"
}
chomchuen commented 11 months ago

Can't find unpack non-iterable Nontype but found this instead when submit sales invoice.

Image

--

App Versions

{
    "apps_maintainer": "0.0.1",
    "business_automations": "0.0.1",
    "erpnext": "15.6.0",
    "frappe": "15.5.0",
    "test_app": "0.0.1"
}

Route

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

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/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/desk/form/save.py", line 18, in savedocs
    doc = frappe.get_doc(json.loads(doc))
  File "apps/frappe/frappe/__init__.py", line 1298, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 82, in get_doc
    return controller(*args, **kwargs)
  File "apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 232, in __init__
    super(SalesInvoice, self).__init__(*args, **kwargs)
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 93, in __init__
    super(AccountsController, self).__init__(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 132, in __init__
    super().__init__(kwargs)
  File "apps/frappe/frappe/model/base_document.py", line 133, in __init__
    self.update(d)
  File "apps/frappe/frappe/model/base_document.py", line 182, in update
    self.set(key, value, as_value=ignore_children)
  File "apps/frappe/frappe/model/base_document.py", line 234, in set
    self.extend(key, value)
  File "apps/frappe/frappe/model/base_document.py", line 275, in extend
    self.append(key, v)
  File "apps/frappe/frappe/model/base_document.py", line 260, in append
    ret_value = self._init_child(value, key)
  File "apps/frappe/frappe/model/base_document.py", line 288, in _init_child
    value["doctype"] = doctype
TypeError: 'str' object does not support item assignment

Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"docstatus\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-coxlekgyof\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"custom_payment_type\":\"Recieve\",\"custom_channel23232\":\"-\",\"custom_channel\":\"TikTok Shop\",\"posting_date\":\"2023-12-19\",\"naming_series\":\"ACC-SINV-.YYYY.-\",\"company\":\"Zaviago\",\"set_posting_time\":0,\"is_pos\":0,\"is_consolidated\":0,\"is_return\":0,\"update_billed_amount_in_sales_order\":0,\"update_billed_amount_in_delivery_note\":1,\"is_debit_note\":0,\"currency\":\"THB\",\"selling_price_list\":\"Standard Selling\",\"price_list_currency\":\"THB\",\"ignore_pricing_rule\":0,\"update_stock\":1,\"set_warehouse\":\"Stores - Z\",\"apply_discount_on\":\"Grand Total\",\"is_cash_or_non_trade_discount\":0,\"use_company_roundoff_cost_center\":0,\"disable_rounded_total\":0,\"total_billing_amount\":0,\"allocate_advances_automatically\":0,\"only_include_allocated_payments\":0,\"write_off_outstanding_amount_automatically\":0,\"redeem_loyalty_points\":0,\"custom_shipping_provider\":\"J&T Express\",\"custom_provider_status\":\"-\",\"ignore_default_payment_terms_template\":0,\"party_account_currency\":\"THB\",\"is_opening\":\"No\",\"group_same_items\":0,\"status\":\"Draft\",\"is_internal_customer\":0,\"is_discounted\":0,\"repost_required\":0,\"items\":[{\"docstatus\":0,\"doctype\":\"Sales Invoice Item\",\"name\":\"new-sales-invoice-item-ctkrxqyawf\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"has_item_scanned\":0,\"stock_uom\":\"Unit\",\"margin_type\":\"\",\"is_free_item\":0,\"grant_commission\":1,\"delivered_by_supplier\":0,\"is_fixed_asset\":0,\"enable_deferred_revenue\":0,\"allow_zero_valuation_rate\":0,\"cost_center\":\"Main - Z\",\"page_break\":0,\"parent\":\"new-sales-invoice-coxlekgyof\",\"parentfield\":\"items\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"warehouse\":\"Stores - Z\",\"qty\":1,\"conversion_factor\":1,\"stock_qty\":1,\"price_list_rate\":48000,\"base_price_list_rate\":48000,\"margin_rate_or_amount\":0,\"rate_with_margin\":0,\"discount_amount\":0,\"base_rate_with_margin\":0,\"rate\":48000,\"amount\":48000,\"base_rate\":48000,\"base_amount\":48000,\"stock_uom_rate\":48000,\"net_rate\":48000,\"net_amount\":48000,\"base_net_rate\":48000,\"base_net_amount\":48000,\"weight_per_unit\":0,\"total_weight\":0,\"incoming_rate\":0,\"actual_batch_qty\":0,\"actual_qty\":97,\"delivered_qty\":0,\"item_code\":\"apple15\",\"weight_uom\":null,\"barcode\":null,\"pricing_rules\":\"[\\n \\\"PRLE-0001\\\"\\n]\",\"item_name\":\"iPhone 15 Pro Max\",\"description\":\"iPhone 15 Pro Max\",\"image\":\"/files/iphone15_pro_max.png\",\"income_account\":\"Sales - Z\",\"expense_account\":\"Cost of Goods Sold - Z\",\"discount_account\":null,\"provisional_expense_account\":null,\"has_serial_no\":0,\"has_batch_no\":0,\"batch_no\":null,\"uom\":\"Unit\",\"min_order_qty\":\"\",\"discount_percentage\":0,\"supplier\":null,\"update_stock\":1,\"last_purchase_rate\":0,\"transaction_date\":\"2023-12-19\",\"against_blanket_order\":null,\"bom_no\":null,\"item_group\":\"All Item Groups\",\"brand\":null,\"manufacturer\":null,\"manufacturer_part_no\":null,\"item_tax_rate\":\"{}\",\"customer_item_code\":null,\"valuation_rate\":35000,\"projected_qty\":97,\"reserved_qty\":0,\"has_margin\":true,\"free_item_data\":[],\"child_docname\":\"new-sales-invoice-item-ctkrxqyawf\",\"validate_applied_rule\":0,\"price_or_product_discount\":\"Price\",\"pricing_rule_for\":\"Discount Percentage\",\"has_pricing_rule\":1,\"gross_profit\":-35000}],\"conversion_rate\":1,\"plc_conversion_rate\":1,\"company_tax_id\":null,\"company_address\":null,\"company_address_display\":null,\"debit_to\":\"Debtors - Z\",\"posting_time\":\"17:48:00\",\"base_net_total\":48000,\"net_total\":48000,\"base_total\":48000,\"total\":48000,\"total_qty\":1,\"rounding_adjustment\":0,\"grand_total\":48000,\"base_grand_total\":48000,\"total_taxes_and_charges\":0,\"base_total_taxes_and_charges\":0,\"base_rounding_adjustment\":0,\"rounded_total\":48000,\"base_rounded_total\":48000,\"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\":48000,\"amount_eligible_for_commission\":48000,\"total_commission\":null,\"tax_id\":null,\"customer_name\":\"Muzammal rasool\",\"loyalty_program\":\"Zaviago Club\",\"represents_company\":null,\"customer\":\"Muzammal rasool\",\"custom_past_orders_1\":[],\"custom_custom_average_order_value_2\":48000,\"custom_total_orders\":1,\"custom_total_items_bought\":1,\"custom_lifetime_value_1\":48000,\"custom_customer_info_customer\":\"Muzammal rasool\",\"custom_customer_2\":\"Muzammal rasool\",\"custom_shipping_address_name_2\":\"\",\"custom_shipping_address_2\":\"\",\"custom_tax_id_2\":null,\"custom_customer_group1\":\"Government\",\"custom_phone_number\":\"03015935652\",\"due_date\":\"2023-12-19\",\"customer_address\":\"Muzammal rasool-Billing\",\"address_display\":\"Street 3<br>\\nChak Jhumra<br>Faisalabad<br>\\nPunjab<br>0007<br>Pakistan<br>\\n<br>\\n\",\"shipping_address_name\":\"Muzammal rasool-Billing\",\"shipping_address\":\"Street 3<br>\\nChak Jhumra<br>Faisalabad<br>\\nPunjab<br>0007<br>Pakistan<br>\\n<br>\\n\",\"tax_category\":\"\",\"contact_person\":\"Muzammal rasool-Muzammal rasool\",\"contact_display\":\"Muzammal rasool\",\"contact_email\":\"muzammal@zaviago.com\",\"contact_mobile\":\"03015935652\",\"customer_group\":\"Government\",\"territory\":\"All Territories\",\"language\":\"en\",\"payment_terms_template\":null,\"sales_team\":[],\"cost_center\":\"Main - Z\",\"discount_amount\":0,\"additional_discount_percentage\":0,\"pricing_rules\":\"[\\n \\\"PRLE-0001\\\"\\n]\",\"total_net_weight\":0}",
        "action": "Save"
    },
    "btn": {
        "jQuery3700061988782005071961": {
            "events": {
                "click": [
                    {
                        "type": "click",
                        "origType": "click",
                        "guid": 15492,
                        "namespace": ""
                    }
                ]
            }
        }
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs",
    "request_id": null
}

Response Data

{
    "exception": "TypeError: 'str' object does not support item assignment",
    "exc_type": "TypeError",
    "_exc_source": "erpnext (app)"
}
umer2001 commented 11 months ago

fixed in commit: https://github.com/zaviagodev/zaviagocore/commit/af38a4834323a523ea45022a86e5d8751dd53ffe