Skip to content

Commit

Permalink
Merge pull request #3 from GabbasovDinar/11.0-pos_orderline_absolute_…
Browse files Browse the repository at this point in the history
…discount-porting

[LINT] fix lint errors for pos_modules
  • Loading branch information
Ildar authored Mar 21, 2018
2 parents 2b3edb7 + d71b072 commit 286117b
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 91 deletions.
2 changes: 1 addition & 1 deletion hw_printer_network/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"summary": """Hardware Driver for Network Printers""",
"category": "Point of Sale",
"images": [],
"version": "2.0.0",
"version": "11.0.2.0.0",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down
2 changes: 1 addition & 1 deletion pos_debt_notebook/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'category': 'Point Of Sale',
'live_test_url': 'http://apps.it-projects.info/shop/product/pos-debt-notebook?version=10.0',
"images": ['images/debt_notebook.png'],
'version': '4.4.3',
'version': '11.0.4.4.3',

'author': 'IT-Projects LLC, Ivan Yelizariev',
"support": "apps@it-projects.info",
Expand Down
2 changes: 1 addition & 1 deletion pos_mobile/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"category": "Point of Sale",
"live_test_url": "http://apps.it-projects.info/shop/product/pos-mobile-ui?version=11.0",
"images": ["images/pos_mobile.png"],
"version": "10.0.1.1.5",
"version": "11.0.1.1.5",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down
2 changes: 1 addition & 1 deletion pos_mobile_restaurant/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"category": "Point of Sale",
"live_test_url": "http://apps.it-projects.info/shop/product/pos-mobile-ui?version=11.0",
"images": ["images/pos_mobile_restaurant.png"],
"version": "10.0.1.2.5",
"version": "11.0.1.2.5",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down
2 changes: 1 addition & 1 deletion pos_multi_session/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"category": "Point Of Sale",
"live_test_url": 'http://apps.it-projects.info/shop/product/pos-multi-session?version=11.0',
"images": ["images/pos-multi-session.png"],
"version": "10.0.4.0.2",
"version": "11.0.4.0.2",
"application": False,

"author": "IT-Projects LLC, Ivan Yelizariev",
Expand Down
2 changes: 1 addition & 1 deletion pos_multi_session_restaurant/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"category": "Point of Sale",
"live_test_url": 'http://apps.it-projects.info/shop/product/pos-multi-session?version=11.0',
"images": ['images/s2.png'],
"version": "10.0.2.2.0",
"version": "11.0.2.2.0",
"application": False,

"author": "IT-Projects LLC, Ivan Yelizariev",
Expand Down
2 changes: 1 addition & 1 deletion pos_multi_session_sync/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"category": "Point of Sale",
"live_test_url": 'http://apps.it-projects.info/shop/product/pos-multi-session?version=11.0',
"images": [],
"version": "10.0.1.0.1",
"version": "11.0.1.0.1",
"application": False,

