diff --git a/pos_repeat_order/README.rst b/pos_repeat_order/README.rst new file mode 100755 index 000000000..d0d677ade --- /dev/null +++ b/pos_repeat_order/README.rst @@ -0,0 +1,37 @@ +POS Reorder +=========== +This modules provides an option to repeat the orders of the corresponding customer from POS + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developers: Nimisha Murali@cybrosys + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/pos_repeat_order/__init__.py b/pos_repeat_order/__init__.py new file mode 100644 index 000000000..de147080b --- /dev/null +++ b/pos_repeat_order/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Nimisha Muralidhar (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import models diff --git a/pos_repeat_order/__manifest__.py b/pos_repeat_order/__manifest__.py new file mode 100644 index 000000000..712640348 --- /dev/null +++ b/pos_repeat_order/__manifest__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Nimisha Muralidhar (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'POS Reorder', + 'version': '13.0.1.0.0', + 'category': 'Point of Sale', + 'summary': 'Repeat Orders in Previous History', + 'description': 'Repeat Orders in Previous History,Reorder, re order, Repeat order, odoo13, duplicate order', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'images': ['static/description/banner.png'], + 'website': 'https://www.cybrosys.com', + 'depends': ['point_of_sale'], + 'data': ['views/pos_template.xml'], + 'qweb': ['static/src/xml/pos_repeat.xml'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, + +} \ No newline at end of file diff --git a/pos_repeat_order/doc/RELEASE_NOTES.md b/pos_repeat_order/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..e43ced1cc --- /dev/null +++ b/pos_repeat_order/doc/RELEASE_NOTES.md @@ -0,0 +1,9 @@ +## Module + +#### 10.01.2020 +#### Version 13.0.1.0.0 +#### ADD +Initial commit for Repeat Order in POS + + + diff --git a/pos_repeat_order/models/__init__.py b/pos_repeat_order/models/__init__.py new file mode 100644 index 000000000..614166fd0 --- /dev/null +++ b/pos_repeat_order/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Nimisha Muralidhar (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import pos_repeat diff --git a/pos_repeat_order/models/pos_repeat.py b/pos_repeat_order/models/pos_repeat.py new file mode 100644 index 000000000..f98932411 --- /dev/null +++ b/pos_repeat_order/models/pos_repeat.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author: Nimisha Muralidhar (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import models, api, fields + + +class PosRepeatOrder(models.Model): + _inherit = 'pos.order' + + @api.model + def get_lines(self, ref): + """To get the values of the corresponding order""" + result = [] + order_id = self.search([('pos_reference', '=', ref)], limit=1) + if order_id: + lines = self.env['pos.order.line'].search([('order_id', '=', order_id.id)]) + for line in lines: + new_vals = { + 'product_id': line.product_id.id, + 'product': line.product_id.name, + 'qty': 1, + 'price_unit': line.price_unit, + 'discount': line.discount, + 'line_id': line.id, + } + result.append(new_vals) + + return [result] diff --git a/pos_repeat_order/static/description/banner.png b/pos_repeat_order/static/description/banner.png new file mode 100644 index 000000000..6accfc31a Binary files /dev/null and b/pos_repeat_order/static/description/banner.png differ diff --git a/pos_repeat_order/static/description/icon.png b/pos_repeat_order/static/description/icon.png new file mode 100644 index 000000000..63fcfd66f Binary files /dev/null and b/pos_repeat_order/static/description/icon.png differ diff --git a/pos_repeat_order/static/description/images/banner_barcode_scanning.jpeg b/pos_repeat_order/static/description/images/banner_barcode_scanning.jpeg new file mode 100644 index 000000000..529143e4e Binary files /dev/null and b/pos_repeat_order/static/description/images/banner_barcode_scanning.jpeg differ diff --git a/pos_repeat_order/static/description/images/banner_currency_total.png b/pos_repeat_order/static/description/images/banner_currency_total.png new file mode 100644 index 000000000..6153ed719 Binary files /dev/null and b/pos_repeat_order/static/description/images/banner_currency_total.png differ diff --git a/pos_repeat_order/static/description/images/banner_customer_sequence.jpeg b/pos_repeat_order/static/description/images/banner_customer_sequence.jpeg new file mode 100644 index 000000000..7451342d6 Binary files /dev/null and b/pos_repeat_order/static/description/images/banner_customer_sequence.jpeg differ diff --git a/pos_repeat_order/static/description/images/banner_previous_rates.jpeg b/pos_repeat_order/static/description/images/banner_previous_rates.jpeg new file mode 100644 index 000000000..e10c28799 Binary files /dev/null and b/pos_repeat_order/static/description/images/banner_previous_rates.jpeg differ diff --git a/pos_repeat_order/static/description/images/banner_product_branding.png b/pos_repeat_order/static/description/images/banner_product_branding.png new file mode 100644 index 000000000..aa12beabb Binary files /dev/null and b/pos_repeat_order/static/description/images/banner_product_branding.png differ diff --git a/pos_repeat_order/static/description/images/banner_product_expiry.jpeg b/pos_repeat_order/static/description/images/banner_product_expiry.jpeg new file mode 100644 index 000000000..84a872d44 Binary files /dev/null and b/pos_repeat_order/static/description/images/banner_product_expiry.jpeg differ diff --git a/pos_repeat_order/static/description/images/button_orders.png b/pos_repeat_order/static/description/images/button_orders.png new file mode 100644 index 000000000..1db050118 Binary files /dev/null and b/pos_repeat_order/static/description/images/button_orders.png differ diff --git a/pos_repeat_order/static/description/images/checked.png b/pos_repeat_order/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/pos_repeat_order/static/description/images/checked.png differ diff --git a/pos_repeat_order/static/description/images/cybrosys.png b/pos_repeat_order/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/pos_repeat_order/static/description/images/cybrosys.png differ diff --git a/pos_repeat_order/static/description/images/orders_view.png b/pos_repeat_order/static/description/images/orders_view.png new file mode 100644 index 000000000..f12e06b55 Binary files /dev/null and b/pos_repeat_order/static/description/images/orders_view.png differ diff --git a/pos_repeat_order/static/description/images/orders_view_1.png b/pos_repeat_order/static/description/images/orders_view_1.png new file mode 100644 index 000000000..6c828a966 Binary files /dev/null and b/pos_repeat_order/static/description/images/orders_view_1.png differ diff --git a/pos_repeat_order/static/description/images/orders_view_2.png b/pos_repeat_order/static/description/images/orders_view_2.png new file mode 100644 index 000000000..38559737d Binary files /dev/null and b/pos_repeat_order/static/description/images/orders_view_2.png differ diff --git a/pos_repeat_order/static/description/images/repeat_order.gif b/pos_repeat_order/static/description/images/repeat_order.gif new file mode 100644 index 000000000..41570eb4a Binary files /dev/null and b/pos_repeat_order/static/description/images/repeat_order.gif differ diff --git a/pos_repeat_order/static/description/images/repeat_order_pop_up.png b/pos_repeat_order/static/description/images/repeat_order_pop_up.png new file mode 100644 index 000000000..b4d4cdff7 Binary files /dev/null and b/pos_repeat_order/static/description/images/repeat_order_pop_up.png differ diff --git a/pos_repeat_order/static/description/images/repeated_order_orderline.png b/pos_repeat_order/static/description/images/repeated_order_orderline.png new file mode 100644 index 000000000..6fbb75629 Binary files /dev/null and b/pos_repeat_order/static/description/images/repeated_order_orderline.png differ diff --git a/pos_repeat_order/static/description/index.html b/pos_repeat_order/static/description/index.html new file mode 100644 index 000000000..428709943 --- /dev/null +++ b/pos_repeat_order/static/description/index.html @@ -0,0 +1,332 @@ +
cybrosys-logo
+
+
+
+

POS Reorder

+

An option to repeat the order in POS.

+
+

Key Highlights

+
    +
  • checkOrders list of selected customer
  • +
+
    +
  • checkRepeat order button for all POS orders
  • +
+
    +
  • checkCan repeat the order with same or different quantity
  • +
+ +
+
+
+
+
+
+
+ +
+
+ +

Overview

+
+

+ This app provides an option to list the orders of selected customer.From the list of orders, on can repeat the order with same or different quantity of products. +

+
+
+ +

Repeat order in POS

+
+
    +
  • + checkOrders button in POS. +
  • + +
  • + checkPOS orders of selected customer will be displayed. +
  • +
  • + checkRepeat order button for orders. +
  • +
  • + checkOne can repeat the order with same or different quantity. +
  • +
  • + checkCorresponding products will be added to the orderline. +
  • +
+
+ +
+
+

Screenshots

+
+
+
+
+
+
+
+ + + + + + + + + + + + + + +
+
    +
+
+
+
+
+
+
+

Suggested Products

+
+ +
+
+

Our Service

+
+ +
+
+
+

Our Industries

+
+ +
+
+
+ +
+
+

Trading

+

Easily procure and sell your products.

+
+
+
+
+ +
+
+

Manufacturing

+

Plan, track and schedule your operations.

+
+
+
+
+ +
+
+

Restaurant

+

Run your bar or restaurant methodical.

+
+
+
+
+ +
+
+

POS

+

Easy configuring and convivial selling.

+
+
+
+
+ +
+
+

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages.

+
+
+
+
+ +
+
+

Hotel Management

+

An all-inclusive hotel management application.

+
+
+
+
+ +
+
+

Education

+

A Collaborative platform for educational management.

+
+
+
+
+ +
+
+

Service Management

+

Keep track of services and invoice accordingly.

+
+
+
+
+
+ +
+
+
+

Need Any Help?

+
+

If you have anything to share with us based on your use of this module, please let us know. We are ready to offer our support.

+
+

Email us

+

odoo@cybrosys.com / info@cybrosys.com

+
+
+

Contact Us

+ www.cybrosys.com +
+
+
+
+
+
+
+
+
+ +
+ + + + + + + +
+
+
+ \ No newline at end of file diff --git a/pos_repeat_order/static/src/css/repeat_order.css b/pos_repeat_order/static/src/css/repeat_order.css new file mode 100644 index 000000000..a24e51044 --- /dev/null +++ b/pos_repeat_order/static/src/css/repeat_order.css @@ -0,0 +1,48 @@ +.repeat-screen .repeat-button { + color: #f0f0f0; + display: inline-block; + box-sizing: border-box; + -moz-box-sizing: border-box; + /* height: 20px; */ + padding: 4px 8px; + margin: 3px; + margin-bottom: 0px; + margin-right: 2px; + padding-top: 0px; + background: #8b8b8b; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + vertical-align: top; + line-height: 20px; + text-align: center; + box-shadow: 0px -5px 10px -6px rgb(82,82,82) inset; + cursor: pointer; + min-width: 45px; +} +.repeat-screen .order-list tr.highlight{ + transition: all 150ms linear; + background: rgb(110,200,155) !important; + color: white; +} +.repeat-screen .order-list td tr.lowlight{ + transition: all 150ms linear; + background: rgb(216, 238, 227); +} +.repeat-screen .order-list tr.lowlight:nth-child(even){ + transition: all 150ms linear; + background: rgb(227, 246, 237); +} + +.repeat-screen .searchbox{ + right: auto; + margin-left: 90px; + margin-top:8px; + left: 50%; +} + + +.repeat-screen .order-list{ + font-size: 15px; + width: 100%; + line-height: 40px; +} \ No newline at end of file diff --git a/pos_repeat_order/static/src/js/pos_repeat.js b/pos_repeat_order/static/src/js/pos_repeat.js new file mode 100644 index 000000000..811ba3c8b --- /dev/null +++ b/pos_repeat_order/static/src/js/pos_repeat.js @@ -0,0 +1,281 @@ + +odoo.define('pos_repeat_order.repeat',function(require) { + "use strict"; + +var models = require('point_of_sale.models'); +var screens = require('point_of_sale.screens'); +var gui = require('point_of_sale.gui'); +var core = require('web.core'); +var QWeb = core.qweb; +var PopupWidget = require('point_of_sale.popups'); +var rpc = require('web.rpc'); +var _t = require('web.core')._t; +var session = require('web.session'); + +models.load_models({ + model: 'pos.order', + fields: ['name', 'partner_id','date_order','amount_total', 'amount_tax', + 'pos_reference','lines','state','session_id','company_id'], + loaded: function(self, orders){ + self.orders = orders; + } + }); + + var RepeatButton = screens.ActionButtonWidget.extend({ + template: 'RepeatButton', + button_click: function(){ + var orders = this.pos.orders; + this.gui.show_screen('orderlist',{orders:orders}); + + } +}); +screens.ProductScreenWidget.include({ + start: function(){ + this._super(); + this.coupons = new RepeatButton(this,{}); + this.coupons.replace(this.$('.placeholder-RepeatButton')); + }, + button_click: function(){ + var orders = this.pos.orders; + + } +}); + + +var RepeatWidget = PopupWidget.extend({ + template:'RepeatWidget', + + init: function(parent, options){ + this._super(parent, options); + this.options = {}; + this.pos_reference = ""; + + }, + show: function(options){ + this._super(options); + this.render_list(options); + + }, + events: { + 'click .button.cancel': 'click_cancel', + 'click .button.confirm': 'click_confirm', + }, + render_list:function(options){ + $("#table-body").empty(); + var lines = []; + this.pos_reference = options.ref + rpc.query({ + model: 'pos.order', + method: 'get_lines', + args: [options.ref], + }).then(function (result) { + lines = result[0]; + for(var j=0;j < lines.length; j++){ + var product_line = lines[j]; + var rows = ""; + var id = product_line.product_id + var price_unit = product_line.price_unit; + var name =product_line.product; + var qty = product_line.qty; + var line_id = product_line.line_id; + var discount = product_line.discount; + rows += "" + id + "" + price_unit +" " + name + "" + qty + "" + discount + ""; + $(rows).appendTo("#list tbody"); + var rows = document.getElementById('list').rows; + for (var row = 0; row < rows.length; row++) { + var cols = rows[row].cells; + cols[0].style.display = 'none'; + cols[1].style.display = 'none'; + cols[5].style.display = 'none'; + + } + + } + var table = document.getElementById('list'); + var tr = table.getElementsByTagName("tr"); + for (var i = 1; i < tr.length; i++) { + var td = document.createElement('td'); + var input = document.createElement('input'); + input.setAttribute("type", "text"); + input.setAttribute("value", 0); + input.setAttribute("id", "text"+i); + td.appendChild(input); + tr[i].appendChild(td); + + } + }).catch(function () { + alert("NO DATA") + }); + }, + click_confirm: function(){ + console.log("vonfirm") + var self = this; + var myTable = document.getElementById('list').tBodies[0]; + var count = 0; + var c = 1; + + for (r=0, n = myTable.rows.length; r < n; r++) { + var row = myTable.rows[r] + var ordered_qty = document.getElementById("text"+c).value + if (row.cells[3].innerHTML < ordered_qty){ + count +=1 + } + c = c+1 + } + c = 1; + // OrderSuper.prototype.set_client.call(this, this.client); + for (var r=0, n = myTable.rows.length; r < n; r++) { + row = myTable.rows[r] + ordered_qty = document.getElementById("text"+c).value; + var product = this.pos.db.get_product_by_id(row.cells[0].innerHTML); + if (!product) { + return; + } + + if (ordered_qty > 0){ + this.pos.get_order().add_product(product, { + price: row.cells[1].innerHTML, + quantity: (ordered_qty), + discount:row.cells[4].innerHTML, + merge: false, + + }); + + } + c = c+1 + + if (this.options.client){ + this.pos.get_order().set_client(self.pos.db.get_partner_by_id(this.options.client)); + } + + } + + this.gui.close_popup(); + self.gui.show_screen('products'); + + }, + click_cancel: function(){ + this.gui.close_popup(); + + } + +}); +gui.define_popup({name:'RepeatWidget', widget: RepeatWidget}); +var OrderListScreenWidget = screens.ScreenWidget.extend({ + template:'OrderListScreenWidget', + init: function(parent, options){ + this._super(parent, options); + }, + show: function(){ + var self = this; + this._super(); + this.renderElement(); + this.$('.back').click(function(){ + self.gui.back(); + }); + var orders = this.pos.orders; + this.render_list(orders); + var search_timeout = null; + this.$('.searchbox input').on('keypress',function(event){ + clearTimeout(search_timeout); + + var searchbox = this; + + search_timeout = setTimeout(function(){ + self.perform_search(searchbox.value, event.which === 13); + },70); + }); + + this.$('.searchbox .search-clear').click(function(){ + self.clear_search(); + }); + this.$('.repeat_order').click(function(e){ + var order = $(e.target).closest("tr").data('id'); + self.repeat_order(order); + }); + }, + + hide: function () { + this._super(); + }, + get_orders: function(){ + return this.gui.get_current_screen_param('orders'); + }, + perform_search: function(query, associate_result){ + var orders; + if(query){ + orders = this.search_order(query); + this.render_list(orders); + }else{ + orders = this.pos.orders; + this.render_list(orders); + } + }, + search_order: function(query){ + try { + var re = RegExp(query, 'i'); + }catch(e){ + return []; + } + var results = []; + for (var order_id in this.pos.orders){ + var r = re.exec(this.pos.orders[order_id]['name']+ '|'+ this.pos.orders[order_id]['partner_id'][1]); + if(r){ + results.push(this.pos.orders[order_id]); + } + } + return results; + }, + clear_search: function(){ + var orders = this.pos.orders; + this.render_list(orders); + this.$('.searchbox input')[0].value = ''; + this.$('.searchbox input').focus(); + }, + render_list: function(orders){ + var contents = this.$el[0].querySelector('.order-list-contents'); + contents.innerHTML = ""; + if (this.pos.get_client()) + { + for(var i = 0, len = Math.min(orders.length,1000); i < len; i++){ + if(orders[i].partner_id[0] == this.pos.get_client().id){ + var order = orders[i]; + var orderline_html = QWeb.render('OrderLine',{widget: this, order:order}); + var orderline = document.createElement('tbody'); + orderline.innerHTML = orderline_html; + orderline = orderline.childNodes[1]; + contents.appendChild(orderline); + } + } + } + else{ alert("Please select a customer") } + + }, + repeat_order:function(order_id){ + var self = this; + var order = this.get_order_by_id(order_id); + var client = '' + if (order.partner_id){ + client = order.partner_id[0]; + self.gui.show_popup('RepeatWidget',{ref: order.pos_reference,client:client}); + } + + + }, + get_order_by_id: function(id){ + var orders = this.pos.orders; + for (var i in orders){ + if (orders[i].id === id){ + console.log("orders[i]",orders[i]) + return orders[i]; + } + } + + } + }); +gui.define_screen({name:'orderlist', widget: OrderListScreenWidget}); + +}); + + + diff --git a/pos_repeat_order/static/src/xml/pos_repeat.xml b/pos_repeat_order/static/src/xml/pos_repeat.xml new file mode 100644 index 000000000..506ad862a --- /dev/null +++ b/pos_repeat_order/static/src/xml/pos_repeat.xml @@ -0,0 +1,101 @@ + + + + + +
+ +Orders + +
+
+ + +
+
+
+ + + + + + + + + + + +
+
+
+ + + Cancel + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + +
Order RefPartnerDate
+
+
+
+
+
+
+
+
+ + + + +
+ diff --git a/pos_repeat_order/views/pos_template.xml b/pos_repeat_order/views/pos_template.xml new file mode 100644 index 000000000..c47a0465e --- /dev/null +++ b/pos_repeat_order/views/pos_template.xml @@ -0,0 +1,13 @@ + + + +