-
- Downloads
[IMP] lunch: new lunch widget
The JS widget is simplified, which a cleaner approach. For the rendering part: - the server reads the data - the JS widget formats/organizes the data - the template renders the data prepared by the widget Quick summary of the modifications: 1. The associated field is a text field which contains JSON-encoded data. The data are read server-side, and not client-side anymore. 2. The widget is an AbstractField, no need of ReinitializeWidgetMixin anymore. No use of the FieldMonetary widget directly, but use a similar format_value instead (inspired by ShowPaymentLineWidget). 3. Data formatting (call to format_value) is done in the widget, not in the template anymore. This seems to be the standard way of doing, since lunch was the only module where format_value was in the template and not in the widget. 4. The addition of an order line is cleaner since all necessary data are prepared server-side.
Showing
- addons/lunch/models/lunch.py 32 additions, 5 deletionsaddons/lunch/models/lunch.py
- addons/lunch/static/src/js/lunch.js 36 additions, 55 deletionsaddons/lunch/static/src/js/lunch.js
- addons/lunch/static/src/less/lunch.less 0 additions, 1 deletionaddons/lunch/static/src/less/lunch.less
- addons/lunch/static/src/xml/lunch.xml 14 additions, 10 deletionsaddons/lunch/static/src/xml/lunch.xml
- addons/lunch/views/lunch_views.xml 1 addition, 1 deletionaddons/lunch/views/lunch_views.xml
Loading
Please register or sign in to comment