22 lines
680 B
Plaintext
22 lines
680 B
Plaintext
|
|
user_id = await get_user()
|
|
dbname = get_module_dbname('supplychain')
|
|
|
|
data = params_kw.get("data", "{}")
|
|
if isinstance(data, str):
|
|
data = json.loads(data)
|
|
|
|
record_id = data.get("id")
|
|
if not record_id:
|
|
return {"widgettype":"Error","options":{"title":"Update Error","message":"Missing record id","cwidth":16,"cheight":9,"timeout":3}}
|
|
|
|
data["updated_at"] = timestampstr()
|
|
|
|
for key in ["id", "resellerid", "created_by", "created_at"]:
|
|
data.pop(key, None)
|
|
|
|
db = DBPools()
|
|
async with db.sqlorContext(dbname) as sor:
|
|
await sor.U("supplychain_accounting", data)
|
|
return {"widgettype":"Message","options":{"title":"Update Success","message":"ok","cwidth":16,"cheight":9,"timeout":3}}
|