Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] web_widget_x2many_2d_matrix: _renderBodyCell #1124

Merged

Conversation

alexey-pelykh
Copy link
Contributor

No description provided.

@alexey-pelykh
Copy link
Contributor Author

@simahawk @yajo @pedrobaeza @tarteo please review this fix, and sorry for introducing an issue

Copy link
Member

@tarteo tarteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. For the options parameter in the function I would rather use _.defaults once instead of checking every time (also on line 286) it options is something.

@JordiBForgeFlow
Copy link
Member

@bjeficent @mreficent can you review plz?

@alexey-pelykh alexey-pelykh force-pushed the 12.0-fix-web_widget_x2many_2d_matrix branch from 30bfaa3 to 388e11c Compare December 6, 2018 12:52
@hbrunn
Copy link
Member

hbrunn commented Dec 6, 2018

this is an example why open source is so super cool: I introduced this widget a while ago, others picked it up, extended, and now I'm at a state where I don't understand the diff without reading all of what people did during the v11 and v12 migration. Looks great! But I'm still reading, so can't put a review currently

Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexey-pelykh LG. I'd like to see a version upgrade and a line in the changelog. Can you do that?

@simahawk
Copy link
Contributor

simahawk commented Dec 7, 2018

@tarteo checking that format thingy and how it changed... on abstract field they do this:

https://github.com/odoo/odoo/blob/1868713dbd07e0b518f91dffe73e62d85e6ab9a6/addons/web/static/src/js/fields/abstract_field.js#L164-L173

        // formatType is used to determine which format (and parse) functions
        // to call to format the field's value to insert into the DOM (typically
        // put into a span or an input), and to parse the value from the input
        // to send it to the server. These functions are chosen according to
        // the 'widget' attrs if is is given, and if it is a valid key, with a
        // fallback on the field type, ensuring that the value is formatted and
        // displayed according to the choosen widget, if any.
        this.formatType = this.attrs.widget in field_utils.format ?
                            this.attrs.widget :
this.field.type;

so, yes, there could be also a specific formatting by widget if found in the registry,

However, in the list renderer is ignored and I think it's because you already try to render via widget (which is going to handle it using formatType) and it just fallbacks when no option is left to the mere field type.

Seems legit, no?

@alexey-pelykh
Copy link
Contributor Author

@simahawk done, also please check:

  • removed button-related code (is it even possible to have one in 2d matrix?)
  • added few comments

@tarteo
Copy link
Member

tarteo commented Dec 7, 2018

@simahawk Ah yes, thanks. @alexey-pelykh Can you add some comments in the code on what's happening.

@pedrobaeza pedrobaeza added this to the 12.0 milestone Dec 7, 2018
@alexey-pelykh alexey-pelykh force-pushed the 12.0-fix-web_widget_x2many_2d_matrix branch from 4ddc16c to 5645621 Compare December 7, 2018 12:07
Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, this is really hard to review. Please, could you add some details on what are you fixing and how, and remove all the clutter introduced with all that commented code, to keep a smaller diff, easier to review?

Please abstain from opening big PRs without description. Thanks!

web_widget_x2many_2d_matrix/README.rst Outdated Show resolved Hide resolved
@alexey-pelykh alexey-pelykh force-pushed the 12.0-fix-web_widget_x2many_2d_matrix branch 2 times, most recently from 6f893a9 to d923931 Compare December 7, 2018 12:40
Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will only say that this makes OCA/timesheet#140 to work with hr_timesheet_sheet. So It'd be great if all comments here are attended and we can move on with that.

@alexey-pelykh alexey-pelykh force-pushed the 12.0-fix-web_widget_x2many_2d_matrix branch from d923931 to 6d4729d Compare December 7, 2018 15:48
@alexey-pelykh
Copy link
Contributor Author

All changes made as of now

@yajo
Copy link
Member

yajo commented Dec 10, 2018

@tarteo can you please update your review?

@alexey-pelykh
Copy link
Contributor Author

Significant note: for some reason, editable mode is not working.

options.mode = this.getParent().mode;

worth checking

@alexey-pelykh
Copy link
Contributor Author

readonly vs edit are getting propagated properly, that's all I know right now

@alexey-pelykh alexey-pelykh force-pushed the 12.0-fix-web_widget_x2many_2d_matrix branch from 6d4729d to 043cfc1 Compare December 10, 2018 19:10
@alexey-pelykh
Copy link
Contributor Author

/me dumb - now fields can be editable properly

@pedrobaeza
Copy link
Member

Several questions about this (some might be out of the scope of this PR):

@alexey-pelykh
Copy link
Contributor Author

alexey-pelykh commented Dec 10, 2018

@pedrobaeza unfortunately I'm unable to address any of these questions properly, this PR is related to migration, so I don't think it would fix anything by magic. Yet, it may have introduced support for widgets (question 1.), and right now the editable state is propagated from parent (question 2.)

@pedrobaeza
Copy link
Member

Well, maybe 3 might be introduced in your migration, so that's why I asked... @tarteo please confirm the review for merging this.

@alexey-pelykh alexey-pelykh force-pushed the 12.0-fix-web_widget_x2many_2d_matrix branch from 043cfc1 to ed6f1f8 Compare December 10, 2018 20:32
@alexey-pelykh alexey-pelykh force-pushed the 12.0-fix-web_widget_x2many_2d_matrix branch from ed6f1f8 to 343d056 Compare December 10, 2018 21:56
Copy link
Member

@tarteo tarteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pedrobaeza pedrobaeza merged commit e8e5048 into OCA:12.0 Dec 11, 2018
@alexey-pelykh alexey-pelykh deleted the 12.0-fix-web_widget_x2many_2d_matrix branch December 11, 2018 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants