c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #01665
[Bug 668465] [NEW] [trunk] controllers form, bad contidion on save
Public bug reported:
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/openerp/controllers/form.py Class Form, Function save
Original code
# bypass save, for button action in non-editable view
if not (params.button and params.editable and params.id):
proxy = rpc.RPCProxy(params.model)
if not params.id:
ctx = dict((params.context or {}), **rpc.session.context)
id = proxy.create(data, ctx)
params.ids = (params.ids or []) + [int(id)]
params.id = int(id)
params.count += 1
else:
ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
id = proxy.write([params.id], data, ctx)
elif params.button and params.editable and params.id:
proxy = rpc.RPCProxy(params.model)
ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
id = proxy.write([params.id], data, ctx)
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(params.model)
ctx = dict((params.context or {}), **rpc.session.context)
id = proxy.create(data, ctx)
params.ids = (params.ids or []) + [int(id)]
params.id = int(id)
params.count += 1
elif params.button and params.editable and params.id:
proxy = rpc.RPCProxy(params.model)
ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
id = proxy.write([params.id], data, ctx)
** Affects: openobject-client-web
Importance: Undecided
Status: New
** Description changed:
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/openerp/controllers/form.py Class Form, Function save
+
Original code
- # bypass save, for button action in non-editable view
- if not (params.button and params.editable and params.id):
- proxy = rpc.RPCProxy(params.model)
- if not params.id:
- ctx = dict((params.context or {}), **rpc.session.context)
- id = proxy.create(data, ctx)
- params.ids = (params.ids or []) + [int(id)]
- params.id = int(id)
- params.count += 1
- else:
- ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
- id = proxy.write([params.id], data, ctx)
-
- elif params.button and params.editable and params.id:
- proxy = rpc.RPCProxy(params.model)
- ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
- id = proxy.write([params.id], data, ctx)
+ # bypass save, for button action in non-editable view
+ if not (params.button and params.editable and params.id):
+ proxy = rpc.RPCProxy(params.model)
+ if not params.id:
+ ctx = dict((params.context or {}), **rpc.session.context)
+ id = proxy.create(data, ctx)
+ params.ids = (params.ids or []) + [int(id)]
+ params.id = int(id)
+ params.count += 1
+ else:
+ ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
+ id = proxy.write([params.id], data, ctx)
+ elif params.button and params.editable and params.id:
+ proxy = rpc.RPCProxy(params.model)
+ ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
+ id = proxy.write([params.id], data, ctx)
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(params.model)
- ctx = dict((params.context or {}), **rpc.session.context)
- id = proxy.create(data, ctx)
- params.ids = (params.ids or []) + [int(id)]
- params.id = int(id)
- params.count += 1
- elif params.button and params.editable and params.id:
- proxy = rpc.RPCProxy(params.model)
- ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
- id = proxy.write([params.id], data, ctx)
+ proxy = rpc.RPCProxy(params.model)
+ ctx = dict((params.context or {}), **rpc.session.context)
+ id = proxy.create(data, ctx)
+ params.ids = (params.ids or []) + [int(id)]
+ params.id = int(id)
+ params.count += 1
+ elif params.button and params.editable and params.id:
+ proxy = rpc.RPCProxy(params.model)
+ ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
+ id = proxy.write([params.id], data, ctx)
--
[trunk] controllers form, bad contidion on save
https://bugs.launchpad.net/bugs/668465
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
Status in OpenObject Web Client: New
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/openerp/controllers/form.py Class Form, Function save
Original code
# bypass save, for button action in non-editable view
if not (params.button and params.editable and params.id):
proxy = rpc.RPCProxy(params.model)
if not params.id:
ctx = dict((params.context or {}), **rpc.session.context)
id = proxy.create(data, ctx)
params.ids = (params.ids or []) + [int(id)]
params.id = int(id)
params.count += 1
else:
ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
id = proxy.write([params.id], data, ctx)
elif params.button and params.editable and params.id:
proxy = rpc.RPCProxy(params.model)
ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
id = proxy.write([params.id], data, ctx)
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(params.model)
ctx = dict((params.context or {}), **rpc.session.context)
id = proxy.create(data, ctx)
params.ids = (params.ids or []) + [int(id)]
params.id = int(id)
params.count += 1
elif params.button and params.editable and params.id:
proxy = rpc.RPCProxy(params.model)
ctx = utils.context_with_concurrency_info(params.context, params.concurrency_info)
id = proxy.write([params.id], data, ctx)
Follow ups
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: sma (Open ERP), 2010-12-17
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: Serge, 2010-12-16
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: Serge, 2010-12-15
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: Serge, 2010-12-15
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: sma (Open ERP), 2010-12-15
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: Serge, 2010-12-14
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: Serge, 2010-12-14
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: sma (Open ERP), 2010-12-14
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: Launchpad Bug Tracker, 2010-12-14
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: sma (Open ERP), 2010-12-14
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: DBR (OpenERP), 2010-12-13
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: Serge, 2010-11-15
-
[Bug 668465] Re: [trunk] controllers form, bad contidion on save
From: Serge, 2010-11-02
-
[Bug 668465] [NEW] [trunk] controllers form, bad contidion on save
From: Serge, 2010-10-29
References