Excellent!
So the method I need is this one from naming_series.py
def update_series_start(self):
if self.prefix:
prefix = self.parse_naming_series()
self.insert_series(prefix)
frappe.db.sql("update `tabSeries` set current = %s where name = %s",
(self.current_value, prefix))
msgprint(_("Series Updated Successfully"))
else:
msgprint(_("Please select prefix first"))
.
It shows that the request package must include two required fields from the naming_series.json page descriptor: prefix and current_value.
So I can check the naming series current values with SQL:
MariaDB [_a25a7b22fce4a558]> select * from tabSeries;
+---------------------+---------+
| name | current |
+---------------------+---------+
| ACC-PAY-2020- | 1 |
| HOOK- | 1 |
| MAT-UOM-CNV- | 2 |
| PATCHLOG | 919 |
| PUR-ORD-2020- | 4 |
+---------------------+---------+
10 rows in set (0.001 sec)
MariaDB [_a25a7b22fce4a558]>
Running the curl
command to update the current value of the “Payment Entry” naming series formatting template …
cat << SSEOF > /dev/shm/SeriesStartUpdate.json;
{
"method": "update_series_start",
"docs": "{\"doctype\":\"Naming Series\",\"prefix\":\"ACC-PAY-.YYYY.-\",\"current_value\":999,\"modified\":\"2020-05-20 21:26:31.389303\"}"
}
SSEOF
curl -sX POST "${RPC_ENDPOINT}/runserverobj" \
--header "Authorization: token ${YOUR_TOKEN}" \
--header 'Content-Type: application/json' \
-d @/dev/shm/SeriesStartUpdate.json | jq -r .;
… returns:
{
"docs": [
{
"name": "Naming Series",
"modified": "2020-05-20 21:26:31.389303",
"idx": 0,
"docstatus": 0,
"select_doc_for_series": "Payment Entry",
"user_must_always_select": 0,
"prefix": "ACC-PAY-.YYYY.-",
"current_value": 999,
"doctype": "Naming Series"
}
],
"_server_messages": "[\"{\\\"message\\\": \\\"Series Updated Successfully\\\"}\"]"
}
Rechecking in MariaDb:
MariaDB [_a25a7b22fce4a558]> select * from tabSeries;
+---------------------+---------+
| name | current |
+---------------------+---------+
| ACC-PAY-2020- | 999 |
| HOOK- | 1 |
| MAT-UOM-CNV- | 2 |
| PATCHLOG | 919 |
| PUR-ORD-2020- | 4 |
+---------------------+---------+
10 rows in set (0.001 sec)
MariaDB [_a25a7b22fce4a558]>
@revant_one Always grateful for your deeply knowledgeable assistance!
(not sure why, but it is not offering me the “solution” button on your answer. Sorry.)