Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: not all arguments converted during string formatting #36870

Closed
multidoc opened this issue Aug 29, 2023 · 4 comments · Fixed by #39252
Closed

TypeError: not all arguments converted during string formatting #36870

multidoc opened this issue Aug 29, 2023 · 4 comments · Fixed by #39252
Assignees
Labels

Comments

@multidoc
Copy link

Information about bug

Each item that erpnext tries to fetch from database while creating a sale order or sale invoice.
image

Module

selling, other

Version

ERPNext: v14.31.3 (version-14)

Frappe Framework: v14.45.0 (version-14)

Frappe HR: v14.8.0 (version-14)

Payments: v0.0.1 (develop)

POS Awesome: v6.1.2 (develop)

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

see screenshot
@multidoc multidoc added the bug label Aug 29, 2023
@s-aga-r
Copy link
Contributor

s-aga-r commented Sep 12, 2023

@multidoc Please provide us with the traceback.

@multidoc
Copy link
Author

multidoc commented Sep 12, 2023 via email

@s-aga-r
Copy link
Contributor

s-aga-r commented Sep 12, 2023

@multidoc Image > Copy error to clipboard

@multidoc
Copy link
Author

App Versions

{
	"erpnext": "14.31.3",
	"frappe": "14.47.1",
	"hrms": "14.8.0",
	"payments": "0.0.1",
	"posawesome": "6.1.2"
}

Route

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

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 94, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, 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 1622, in call
    return fn(*args, **newargs)
  File "apps/erpnext/erpnext/stock/get_item_details.py", line 127, in get_item_details
    data = get_pricing_rule_for_item(args, doc=doc, for_validate=for_validate)
  File "apps/erpnext/erpnext/accounts/doctype/pricing_rule/pricing_rule.py", line 340, in get_pricing_rule_for_item
    else get_pricing_rules(args, doc)
  File "apps/erpnext/erpnext/accounts/doctype/pricing_rule/utils.py", line 53, in get_pricing_rules
    pricing_rule = filter_pricing_rules(args, pricing_rules, doc)
  File "apps/erpnext/erpnext/accounts/doctype/pricing_rule/utils.py", line 286, in filter_pricing_rules
    data = get_qty_amount_data_for_cumulative(pr_doc, args, items)
  File "apps/erpnext/erpnext/accounts/doctype/pricing_rule/utils.py", line 530, in get_qty_amount_data_for_cumulative
    data_set = frappe.db.sql(
  File "apps/frappe/frappe/database/database.py", line 220, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 156, in execute
    query = self.mogrify(query, args)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 134, in mogrify
    query = query % self._escape_args(args, conn)
TypeError: not all arguments converted during string formatting

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"docstatus\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"william.price@multi-doc.ca\",\"naming_series\":\"ACC-SINV-.YYYY.-\",\"company\":\"Multi-Doc\",\"posting_date\":\"2023-09-12\",\"set_posting_time\":0,\"is_pos\":0,\"is_consolidated\":0,\"is_return\":0,\"update_billed_amount_in_sales_order\":0,\"is_debit_note\":0,\"currency\":\"CAD\",\"selling_price_list\":\"Standard Selling\",\"price_list_currency\":\"CAD\",\"ignore_pricing_rule\":0,\"update_stock\":0,\"use_company_roundoff_cost_center\":0,\"disable_rounded_total\":1,\"apply_discount_on\":\"Grand Total\",\"is_cash_or_non_trade_discount\":0,\"total_billing_amount\":0,\"allocate_advances_automatically\":0,\"write_off_outstanding_amount_automatically\":0,\"redeem_loyalty_points\":0,\"territory\":\"Canada\",\"ignore_default_payment_terms_template\":0,\"party_account_currency\":\"CAD\",\"is_opening\":\"No\",\"letter_head\":\"blank\",\"group_same_items\":0,\"status\":\"Draft\",\"customer_group\":\"Individual\",\"is_internal_customer\":0,\"is_discounted\":0,\"repost_required\":0,\"items\":[{\"docstatus\":0,\"doctype\":\"Sales Invoice Item\",\"name\":\"new-sales-invoice-item-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"william.price@multi-doc.ca\",\"has_item_scanned\":0,\"item_group\":\"All Item Groups\",\"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 - M-Doc\",\"page_break\":0,\"parent\":\"new-sales-invoice-1\",\"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,\"weight_per_unit\":0,\"total_weight\":0,\"incoming_rate\":0,\"actual_batch_qty\":0,\"actual_qty\":0,\"delivered_qty\":0,\"item_code\":\"Tab-20lb-1S-BW-No\",\"weight_uom\":\"\",\"barcode\":null,\"pricing_rules\":\"\"}],\"posting_time\":\"14:04:33\",\"conversion_rate\":1,\"plc_conversion_rate\":1,\"company_tax_id\":\"728551128RT0001\",\"company_address\":\"Multi-Doc-Billing\",\"debit_to\":\"Comptes clients - M-Doc\",\"company_address_display\":\"2399, Ave Jeanne-D'arc<br>Montréal<br>\\nQuébec<br>H1W3V8<br>Canada<br>\\nPhone: 514-373-8289<br>Email: info@multi-doc.ca<br>\",\"taxes_and_charges\":\"GST+QST - M-Doc\",\"taxes\":[{\"docstatus\":0,\"doctype\":\"Sales Taxes and Charges\",\"name\":\"new-sales-taxes-and-charges-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"william.price@multi-doc.ca\",\"charge_type\":\"On Net Total\",\"included_in_print_rate\":0,\"included_in_paid_amount\":0,\"cost_center\":\"Main - M-Doc\",\"account_currency\":\"CAD\",\"dont_recompute_tax\":0,\"parent\":\"new-sales-invoice-1\",\"parentfield\":\"taxes\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"row_id\":null,\"account_head\":\"GST -5% - M-Doc\",\"description\":\"GST -5%\",\"rate\":5,\"tax_amount\":0,\"total\":0,\"tax_amount_after_discount_amount\":0,\"base_tax_amount\":0,\"base_total\":0,\"base_tax_amount_after_discount_amount\":0,\"item_wise_tax_detail\":\"{\\\"undefined\\\":[5,0]}\"},{\"docstatus\":0,\"doctype\":\"Sales Taxes and Charges\",\"name\":\"new-sales-taxes-and-charges-2\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"william.price@multi-doc.ca\",\"charge_type\":\"On Net Total\",\"included_in_print_rate\":0,\"included_in_paid_amount\":0,\"cost_center\":\"Main - M-Doc\",\"account_currency\":\"CAD\",\"dont_recompute_tax\":0,\"parent\":\"new-sales-invoice-1\",\"parentfield\":\"taxes\",\"parenttype\":\"Sales Invoice\",\"idx\":2,\"row_id\":null,\"account_head\":\"QST - 9.975% - M-Doc\",\"description\":\"QST - 9.975%\",\"rate\":9.98,\"tax_amount\":0,\"total\":0,\"tax_amount_after_discount_amount\":0,\"base_tax_amount\":0,\"base_total\":0,\"base_tax_amount_after_discount_amount\":0,\"item_wise_tax_detail\":\"{\\\"undefined\\\":[9.98,0]}\"}],\"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\":0,\"tax_id\":null,\"customer_name\":\"Cash Sales\",\"loyalty_program\":\"Points\",\"represents_company\":null,\"customer\":\"Cash Sales\",\"due_date\":\"2023-09-12\",\"customer_address\":\"2399 Ave Jeanne-D'arc-Current\",\"address_display\":\"2399 Ave Jeanne-D'arc<br>Montréal<br>\\nQC<br>H1W 3V8<br>Canada<br>\\nPhone: 514.373.8289<br>Email: info@multi-doc.ca<br>\",\"shipping_address_name\":\"2399 Ave Jeanne-D'arc-Current\",\"posa_delivery_charges\":null,\"shipping_address\":\"2399 Ave Jeanne-D'arc<br>Montréal<br>\\nQC<br>H1W 3V8<br>Canada<br>\\nPhone: 514.373.8289<br>Email: info@multi-doc.ca<br>\",\"tax_category\":\"Sales Taxes\",\"contact_person\":null,\"contact_display\":null,\"contact_email\":null,\"contact_mobile\":null,\"language\":\"en\",\"sales_partner\":\"William\",\"commission_rate\":10,\"payment_terms_template\":\"On Receipt\",\"payment_schedule\":[{\"docstatus\":0,\"doctype\":\"Payment Schedule\",\"name\":\"new-payment-schedule-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"william.price@multi-doc.ca\",\"discount_type\":\"Percentage\",\"discounted_amount\":0,\"parent\":\"new-sales-invoice-1\",\"parentfield\":\"payment_schedule\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"payment_term\":\"On Receipt\",\"description\":null,\"invoice_portion\":100,\"payment_amount\":0,\"base_payment_amount\":0,\"discount\":0,\"outstanding\":0,\"mode_of_payment\":null,\"due_date\":\"2023-09-12\",\"discount_date\":\"2023-09-12\"}],\"sales_team\":[{\"docstatus\":0,\"doctype\":\"Sales Team\",\"name\":\"new-sales-team-1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"william.price@multi-doc.ca\",\"parent\":\"new-sales-invoice-1\",\"parentfield\":\"sales_team\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"sales_person\":\"William\",\"allocated_percentage\":100,\"commission_rate\":\"10\"}]}",
		"args": "{\"item_code\":\"Tab-20lb-1S-BW-No\",\"barcode\":null,\"customer\":\"Cash Sales\",\"currency\":\"CAD\",\"update_stock\":0,\"conversion_rate\":1,\"price_list\":\"Standard Selling\",\"price_list_currency\":\"CAD\",\"plc_conversion_rate\":1,\"company\":\"Multi-Doc\",\"is_pos\":0,\"is_return\":0,\"ignore_pricing_rule\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-1\",\"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 - M-Doc\",\"tax_category\":\"Sales Taxes\",\"child_docname\":\"new-sales-invoice-item-1\"}"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/erpnext.stock.get_item_details.get_item_details"
}

Response Data

{
	"exception": "TypeError: not all arguments converted during string formatting"
}

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants