Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/11.0' into 12.0-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
KolushovAlexandr committed Dec 14, 2019
2 parents 640f6db + 533e371 commit 0b535f7
Show file tree
Hide file tree
Showing 35 changed files with 248 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: python

python:
- "3.5"
- "3.6"

sudo: false
cache: pip
Expand Down
2 changes: 2 additions & 0 deletions pos_disable_payment_restaurant/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Maintainers
Thank you for understanding!

`IT-Projects Team <https://www.it-projects.info/team>`__

This module is not maintained since Odoo 11.0.

Further information
===================
Expand Down
14 changes: 0 additions & 14 deletions pos_discount_base/i18n/pos_discount_base.pot

This file was deleted.

4 changes: 4 additions & 0 deletions pos_fiscal_current/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
====================

Shows fiscal under tax line in POS order section

Maintainers
-----------
This module is not maintained since Odoo 11.0.
4 changes: 4 additions & 0 deletions pos_fiscal_floor/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
==================

Add Fiscal Position to POS floor model.

Maintainers
-----------
This module is not maintained since Odoo 11.0.
3 changes: 1 addition & 2 deletions pos_order_merge/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Merge POS orders into a single order in a few clicks.
Roadmap
=======

.. note:: Does not work in the *Store mode*, where the floors are not located.
*A floor is a place for tables.*
.. note:: Does not work in the *Store mode*, where the floors are not located. *A floor is a place for tables.*

TODO: Store mode

Expand Down
1 change: 1 addition & 0 deletions pos_orders_history/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Credits
Contributors
------------
* `Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>`__
* `Kolushov Alexandr <https://it-projects.info/team/Kolushov Alexandr>`__

Sponsors
--------
Expand Down
4 changes: 2 additions & 2 deletions pos_orders_history/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright 2017 Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>
# Copyright 2018 Artem Losev
# Copyright 2018 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "POS Orders History",
"summary": """See all paid orders from special menu in POS""",
"category": "Point of Sale",
# "live_test_url": "http://apps.it-projects.info/shop/product/pos-orders-history?version=12.0",
"images": ['images/pos_orders_history_main.png'],
"version": "12.0.1.2.1",
"version": "12.0.1.4.0",
"application": False,

"author": "IT-Projects LLC, Dinar Gabbasov",
Expand Down
12 changes: 9 additions & 3 deletions pos_orders_history/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
.. _changelog:
`1.4.0`
-------

**Improvement:** Reduced quantity of requests to the server
**Improvement:** "Show Cancelled Orders" option is shown only with "Saving removed products of POS order" module installed

`1.3.0`
-------

Updates
=======
**Improvement:** Show Invoiced Orders option

`1.2.1`
-------
Expand Down
10 changes: 10 additions & 0 deletions pos_orders_history/models/pos_orders_history_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2017-2018 Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>
# Copyright 2018 Artem Losev
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models, api
Expand All @@ -21,7 +22,16 @@ class PosConfig(models.Model):

show_cancelled_orders = fields.Boolean("Show Cancelled Orders", default=True)
show_posted_orders = fields.Boolean("Show Posted Orders", default=False)
show_invoiced_orders = fields.Boolean("Show Invoiced Orders", default=False)
show_barcode_in_receipt = fields.Boolean("Show Barcode in Receipt", default=True)
is_pos_order_cancel_installed = fields.Boolean("POS Order Cancel Module Installed",
compute="_compute_is_pos_order_cancel_installed")

def _compute_is_pos_order_cancel_installed(self):
pos_order_cancel = self.env['ir.module.module'].sudo().search(
[('name', '=', 'pos_order_cancel'), ('state', '=', 'installed')])
for pos_config in self:
pos_config.is_pos_order_cancel_installed = pos_order_cancel and pos_order_cancel.id

# ir.actions.server methods:
@api.model
Expand Down
65 changes: 39 additions & 26 deletions pos_orders_history/static/src/js/models.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright 2017-2018 Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>
* Copyright 2018 Artem Losev
* Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
* Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
* License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
odoo.define('pos_orders_history.models', function (require) {
"use strict";
Expand All @@ -11,48 +11,68 @@ odoo.define('pos_orders_history.models', function (require) {
models.PosModel = models.PosModel.extend({
initialize: function () {
_super_pos_model.initialize.apply(this, arguments);
this.bus.add_channel_callback("pos_orders_history", this.on_orders_history_updates, this);
var self = this;
this.ready.then(function () {
self.bus.add_channel_callback("pos_orders_history", self.on_orders_history_updates, self);
});
this.subscribers = [];
},
add_subscriber: function (subscriber) {
this.subscribers.push(subscriber);
},
on_orders_history_updates: function(message) {
var self = this;
// state of orders
var state = ['paid'];

get_order_history_domain_states: function() {
var states = ['paid'];
if (this.config.show_cancelled_orders) {
state.push('cancel');
states.push('cancel');
}
if (this.config.show_posted_orders) {
state.push('done');
states.push('done');
}
if (this.config.show_invoiced_orders) {
states.push('invoiced');
}
message.updated_orders.forEach(function (id) {
self.get_order_history(id).done(function(order) {
return states;
},

on_orders_history_updates: function(message) {
var self = this;
// states of orders
var states = this.get_order_history_domain_states();
var order_ids = message.updated_orders;
return this.fetch_order_history_orders_by_ids(order_ids).done(function(orders) {
_.each(orders, function(order){
if (order instanceof Array) {
order = order[0];
}
if (state.indexOf(order.state) !== -1) {
if (states.indexOf(order.state) !== -1) {
self.update_orders_history(order);
}
});
self.get_order_history_lines_by_order_id(id).done(function (lines) {
}).done(function() {
self.fetch_order_history_lines_by_order_ids(order_ids).done(function (lines) {
self.update_orders_history_lines(lines);
});
});
},
get_order_history: function (id) {
fetch_order_history_orders_by_ids: function(ids) {
if (!(ids instanceof Array)) {
ids = [ids];
}
return rpc.query({
model: 'pos.order',
method: 'search_read',
args: [[['id', '=', id]]]
args: [[['id', 'in', ids]]]
});
},
get_order_history_lines_by_order_id: function (id) {
fetch_order_history_lines_by_order_ids: function (ids) {
if (!(ids instanceof Array)) {
ids = [ids];
}
return rpc.query({
model: 'pos.order.line',
method: 'search_read',
args: [[['order_id', '=', id]]]
args: [[['order_id', 'in', ids]]]
});
},
update_orders_history: function (orders) {
Expand Down Expand Up @@ -138,16 +158,9 @@ odoo.define('pos_orders_history.models', function (require) {
domain: function(self) {
var domain = [];

// state of orders
var state = ['paid'];
if (self.config.show_cancelled_orders) {
state.push('cancel');
}
if (self.config.show_posted_orders) {
state.push('done');
}

domain.push(['state','in',state]);
// states of orders
var states = self.get_order_history_domain_states();
domain.push(['state','in',states]);

// number of orders
if (self.config.load_orders_of_last_n_days) {
Expand Down
6 changes: 3 additions & 3 deletions pos_orders_history/static/src/js/screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ odoo.define('pos_orders_history.screens', function (require) {
if (o instanceof Array) {
o = o[0];
}
self.pos.get_order_history_lines_by_order_id(o.id).done(function (lines) {
self.pos.fetch_order_history_lines_by_order_ids(o.id).done(function (lines) {
self.pos.update_orders_history_lines(lines);
self.search_order_on_history(o);
});
Expand Down Expand Up @@ -254,7 +254,7 @@ odoo.define('pos_orders_history.screens', function (require) {
get_order_line_data: function(order) {
var self = this;
return _.map(order.lines, function (id) {
var line = self.pos.db.line_by_id[id];
var line = self.pos.db.line_by_id[id] || {};
line.image = self.get_product_image_url(line.product_id[0]);
return line;
});
Expand Down Expand Up @@ -401,7 +401,7 @@ odoo.define('pos_orders_history.screens', function (require) {
if (o instanceof Array) {
o = o[0];
}
self.pos.get_order_history_lines_by_order_id(o.id).done(function (lines) {
self.pos.fetch_order_history_lines_by_order_ids(o.id).done(function (lines) {
self.pos.update_orders_history_lines(lines);
self.search_order_on_history(o);
});
Expand Down
Loading

0 comments on commit 0b535f7

Please sign in to comment.