Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //EXTENDER ORDERLINES (add button that on click insert new <li> object //
- <t t-extend="Orderline">
- <t t-jquery=".info-list" t-operation="after">
- <t t-if='line.product.pos_categ_id[0]'>
- <t t-if="line.state !== 'Done'">
- <t t-if="line.state !== 'Kitchen confirmed cancel'">
- <div class='new_control-button forchild '>
- <i class='fa fa-futbol-o' /> Children
- </div>
- </t>
- </t>
- </t>
- </t>
- </t>
- <t t-extend="Orderline">
- <t t-jquery=".info-list" t-operation="append">
- <t t-if='line.product.pos_categ_id[0]'>
- <t t-if="line.state !== 'Done'">
- <t t-if="line.state !== 'Kitchen confirmed cancel'">
- <t t-if="line.children == true">
- <li class='info'>|
- <i class='fa fa-futbol-o'/>For Children</li>
- </t>
- </t>
- </t>
- </t>
- </t>
- </t>
- // EXTENDED KITCHEN LINE
- <t t-extend="KitchenLine">
- <t t-jquery=".cooking-status-warning" t-operation="before">
- <t t-if='line.get_child()'>
- <td><i style="color:blue;font-weight:bold" class="fa fa-futbol-o blink" /><t t-esc='line.get_child()'/</td>
- </t>
- <t t-if='!line.get_child()'>
- <td>NO</td>
- </t>
- </t>
- </t>
- //js to do the job, probably a mistake in code ??.
- odoo.define('pos_restaurant_extended_screen', function (require) {
- "use strict";
- var chrome = require('point_of_sale.chrome');
- var gui = require('point_of_sale.gui');
- var models = require('point_of_sale.models');
- var screens = require('point_of_sale.screens');
- var core = require('web.core');
- var _t = core._t;
- var qweb = core.qweb;
- var _super_orderline = models.Orderline.prototype;
- models.Orderline = models.Orderline.extend({
- initialize: function() {
- _super_orderline.initialize.apply(this,arguments);
- this.children = this.children || "";
- },
- init_from_JSON: function(json){
- if (json.children) {
- this.children = json.children;
- }
- _super_orderline.init_from_JSON.apply(this,arguments);
- },
- set_child: function(children){
- this.children = children;
- this.trigger('change',this);
- },
- get_child: function(children){
- return this.children;
- },
- export_as_JSON: function(){
- var json = _super_orderline.export_as_JSON.apply(this,arguments);
- if (this.children) {
- json.children = this.children;
- }
- return json;
- }
- })
- screens.OrderWidget.include({
- render_orderline: function(orderline){
- var self = this;
- var el_node = this._super(orderline);
- var child_button = el_node.querySelector('.forchild');
- if(child_button) {
- child_button.addEventListener('click', function() {
- var children = orderline.get_child(children);
- if (children) {
- var children = false;
- orderline.set_child(children);
- orderline.order.state = true;
- orderline.state = 'Confirmed';
- orderline.trigger('change', orderline);
- orderline.order.trigger('change', orderline.order);
- orderline.order.trigger('change:sync');
- orderline.order.state = false;
- }else{
- var children = true;
- orderline.set_child(children);
- orderline.order.state = true;
- orderline.state = 'High Priority';
- orderline.trigger('change', orderline);
- orderline.order.trigger('change', orderline.order);
- orderline.order.trigger('change:sync');
- orderline.order.state = false;
- }
- })
- }
- return el_node;
- },
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement