Browse Source

[FIX] Bug Fixed 'pos_multi_variant'

pull/129/head
Ajmalcybrosys 6 years ago
parent
commit
7dc6c9a915
  1. 2
      pos_multi_variant/__manifest__.py
  2. 5
      pos_multi_variant/doc/RELEASE_NOTES.md
  3. 21
      pos_multi_variant/static/src/js/ProductPopup.js

2
pos_multi_variant/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': "POS Product Multi variant", 'name': "POS Product Multi variant",
'version': '12.0.1.0.0', 'version': '12.0.1.0.1',
'summary': """Product with multi-variants""", 'summary': """Product with multi-variants""",
'description': """Configure products having variants in POS""", 'description': """Configure products having variants in POS""",
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',

5
pos_multi_variant/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 12.0.1.0.0 #### Version 12.0.1.0.0
##### ADD ##### ADD
- Initial commit for pos_multi_variant - Initial commit for pos_multi_variant
#### 20.09.2019
#### Version 12.0.1.0.1
##### FIX
- Bug Fixed.

21
pos_multi_variant/static/src/js/ProductPopup.js

@ -50,7 +50,7 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
}); });
var ProductPopUp = PopupWidget.extend var ProductPopUp = PopupWidget.extend
({ template: 'ProductPopUp', ({ template: 'ProductPopUp',
init: function(parent, options) init: function(parent, options)
{ this._super(parent, options); { this._super(parent, options);
@ -59,8 +59,7 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
}, },
show: function(options) show: function(options)
{ var self =this; { this._super(options);
this._super(options);
this.render_list(options); this.render_list(options);
}, },
@ -78,7 +77,7 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
var category = $(self).find('.action').data('category'); var category = $(self).find('.action').data('category');
$('.product-img').find('.variant-selected').each(function () $('.product-img').find('.variant-selected').each(function ()
{ if($(this).data('category') == category) // if so { if($(this).data('category') == category)
{ $(this).text("").removeClass('variant-selected'); { $(this).text("").removeClass('variant-selected');
$(self).find('.action').text("Selected").addClass('variant-selected'); $(self).find('.action').text("Selected").addClass('variant-selected');
} }
@ -92,7 +91,7 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
render_list:function(options) render_list:function(options)
{ this.list = options.list { this.list = options.list
this.image_url = options.image_url this.image_url = options.image_url
this.pos_reference = options.data this.pos_reference = options.data
this.variant_values = options.values this.variant_values = options.values
this.self = options.self this.self = options.self
@ -106,6 +105,9 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
{ if(this.list[i].pos_active == false) { if(this.list[i].pos_active == false)
{ NotActive += 1 { NotActive += 1
} }
if(this.list.length == NotActive)
{ $("#notify").append(ActiveError);
}
if(this.list[i].pos_active == true) if(this.list[i].pos_active == true)
{ if (!pushed.includes(this.list[i].attribute[0])) { if (!pushed.includes(this.list[i].attribute[0]))
{ var temp = {}; { var temp = {};
@ -115,9 +117,6 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
AttributeNumbers.push(temp) AttributeNumbers.push(temp)
} }
} }
if(this.list.length == NotActive)
{ $("#notify").append(ActiveError);
}
} }
var tag = "<div class='"+i+"'>"; var tag = "<div class='"+i+"'>";
for ( var i in AttributeNumbers) for ( var i in AttributeNumbers)
@ -136,7 +135,7 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
"<div class='product-img'>"+ "<div class='product-img'>"+
"<img src='"+this.image_url+"'/>" + "<img src='"+this.image_url+"'/>" +
"<span class='extra-price'>"+price+"</span>"+ "<span class='extra-price'>"+price+"</span>"+
"<h2 class='action' data-price='' data-type='' data-category='"+AttributeNumbers[i].name+""'></h2>"+ "<h2 class='action' data-price='' data-type='' data-category='"+AttributeNumbers[i].name+"'></h2>"+
"<span class='variants'>"+this.variant_values[k].name+"</span>"+ "<span class='variants'>"+this.variant_values[k].name+"</span>"+
"</div>"+ "</div>"+
"</article>" "</article>"
@ -153,7 +152,7 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
if(!(this.pos_reference.variant_line_ids.length>0)) if(!(this.pos_reference.variant_line_ids.length>0))
{ $("#notify").append(AddError); { $("#notify").append(AddError);
} }
}, },
click_cancel: function() click_cancel: function()
{ var order = this.self.pos.get('selectedOrder').selected_orderline.product_variants = [] { var order = this.self.pos.get('selectedOrder').selected_orderline.product_variants = []
@ -162,7 +161,7 @@ odoo.define('pos_multi_variant.ProductPopup', function (require)
click_confirm: function() click_confirm: function()
{ var price = 0.00 { var price = 0.00
var order = this.self.pos.get_order(); var order = this.self.pos.get('selectedOrder');
var selected_orderline = order.selected_orderline var selected_orderline = order.selected_orderline
$('.product-img').find('.variant-selected').each(function () $('.product-img').find('.variant-selected').each(function ()
{ price += parseFloat($(this).data('price')) { price += parseFloat($(this).data('price'))

Loading…
Cancel
Save