"author": "IT-Projects LLC, Kolushov Alexandr",
Expand Down
1 change: 0 additions & 1 deletion pos_order_cancel/static/src/js/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ odoo.define('pos_order_cancel.tour', function(require) {
tour.register('pos_order_cancel_tour', {
test: true,
url: "/web",
test: true,
}, [{
trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"], .oe_menu_toggler[data-menu-xmlid="point_of_sale.menu_point_root"]',
content: "Ready to launch your <b>point of sale</b>? <i>Click here</i>.",
Expand Down
2 changes: 1 addition & 1 deletion pos_order_note/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"category": "Point of Sale",
"live_test_url": "http://apps.it-projects.info/shop/product/pos-order-note?version=11.0",
"images": ["images/pos_order_note_main.png"],
"version": "1.1.1",
"version": "11.0.1.1.1",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down
83 changes: 43 additions & 40 deletions pos_order_note/static/src/js/order_note.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ odoo.define('pos_cancel_order.order_note', function (require) {
var old_res = this.saved_resume || {};

var line_hash = false;

var res = _super_order.computeChanges.apply(this, arguments);

var old_order_note = this.old_note || false;
Expand All @@ -113,31 +112,7 @@ odoo.define('pos_cancel_order.order_note', function (require) {
var current_order_note = this.get_note();
var current_order_custom_notes = this.get_custom_notes();

var old_order_custom_notes_ids = [];
var current_order_custom_notes_ids = [];

if (old_order_custom_notes) {
old_order_custom_notes.forEach(function(old_note) {
old_order_custom_notes_ids.push(old_note.id);
});
}

if (current_order_custom_notes) {
current_order_custom_notes.forEach(function(current_note) {
current_order_custom_notes_ids.push(current_note.id);
});
}

var change_custom_notes = false;
if (current_order_custom_notes_ids.length === old_order_custom_notes_ids.length) {
var difference = this.DiffArrays(current_order_custom_notes_ids, old_order_custom_notes_ids);
if (difference.length) {
change_custom_notes = true;
}
} else {
change_custom_notes = true;
}
if (change_custom_notes) {
if (this.change_custom_notes()) {
if (current_order_custom_notes) {
res.new.push({
name: "Order Note",
Expand Down Expand Up @@ -186,26 +161,54 @@ odoo.define('pos_cancel_order.order_note', function (require) {
var old = old_res[line_hash];
var current_line_id = curr.line_id;

if (res.new) {
var new_exist_change = _.find(res.new, function(r) {
return r.line_id === current_line_id;
});
if (new_exist_change && curr.custom_notes) {
new_exist_change.custom_notes = curr.custom_notes;
}
var new_exist_change = _.find(res.new, function(r) {
return r.line_id === current_line_id;
});

if (new_exist_change && curr.custom_notes) {
new_exist_change.custom_notes = curr.custom_notes;
}
if (res.cancelled) {
var cancelled_exist_change = _.find(res.cancelled, function(r) {
return r.line_id === current_line_id;
});
if ((cancelled_exist_change && curr.old_custom_notes) && (curr.old_custom_notes && curr.old_custom_notes !== curr.custom_notes)) {
cancelled_exist_change.custom_notes = curr.old_custom_notes;
}

var cancelled_exist_change = _.find(res.cancelled, function(r) {
return r.line_id === current_line_id;
});
if (cancelled_exist_change && curr.old_custom_notes && curr.old_custom_notes !== curr.custom_notes) {
cancelled_exist_change.custom_notes = curr.old_custom_notes;
}
}
}
return res;
},
change_custom_notes: function() {
var old_order_custom_notes = this.old_custom_notes || false;
var current_order_custom_notes = this.get_custom_notes();

var old_order_custom_notes_ids = [];
var current_order_custom_notes_ids = [];

if (old_order_custom_notes) {
old_order_custom_notes.forEach(function(old_note) {
old_order_custom_notes_ids.push(old_note.id);
});
}

if (current_order_custom_notes) {
current_order_custom_notes.forEach(function(current_note) {
current_order_custom_notes_ids.push(current_note.id);
});
}

var change_custom_notes = false;
if (current_order_custom_notes_ids.length === old_order_custom_notes_ids.length) {
var difference = this.DiffArrays(current_order_custom_notes_ids, old_order_custom_notes_ids);
if (difference.length) {
change_custom_notes = true;
}
} else {
change_custom_notes = true;
}
return change_custom_notes;
},
DiffArrays: function(A,B) {
var M = A.length, N = B.length, c = 0, C = [];
for (var i = 0; i < M; i++) {
Expand Down
2 changes: 1 addition & 1 deletion pos_order_printer_product/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"category": "Point of Sale",
# "live_test_URL": "",
"images": ['images/pos_order_printer_product_main.png'],
"version": "1.0.0",
"version": "11.0.1.0.0",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down
2 changes: 1 addition & 1 deletion pos_print_method/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"category": "Point of Sale",
# "live_test_url": "",
"images": ["images/pm1.png"],
"version": "10.0.1.0.1",
"version": "11.0.1.0.1",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down
2 changes: 1 addition & 1 deletion pos_printer_network/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"summary": """The time has come. Print POS orders and receipts by using network printers""",
"category": "Point of Sale",
"images": ['images/pos_printer_network_main.png'],
"version": "2.0.0",
"version": "11.0.2.0.0",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down
78 changes: 40 additions & 38 deletions pos_printer_network/static/src/js/network_printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ odoo.define('pos_restaurant.network_printer', function (require) {
model: 'restaurant.printer',
fields: ['network_printer'],
domain: null,
loaded: function(self,printers){
loaded: function(self, printers){
self.printers.forEach(function(item){
var printer_obj = _.find(printers, function(printer){
return printer.id === item.config.id;
Expand Down Expand Up @@ -166,64 +166,69 @@ odoo.define('pos_restaurant.network_printer', function (require) {
set_network_printer_status: function(status) {
this.devices_status = status;
},
set_smart_status: function(status){
if(status.status === 'connected'){
var warning = false;
var msg = '';
if(this.pos.config.iface_scan_via_proxy){
var scanner = status.drivers.scanner
? status.drivers.scanner.status
: false;
if( scanner !== 'connected' && scanner !== 'connecting'){
warning = true;
msg += _t('Scanner');
}
get_message_from_devices: function(status) {
var msg = '';
if (this.pos.config.iface_scan_via_proxy) {
var scanner = status.drivers.scanner
? status.drivers.scanner.status
: false;
if( scanner !== 'connected' && scanner !== 'connecting'){
this.warning_status = true;
msg += _t('Scanner');
}
}
if( this.pos.config.iface_electronic_scale ){
var scale = status.drivers.scale
? status.drivers.scale.status
: false;
if( scale !== 'connected' && scale !== 'connecting' ){
this.warning_status = true;
msg = msg
? msg + ' & '
: msg;
msg += _t('Scale');
}
}
msg = msg
? msg + ' ' + _t('Offline')
: msg;
return msg;
},
set_smart_status: function(status){
if(status.status === 'connected') {
this.warning_status = false;

if (this.pos.receipt_printer_is_usb) {
if( this.pos.config.iface_print_via_proxy ||
this.pos.config.iface_cashdrawer ) {
var printer = status.drivers.escpos
? status.drivers.escpos.status
: false;
if( printer !== 'connected' && printer !== 'connecting'){
warning = true;
this.warning_status = true;
this.usb_printer_status = false;
} else {
this.usb_printer_status = true;
}
}
} else if (this.pos.config.receipt_printer_type === "usb_printer") {
warning = true;
this.usb_printer_status = false;
}
if( this.pos.config.iface_electronic_scale ){
var scale = status.drivers.scale
? status.drivers.scale.status
: false;
if( scale !== 'connected' && scale !== 'connecting' ){
warning = true;
msg = msg
? msg + ' & '
: msg;
msg += _t('Scale');
}
}

if (this.devices_status && this.devices_status.length) {
var offline_network_printer = this.devices_status.find(function(p) {
return p.status === "offline";
});
if (offline_network_printer) {
warning = true;
this.warning_status = true;
}
}
msg = msg
? msg + ' ' + _t('Offline')
: msg;

var message = this.get_message_from_devices(status);

this.set_status(
warning
this.warning_status
? 'warning'
: 'connected',
msg);
message);
} else {
this._super(status);
}
Expand Down Expand Up @@ -279,9 +284,6 @@ odoo.define('pos_restaurant.network_printer', function (require) {
this.render_usb_list(this.usb_printer_status);
}
},
get_usb_printer_status: function(){
return this.pos.receipt_printer_is_usb;
},
render_network_list: function(network_printers) {
var network_contents = this.$el[0].querySelector('.network-printers-list-contents');
network_contents.innerHTML = "";
Expand Down
2 changes: 1 addition & 1 deletion pos_restaurant_base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"category": "Point of Sale",
# "live_test_URL": "",
"images": [],
"version": "10.0.1.0.0",
"version": "11.0.1.0.0",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down

0 comments on commit 286117b

Please sign in to comment.