[trunk] controllers form, bad contidion on save
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Web Client |
In Progress
|
Low
|
OpenERP R&D Web Team |
Bug Description
If you have a button, link with a action type url, when you press on button in NOT edit mode, original code launch a write,
Comment in code say "bypass save, for button action in non-editable view" but the condition is bad, and 2 else do same thing.
addons/
Original code
# bypass save, for button action in non-editable view
if not (params.button and params.editable and params.id):
proxy = rpc.RPCProxy(
if not params.id:
ctx = dict((params.
id = proxy.create(data, ctx)
else:
ctx = utils.context_
id = proxy.write(
elif params.button and params.editable and params.id:
proxy = rpc.RPCProxy(
ctx = utils.context_
id = proxy.write(
Fix: The fix do create if button, editable and no id in param, else do a write if button, editable and id in param
if params.button and params.editable and not params.id:
proxy = rpc.RPCProxy(
ctx = dict((params.
id = proxy.create(data, ctx)
elif params.button and params.editable and params.id:
proxy = rpc.RPCProxy(
ctx = utils.context_
id = proxy.write(
Related branches
description: | updated |
Changed in openobject-client-web: | |
assignee: | nobody → OpenERP SA's Web Client R&D (openerp-dev-web) |
importance: | Undecided → Low |
status: | New → Confirmed |
Changed in openobject-client-web: | |
status: | Fix Released → New |
Changed in openobject-client-web: | |
status: | New → In Progress |
Previous patch have a bug and not simplified this one better and work fine
Do write and create only if we are in edit mode
Do create is no id submit else do a write
New patch
if params.editable:
proxy = rpc.RPCProxy( params. model) context or {}), **rpc.session. context)
params. ids = (params.ids or []) + [int(id)]
params. id = int(id)
params. count += 1
proxy = rpc.RPCProxy( params. model) with_concurrenc y_info( params. context, params. concurrency_ info) [params. id], data, ctx)
if not params.id:
ctx = dict((params.
id = proxy.create(data, ctx)
else:
ctx = utils.context_
id = proxy.write(