Mohammed Shekha(Open ERP) has proposed merging
lp:~openerp-dev/openobject-client-web/6.0-opw-17478-msh into
lp:openobject-client-web/6.0.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-17478-msh/+merge/76006
Hello,
To generate the issue goto Accounting -> Customers -> Customer Invoices.
Create a newer record and select a journal other than first one which is coming
default and then right click on journal field and "Set as default" for the
current partner and save the record.
Now create a new record and select the partner for which you have set default
value in journal you will see the value of journal will not change.
This occuring due to on_change and setDefault on the same field that's why
web-client will call only onchange, it will not call change_default_get because
web-client giving priority to on_change.
So changed the code accordingly so that setDefault as well as on_change both is
called and if there is a field which is changed due to on_change as well as
setDefault then on_change will be called last, so the result of on_change will
be final on that field.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-17478-msh/+merge/76006
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-client-web/6.0-opw-17478-msh.
=== modified file 'addons/openerp/controllers/form.py'
--- addons/openerp/controllers/form.py 2011-06-10 10:10:19 +0000
+++ addons/openerp/controllers/form.py 2011-09-19 11:41:29 +0000
@@ -1019,6 +1019,10 @@
caller = data.pop('_terp_caller')
model = data.pop('_terp_model')
context = data.pop('_terp_context')
+
+ change_default = False
+ if '_terp_change_default' in data:
+ change_default = data.pop('_terp_change_default')
try:
context = eval(context) # convert to python dict
@@ -1122,7 +1126,14 @@
if 'domain' in result:
for k in result['domain']:
result['domain'][k] = ustr(result['domain'][k])
-
+
+ if change_default:
+ value = data.get('_terp_value')
+ proxy = rpc.RPCProxy('ir.values')
+ values = proxy.get('default', '%s=%s' % (caller, value), [(model, False)], False, context)
+ for index, fname, value in values:
+ if fname not in result['value']:
+ result['value'][fname] = value
return result
@expose('json')
=== modified file 'addons/openerp/static/javascript/form.js'
--- addons/openerp/static/javascript/form.js 2011-08-03 11:02:15 +0000
+++ addons/openerp/static/javascript/form.js 2011-09-19 11:41:29 +0000
@@ -500,6 +500,7 @@
openobject.http.postJSON(post_url, jQuery.extend({}, form_data, {
_terp_callback: callback,
+ _terp_change_default: change_default,
_terp_caller: $caller.attr('id').slice(id_slice_offset),
_terp_value: $caller.val(),
_terp_model: select('_terp_model').val(),
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp