summaryrefslogtreecommitdiff
path: root/addons/lunch/static/src/xml/lunch.xml
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2016-01-04 11:11:12 +0100
committerYannick Tivisse <yti@odoo.com>2016-11-03 11:41:39 +0100
commit018144b8ac83e277e6add0e98de417bcaa7e613c (patch)
treebe1247613ccfb8ca5ee9da60140f86b052bf845f /addons/lunch/static/src/xml/lunch.xml
parent7cf554af54109c2ba3aab2530f3f6735851e6838 (diff)
[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.
Diffstat (limited to 'addons/lunch/static/src/xml/lunch.xml')
-rw-r--r--addons/lunch/static/src/xml/lunch.xml24
1 files changed, 14 insertions, 10 deletions
diff --git a/addons/lunch/static/src/xml/lunch.xml b/addons/lunch/static/src/xml/lunch.xml
index 77bce1be30d..029b5b7add4 100644
--- a/addons/lunch/static/src/xml/lunch.xml
+++ b/addons/lunch/static/src/xml/lunch.xml
@@ -1,26 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
- <div t-name="lunch_order_widget_no_previous_order" class="col-md-12">
+ <div t-name="LunchPreviousOrdersWidgetNoOrder" class="col-md-12">
<h3>This is the first time you order a meal</h3>
<p class="text-muted">Select a product and put your order comments on the note.</p>
<p class="text-muted">Your favorite meals will be created based on your last orders.</p>
<p class="text-muted">Don't forget the alerts displayed in the reddish area</p>
</div>
- <t t-name="lunch_order_widget_previous_orders_list">
- <div t-foreach="categories" t-as="product_category" class="col-sm-4">
- <h3><t t-esc="product_category"/></h3>
- <div t-foreach='categories[product_category]' t-as='product' class="o_lunch_vignette">
- <button type="button" class="pull-right o_add_button oe_edit_only oe_link" t-att-data-id="product.id">
+ <t t-name="LunchPreviousOrdersWidgetList">
+ <div t-foreach="categories" t-as="supplier" class="col-md-4">
+ <h3><t t-esc="supplier"/></h3>
+ <div t-foreach='categories[supplier]' t-as='order' class="o_lunch_vignette">
+ <button type="button" class="pull-right o_add_button oe_edit_only oe_link" t-att-data-id="order.line_id">
<span class="fa fa-plus-square"></span>
<span>Add</span>
</button>
- <div class="o_lunch_text">
- <t t-esc="product.product_id[1]"/>
+ <div>
+ <t t-esc="order.product_name"/>
<span class="badge">
- <t t-esc="widget.monetary.format_value(product.price)"/> <t t-esc="product.currency_id[1]"/>
+ <t t-if="order.position === 'before'"><t t-esc="order.currency"/></t>
+ <span class="o_lunch_price"><t t-esc="order.price_format"></t></span>
+ <t t-if="order.position === 'after'"><t t-esc="order.currency"/></t>
</span>
</div>
- <div class="text-muted"><t t-if="product.note != false" t-esc="product.note"/></div>
+ <div class="text-muted">
+ <t t-if="order.note != false" t-esc="order.note"/>
+ </div>
</div>
</div>
</t>