Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Fixing Regression in Client

by
MoaHub, Graeme Gellatly
- 15/11/2016 00:52:45
I'm not sure that is it Holger, but thank you for advice.  In this case buttons are absolutely a no go.

All I did as a test in frustration is revert line 473 of list_view.js such that it read (essentially reverting the commit identified in issue 3964

_(_.keys(values)).each(function(key){
record.set(key, values[key], {silent: true});
// _.each(values, function (value, key) {
// if (fields[key] && fields[key].type === 'many2many')
// record.set(key + '__display', false, {silent: true});
// record.set(key, value, {silent: true});
and everything worked perfectly as expected.  So I guess my questions are now:

What exactly is this piece of code doing, i.e. how do they differ?
The commented code was introduced, so that m2m tags did not display upon deletion, is there another way of approaching this, such that the original issue is fixed without regression?

To me it looks like a simple oversight, the code looks roughly equivelant if we reduce it (assuming the if statement fails), but in the case of new records it is not displaying a value.

_(_.keys(values)).each(function(key){
record.set(key, values[key], {silent: true});

.each(values, function (value, key) {

record.set(key, value, {silent: true});


On Tue, Nov 15, 2016 at 11:23 AM, Holger Brunn <hbrunn@therp.nl> wrote:
> I'm not
> that strong on web client stuff, how to inherit, modify create widgets etc,
> but good enough that I can get started with some direction. Thanks in
> advance for any help.

the problem probably lies in the field's set_value and get_value functions, 
which only implement a subset of the available x2x commands:
https://github.com/OCA/OCB/blob/8.0/addons/web/static/src/js/
view_form.js#L4253
I assume if you implement the missing commands, fix whatever weird problems 
this creates (I expect it will), you'll be fine.
But you should think quite hard if this is worth the trouble, and if you can't 
replace (on the UI part, not the data model) the fields by buttons. Then 
everything must be saved, but this should work with any version of odoo.

-- 
Therp - Maatwerk in open ontwikkeling

Holger Brunn - Ontwerp en implementatie

mail: holger@therp.nl
web: http://therp.nl

_______________________________________________
Mailing-List: http://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe


Reference