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 1684, 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 39, in savedocs
doc.save()
File "apps/frappe/frappe/model/document.py", line 334, in save
return self._save(*args, **kwargs)
File "apps/frappe/frappe/model/document.py", line 356, in _save
return self.insert()
File "apps/frappe/frappe/model/document.py", line 286, in insert
self.run_before_save_methods()
File "apps/frappe/frappe/model/document.py", line 1085, in run_before_save_methods
self.run_method("validate")
File "apps/frappe/frappe/model/document.py", line 954, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "apps/frappe/frappe/model/document.py", line 1320, in composer
return composed(self, method, *args, **kwargs)
File "apps/frappe/frappe/model/document.py", line 1302, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "apps/frappe/frappe/model/document.py", line 951, in fn
return method_object(*args, **kwargs)
File "apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 269, in validate
super(SalesInvoice, self).validate()
File "apps/erpnext/erpnext/controllers/selling_controller.py", line 29, in validate
super(SellingController, self).validate()
File "apps/erpnext/erpnext/controllers/stock_controller.py", line 48, in validate
super(StockController, self).validate()
File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 185, in validate
self.set_incoming_rate()
File "apps/erpnext/erpnext/controllers/selling_controller.py", line 448, in set_incoming_rate
d.incoming_rate = get_incoming_rate(
File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
File "apps/erpnext/erpnext/stock/utils.py", line 304, in get_incoming_rate
previous_sle = get_previous_sle(args)
File "apps/erpnext/erpnext/stock/stock_ledger.py", line 1455, in get_previous_sle
sle = get_stock_ledger_entries(
File "apps/erpnext/erpnext/stock/stock_ledger.py", line 1510, in get_stock_ledger_entries
return frappe.db.sql(
File "apps/frappe/frappe/database/database.py", line 235, in sql
self._cursor.execute(query, values)
File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 153, in execute
result = self._query(query)
File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 558, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 822, in _read_query_result
result.read()
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1200, in read
first_packet = self.connection._read_packet()
File "env/lib/python3.10/site-packages/pymysql/connections.py", line 772, in _read_packet
packet.raise_for_error()
File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'posting_datetime' in 'field list'")
Request Data
{
"type": "POST",
"args": {
"doc": "{\"docstatus\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-igotnwppdv\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"chomchuen@zaviago.com\",\"custom_payment_type\":\"Recieve\",\"custom_channel23232\":\"-\",\"custom_channel\":\"\",\"posting_date\":\"2024-03-13\",\"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,\"items\":[{\"docstatus\":0,\"doctype\":\"Sales Invoice Item\",\"name\":\"new-sales-invoice-item-gnetbowkfu\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"chomchuen@zaviago.com\",\"has_item_scanned\":0,\"item_group\":\"Sub perfect dessert\",\"stock_uom\":\"Unit\",\"margin_type\":\"\",\"is_free_item\":0,\"grant_commission\":1,\"delivered_by_supplier\":0,\"is_fixed_asset\":0,\"enable_deferred_revenue\":0,\"use_serial_batch_fields\":0,\"allow_zero_valuation_rate\":0,\"cost_center\":\"Main - Z\",\"page_break\":0,\"parent\":\"new-sales-invoice-igotnwppdv\",\"parentfield\":\"items\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"qty\":1,\"conversion_factor\":1,\"stock_qty\":1,\"price_list_rate\":360,\"base_price_list_rate\":360,\"margin_rate_or_amount\":0,\"rate_with_margin\":0,\"discount_amount\":91.8,\"base_rate_with_margin\":0,\"rate\":268.2,\"amount\":268.2,\"base_rate\":268.2,\"base_amount\":268.2,\"stock_uom_rate\":268.2,\"net_rate\":249.51,\"net_amount\":249.51,\"base_net_rate\":249.51,\"base_net_amount\":249.51,\"weight_per_unit\":0.5,\"total_weight\":0.5,\"incoming_rate\":0,\"actual_batch_qty\":0,\"actual_qty\":10,\"delivered_qty\":0,\"item_code\":\"CK-00002\",\"weight_uom\":\"Box\",\"barcode\":null,\"pricing_rules\":\"[\\n \\\"PRLE-0036\\\"\\n]\",\"item_name\":\"มินิบราวนี่ 18 ชิ้น | Mini-brownie 18 ps.\",\"description\":\"<div><p>มินิบราวนี่ 18 ชิ้น| Mini-brownie 18 ps.</p><p><br></p><p>Bite-sized French dark chocolate brownies with Mediterranean Sea-salt</p><p><br></p><p>18pieces/box.</p><p><br></p><p>Opened package will last anywhere between 4-7 days in the fridge past the expiration date.</p></div>\",\"image\":\"/files/brownie-1.jpeg\",\"warehouse\":\"Stores - Z\",\"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\":25.5,\"update_stock\":1,\"last_purchase_rate\":0,\"transaction_date\":\"2024-03-13\",\"against_blanket_order\":null,\"bom_no\":null,\"brand\":\"Mister Melon\",\"manufacturer\":null,\"manufacturer_part_no\":null,\"item_tax_rate\":\"{}\",\"customer_item_code\":null,\"projected_qty\":9,\"reserved_qty\":1,\"has_margin\":true,\"free_item_data\":[],\"child_docname\":\"new-sales-invoice-item-gnetbowkfu\",\"validate_applied_rule\":0,\"price_or_product_discount\":\"Price\",\"pricing_rule_for\":\"Discount Percentage\",\"has_pricing_rule\":1}],\"taxes\":[{\"docstatus\":0,\"doctype\":\"Sales Taxes and Charges\",\"name\":\"new-sales-taxes-and-charges-osnsqrmtpo\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"chomchuen@zaviago.com\",\"charge_type\":\"On Net Total\",\"included_in_print_rate\":0,\"included_in_paid_amount\":0,\"cost_center\":\"Main - Z\",\"account_currency\":null,\"dont_recompute_tax\":0,\"parent\":\"new-sales-invoice-igotnwppdv\",\"parentfield\":\"taxes\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"row_id\":null,\"account_head\":\"VAT - Z\",\"description\":\"VAT\",\"rate\":7,\"tax_amount\":18.77,\"total\":266.98,\"tax_amount_after_discount_amount\":17.47,\"base_tax_amount\":18.77,\"base_total\":266.98,\"base_tax_amount_after_discount_amount\":17.47,\"item_wise_tax_detail\":\"{\\\"CK-00002\\\":[7,17.47]}\"}],\"apply_discount_on\":\"Grand Total\",\"is_cash_or_non_trade_discount\":0,\"use_company_roundoff_cost_center\":0,\"disable_rounded_total\":1,\"pricing_rules\":[],\"packed_items\":[],\"timesheets\":[],\"total_billing_amount\":0,\"custom_payment_details\":[],\"payments\":[],\"allocate_advances_automatically\":0,\"only_include_allocated_payments\":0,\"advances\":[],\"write_off_outstanding_amount_automatically\":0,\"redeem_loyalty_points\":0,\"custom_provider_status\":\"Awaiting Collection\",\"custom_add_tracking_number_table\":[],\"ignore_default_payment_terms_template\":0,\"payment_schedule\":[],\"party_account_currency\":\"THB\",\"is_opening\":\"No\",\"sales_team\":[],\"letter_head\":\"Zaviago Letterhead\",\"group_same_items\":0,\"status\":\"Draft\",\"is_internal_customer\":0,\"is_discounted\":0,\"repost_required\":0,\"custom_total_orders\":\"0\",\"custom_total_items_bought\":12,\"custom_past_orders1\":[{\"docstatus\":0,\"doctype\":\"Customer Past Orders\",\"name\":\"new-customer-past-orders-dswqrmsijd\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"chomchuen@zaviago.com\",\"parent\":\"new-sales-invoice-igotnwppdv\",\"parentfield\":\"custom_past_orders1\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"sales_order\":\"ACC-SINV-2024-00075\",\"quantity\":1,\"amount_thb\":1072.8},{\"docstatus\":0,\"doctype\":\"Customer Past Orders\",\"name\":\"new-customer-past-orders-gndtqnhuae\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"chomchuen@zaviago.com\",\"parent\":\"new-sales-invoice-igotnwppdv\",\"parentfield\":\"custom_past_orders1\",\"parenttype\":\"Sales Invoice\",\"idx\":2,\"sales_order\":\"ACC-SINV-2024-00002\",\"quantity\":1,\"amount_thb\":55},{\"docstatus\":0,\"doctype\":\"Customer Past Orders\",\"name\":\"new-customer-past-orders-wvovsiokrg\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"chomchuen@zaviago.com\",\"parent\":\"new-sales-invoice-igotnwppdv\",\"parentfield\":\"custom_past_orders1\",\"parenttype\":\"Sales Invoice\",\"idx\":3,\"sales_order\":\"ACC-SINV-2024-00003\",\"quantity\":1,\"amount_thb\":48.85},{\"docstatus\":0,\"doctype\":\"Customer Past Orders\",\"name\":\"new-customer-past-orders-jaqwpaeqcw\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"chomchuen@zaviago.com\",\"parent\":\"new-sales-invoice-igotnwppdv\",\"parentfield\":\"custom_past_orders1\",\"parenttype\":\"Sales Invoice\",\"idx\":4,\"sales_order\":\"ACC-SINV-2024-00004\",\"quantity\":1,\"amount_thb\":55},{\"docstatus\":0,\"doctype\":\"Customer Past Orders\",\"name\":\"new-customer-past-orders-excwvmvmgf\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"chomchuen@zaviago.com\",\"parent\":\"new-sales-invoice-igotnwppdv\",\"parentfield\":\"custom_past_orders1\",\"parenttype\":\"Sales Invoice\",\"idx\":5,\"sales_order\":\"ACC-SINV-2024-00011\",\"quantity\":1,\"amount_thb\":13800}],\"conversion_rate\":1,\"plc_conversion_rate\":1,\"total_billing_hours\":0,\"company_tax_id\":\"110801325096\",\"company_address\":\"Zaviago 2-Billing\",\"company_address_display\":\"Bang Trading Group 999/99 Rama 9 Rd.<br>\\nSuanluang<br>Suanluang<br>\\nBangkok<br>10250<br>Thailand<br>\\n<br>\\n\",\"taxes_and_charges\":\"ภาษีมูลค่าเพิ่ม 7% - Z\",\"base_net_total\":249.51,\"net_total\":249.51,\"base_total\":268.2,\"total\":268.2,\"total_qty\":1,\"rounding_adjustment\":-0.01,\"grand_total\":266.97,\"base_grand_total\":266.97,\"total_taxes_and_charges\":17.47,\"base_total_taxes_and_charges\":17.47,\"base_rounding_adjustment\":-0.01,\"rounded_total\":0,\"base_rounded_total\":0,\"in_words\":\"\",\"base_in_words\":\"\",\"base_discount_amount\":20,\"total_advance\":0,\"write_off_amount\":0,\"paid_amount\":0,\"base_paid_amount\":0,\"change_amount\":0,\"base_change_amount\":0,\"outstanding_amount\":266.97,\"amount_eligible_for_commission\":249.51,\"total_commission\":null,\"posting_time\":\"10:58:33\",\"tax_id\":\"998664534321\",\"customer_name\":\"Muzammal rasool\",\"loyalty_program\":\"Zaviago Club\",\"represents_company\":null,\"customer\":\"Muzammal rasool\",\"custom_custom_average_order_value_2\":37120.137500000004,\"custom_lifetime_value_1\":\"445,441.65\",\"custom_customer_info_customer\":\"Muzammal rasool\",\"custom_customer_2\":\"Muzammal rasool\",\"custom_customer_group1\":\"Government\",\"custom_phone_number\":\"03015935652\",\"debit_to\":\"Debtors - Z\",\"due_date\":\"2024-03-13\",\"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,\"total_net_weight\":0.5,\"discount_amount\":20,\"additional_discount_percentage\":0}",
"action": "Save"
},
"btn": {
"jQuery370053927980949454631": {
"events": {
"click": [
{
"type": "click",
"origType": "click",
"guid": 7907,
"namespace": ""
}
]
}
}
},
"freeze": true,
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.desk.form.save.savedocs",
"request_id": null
}
Step to reproduce the issue
App Versions
Route
Traceback
Request Data
Response Data