Commit 1059bc2a by 赵言乐

合并分支 'zyl_jzjx_project' 到 'jzjx_project'

增加修改逻辑

查看合并请求 !9
parents 60a51a54 d6cb1882
...@@ -39,8 +39,15 @@ class ProductIncomeExpenseIframe(http.Controller): ...@@ -39,8 +39,15 @@ class ProductIncomeExpenseIframe(http.Controller):
"expenditure": v.get("expenditure", False), "expenditure": v.get("expenditure", False),
"customer": v.get("customer", False) "customer": v.get("customer", False)
} }
_self.env(user=v.get("user_id"))["roke.product.income.expense"].create(data) # 看是否有id,如果有的话就说明是更新,没有的话就说明是创建
return {"code": 0, "message": "创建成功!"} if v.get("id", False):
expense_obj = _self.env["roke.product.income.expense"].sudo().search([("id", "=", v.get("id"))])
if not expense_obj:
return {"code": 1, "message": "更新失败,没找到对应数据。"}
expense_obj.write(data)
else:
_self.env(user=v.get("user_id"))["roke.product.income.expense"].create(data)
return {"code": 0, "message": "操作成功!"}
@http.route("/roke/product/product_income_expense/get", type="json", auth='none', cors='*', csrf=False) @http.route("/roke/product/product_income_expense/get", type="json", auth='none', cors='*', csrf=False)
def product_income_expense_get_list(self): def product_income_expense_get_list(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment