diff --git a/pos_debt_notebook_sync/README.rst b/pos_debt_notebook_sync/README.rst new file mode 100644 index 0000000000..62ccd50735 --- /dev/null +++ b/pos_debt_notebook_sync/README.rst @@ -0,0 +1,30 @@ +.. image:: https://itpp.dev/images/infinity-readme.png + :alt: Tested and maintained by IT Projects Labs + :target: https://itpp.dev + +.. image:: https://img.shields.io/badge/license-MIT-blue.svg + :target: https://opensource.org/licenses/MIT + :alt: License: MIT + +======================== + Internal Credit System +======================== + +The module allows to organize cash-free system for set of shops with a single payment point. E.g. at festivals, amusements parks, etc. + +Questions? +========== + +To get an assistance on this module contact us by email :arrow_right: help@itpp.dev + +Contributors +============ +* `Dinar Gabbasov `__ +* `Kolushov Alexandr `__ + +=================== + +Odoo Apps Store: https://apps.odoo.com/apps/modules/12.0/pos_debt_notebook_sync/ + + +Tested on `Odoo 13.0 `_ diff --git a/pos_debt_notebook_sync/__init__.py b/pos_debt_notebook_sync/__init__.py new file mode 100644 index 0000000000..d4e2b5cfc4 --- /dev/null +++ b/pos_debt_notebook_sync/__init__.py @@ -0,0 +1,4 @@ +# License MIT (https://opensource.org/licenses/MIT). + +from . import models +from . import controllers diff --git a/pos_debt_notebook_sync/__manifest__.py b/pos_debt_notebook_sync/__manifest__.py new file mode 100644 index 0000000000..0bf5867b9c --- /dev/null +++ b/pos_debt_notebook_sync/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright 2017 Ivan Yelizariev +# Copyright 2018 Kolushov Alexandr +# Copyright 2021 Denis Mudarisov +# License MIT (https://opensource.org/licenses/MIT). +{ + "name": """Internal Credit System""", + "summary": """Credit payment system for festivals, food courts, etc.""", + "category": "Point of Sale", + "images": ["images/credit.png"], + "version": "13.0.1.1.2", + "application": False, + "author": "IT-Projects LLC, Dinar Gabbasov", + "support": "apps@itpp.dev", + "website": "https://apps.odoo.com/apps/modules/13.0/pos_debt_notebook_sync/", + "license": "Other OSI approved licence", # MIT + "depends": ["base_automation", "pos_longpolling", "pos_debt_notebook"], + "external_dependencies": {"python": [], "bin": []}, + "data": ["views/template.xml", "data/base_action_rule.xml"], + "qweb": [], + "demo": [], + "post_load": None, + "pre_init_hook": None, + "post_init_hook": None, + "auto_install": False, + "installable": True, +} diff --git a/pos_debt_notebook_sync/controllers/__init__.py b/pos_debt_notebook_sync/controllers/__init__.py new file mode 100644 index 0000000000..fc2b55bc42 --- /dev/null +++ b/pos_debt_notebook_sync/controllers/__init__.py @@ -0,0 +1,3 @@ +# License MIT (https://opensource.org/licenses/MIT). + +from . import pos_debt_sync_controller diff --git a/pos_debt_notebook_sync/controllers/pos_debt_sync_controller.py b/pos_debt_notebook_sync/controllers/pos_debt_sync_controller.py new file mode 100644 index 0000000000..a17ad44690 --- /dev/null +++ b/pos_debt_notebook_sync/controllers/pos_debt_sync_controller.py @@ -0,0 +1,19 @@ +# Copyright 2017 Ivan Yelizariev +# Copyright 2018 Kolushov Alexandr +# License MIT (https://opensource.org/licenses/MIT). + +import odoo +from odoo.http import request + +try: + from odoo.addons.bus.controllers.main import BusController +except ImportError: + BusController = object + + +class Controller(BusController): + @odoo.http.route("/pos_order_test/update", type="json", auth="public") + def order_test_update(self, message): + channel_name = "pos.order_test" + res = request.env["pos.config"]._send_to_channel(channel_name, message) + return res diff --git a/pos_debt_notebook_sync/data/base_action_rule.xml b/pos_debt_notebook_sync/data/base_action_rule.xml new file mode 100644 index 0000000000..1d32eed8c0 --- /dev/null +++ b/pos_debt_notebook_sync/data/base_action_rule.xml @@ -0,0 +1,55 @@ + + + + + + Notify POS about Debt updates (on new payment). + + on_create + + [('statement_id.journal_id.debt', '=', True)] + + + code + action = env['pos.config'].notify_debt_updates() + + + + + Notify POS about Debt updates (on selling Credit products). + + + on_create_or_write + [('state', 'in', ['paid', 'done'])] + + code + env['pos.config'].notify_debt_updates() + + + + + Notify POS about Debt updates (on selling Credit products via invoices). + + + on_create_or_write + + code + [('invoice_payment_state', 'in', ['paid'])] + env['pos.config'].notify_debt_updates() + + + + + Notify POS about Debt updates (on addins Manual Credit Updates). + + + on_create_or_write + + code + env['pos.config'].notify_debt_updates() + + diff --git a/pos_debt_notebook_sync/doc/changelog.rst b/pos_debt_notebook_sync/doc/changelog.rst new file mode 100644 index 0000000000..32744eafd2 --- /dev/null +++ b/pos_debt_notebook_sync/doc/changelog.rst @@ -0,0 +1,19 @@ +`1.1.2` +------- + +- **FIX:** Error related to not selected partner on the client screen + +`1.1.1` +------- + +- **FIX:** Endless update requests on the customer screen after renamings in pos_longpolling + +`1.1.0` +------- + +- **ADD:** Manual Credit Updates + +`1.0.0` +------- + +- Init version diff --git a/pos_debt_notebook_sync/doc/index.rst b/pos_debt_notebook_sync/doc/index.rst new file mode 100644 index 0000000000..4c7fac7432 --- /dev/null +++ b/pos_debt_notebook_sync/doc/index.rst @@ -0,0 +1,73 @@ +======================== + Internal Credit System +======================== + +Installation +============ + +* Check instruction for `POS longpolling `_ about activating longpolling +* You probably need a module that force user to login before making purchase on website. E.g. this one: https://github.com/OCA/e-commerce/tree/13.0/website_sale_require_login + +Configuration +============= + +Max Debt Limit +-------------- + +* Go to ``Point of Sale >> Configuration >> Payment Methods`` +* Open one of the ``Payment methods`` +* Open journal form (e.g. ``Credits``) + * go inside Cash Journal + * click on ``[Edit]`` + * On ``Point of Sale`` tab check the box ``Credit Journal`` + * set ``Max Debt`` value + * click ``[Save]`` + +POS Payment +----------- + +* Go to ``Point of Sale >> Configuration >> Point of Sale`` + + * open POS + * select ``Available Payment Methods`` + + * ``Debt Journal`` if POS will operate with credits only + * e.g. ``Cash`` or ``Bank`` if POS may receive a real money + * set both if POS is used to operate with credits and real money + +Credit Product +-------------- + +* go to ``Point of Sale >> Products`` + + * click on ``[Create]`` + * open ``Point of Sale`` tab + * select an available journal in ``Journal Credit Product`` field + * click ``[Save]`` + +Usage +===== + +POS sales +--------- + +* open one POS +* open another POS as another user +* on the first POS: + + * select customer + * EITHER add *Credit Product* to an order and register usual payment (e.g. via Cash journal) + * OR add usual products and register Debt payment. See `Debt notebook module `_ for more information. + * click ``[Validate]`` + +* on second POS + + * open Customer list + * find the customer + * customer's debt/credit is updated + +eCommerce sales +--------------- +* open POS +* purchase *Credit Product* via website (``/shop/...``) +* debt/credit value on POS is updated diff --git a/pos_debt_notebook_sync/i18n/de.po b/pos_debt_notebook_sync/i18n/de.po new file mode 100644 index 0000000000..54d4939a42 --- /dev/null +++ b/pos_debt_notebook_sync/i18n/de.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_debt_notebook_sync +# +# Translators: +# Ermin Trevisan , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-10-14 10:52+0000\n" +"PO-Revision-Date: 2017-10-14 10:52+0000\n" +"Last-Translator: Ermin Trevisan , 2017\n" +"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/" +"de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_pos_credit_updates +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_pos_credit_updates_ir_actions_server +#, fuzzy +msgid "Notify POS about Debt updates (on addins Manual Credit Updates)." +msgstr "POS über Schuldaktualisierungen benachrichtigen" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_new_payment +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_new_payment_ir_actions_server +#, fuzzy +msgid "Notify POS about Debt updates (on new payment)." +msgstr "POS über Schuldaktualisierungen benachrichtigen" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_credit_products_invoice +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_credit_products_invoice_ir_actions_server +msgid "" +"Notify POS about Debt updates (on selling Credit products via invoices)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_credit_products +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_credit_products_ir_actions_server +#, fuzzy +msgid "Notify POS about Debt updates (on selling Credit products)." +msgstr "POS über Schuldaktualisierungen benachrichtigen" + +#. module: pos_debt_notebook_sync +#: model:ir.model,name:pos_debt_notebook_sync.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#~ msgid "Debt payments" +#~ msgstr "Schuldzahlung" + +#~ msgid "Finished orders" +#~ msgstr "Erledigte Bestellungen" + +#~ msgid "Paid invoices" +#~ msgstr "Bezahlte Rechnungen" + +#~ msgid "pos.config" +#~ msgstr "pos.config" diff --git a/pos_debt_notebook_sync/i18n/es.po b/pos_debt_notebook_sync/i18n/es.po new file mode 100644 index 0000000000..c98eda15a7 --- /dev/null +++ b/pos_debt_notebook_sync/i18n/es.po @@ -0,0 +1,65 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_debt_notebook_sync +# +# Translators: +# Gustavo Valverde , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-09-30 15:22+0000\n" +"PO-Revision-Date: 2017-09-30 15:22+0000\n" +"Last-Translator: Gustavo Valverde , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/it-projects-llc/" +"teams/76080/es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_pos_credit_updates +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_pos_credit_updates_ir_actions_server +#, fuzzy +msgid "Notify POS about Debt updates (on addins Manual Credit Updates)." +msgstr "Notificarle al TPV sobre actualización de Créditos" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_new_payment +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_new_payment_ir_actions_server +#, fuzzy +msgid "Notify POS about Debt updates (on new payment)." +msgstr "Notificarle al TPV sobre actualización de Créditos" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_credit_products_invoice +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_credit_products_invoice_ir_actions_server +msgid "" +"Notify POS about Debt updates (on selling Credit products via invoices)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_credit_products +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_credit_products_ir_actions_server +#, fuzzy +msgid "Notify POS about Debt updates (on selling Credit products)." +msgstr "Notificarle al TPV sobre actualización de Créditos" + +#. module: pos_debt_notebook_sync +#: model:ir.model,name:pos_debt_notebook_sync.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#~ msgid "Debt payments" +#~ msgstr "Pagos a Crédito" + +#~ msgid "Finished orders" +#~ msgstr "Órdenes Finalizadas" + +#~ msgid "Paid invoices" +#~ msgstr "Facturas pagadas" + +#~ msgid "pos.config" +#~ msgstr "pos.config" diff --git a/pos_debt_notebook_sync/i18n/pos_debt_notebook_sync.pot b/pos_debt_notebook_sync/i18n/pos_debt_notebook_sync.pot new file mode 100644 index 0000000000..de436a8b2f --- /dev/null +++ b/pos_debt_notebook_sync/i18n/pos_debt_notebook_sync.pot @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_debt_notebook_sync +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_pos_credit_updates +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_pos_credit_updates_ir_actions_server +msgid "Notify POS about Debt updates (on addins Manual Credit Updates)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_new_payment +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_new_payment_ir_actions_server +msgid "Notify POS about Debt updates (on new payment)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_credit_products_invoice +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_credit_products_invoice_ir_actions_server +msgid "Notify POS about Debt updates (on selling Credit products via invoices)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_credit_products +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_credit_products_ir_actions_server +msgid "Notify POS about Debt updates (on selling Credit products)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:ir.model,name:pos_debt_notebook_sync.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + diff --git a/pos_debt_notebook_sync/i18n/ru.po b/pos_debt_notebook_sync/i18n/ru.po new file mode 100644 index 0000000000..c054969b2d --- /dev/null +++ b/pos_debt_notebook_sync/i18n/ru.po @@ -0,0 +1,55 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_debt_notebook_sync +# +# Translators: +# Dinar , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-24 09:02+0000\n" +"PO-Revision-Date: 2017-11-24 09:02+0000\n" +"Last-Translator: Dinar , 2017\n" +"Language-Team: Russian (https://www.transifex.com/it-projects-llc/" +"teams/76080/ru/)\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" +"%100>=11 && n%100<=14)? 2 : 3);\n" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_pos_credit_updates +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_pos_credit_updates_ir_actions_server +msgid "Notify POS about Debt updates (on addins Manual Credit Updates)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_new_payment +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_new_payment_ir_actions_server +msgid "Notify POS about Debt updates (on new payment)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_credit_products_invoice +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_credit_products_invoice_ir_actions_server +msgid "" +"Notify POS about Debt updates (on selling Credit products via invoices)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:base.automation,name:pos_debt_notebook_sync.rule_credit_products +#: model:ir.actions.server,name:pos_debt_notebook_sync.rule_credit_products_ir_actions_server +msgid "Notify POS about Debt updates (on selling Credit products)." +msgstr "" + +#. module: pos_debt_notebook_sync +#: model:ir.model,name:pos_debt_notebook_sync.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#~ msgid "pos.config" +#~ msgstr "pos.config" diff --git a/pos_debt_notebook_sync/images/credit.png b/pos_debt_notebook_sync/images/credit.png new file mode 100644 index 0000000000..4d73507b5b Binary files /dev/null and b/pos_debt_notebook_sync/images/credit.png differ diff --git a/pos_debt_notebook_sync/models/__init__.py b/pos_debt_notebook_sync/models/__init__.py new file mode 100644 index 0000000000..363abe9fe3 --- /dev/null +++ b/pos_debt_notebook_sync/models/__init__.py @@ -0,0 +1,2 @@ +# License MIT (https://opensource.org/licenses/MIT). +from . import pos_config diff --git a/pos_debt_notebook_sync/models/pos_config.py b/pos_debt_notebook_sync/models/pos_config.py new file mode 100644 index 0000000000..1294ca470a --- /dev/null +++ b/pos_debt_notebook_sync/models/pos_config.py @@ -0,0 +1,37 @@ +# Copyright 2017 Ivan Yelizariev +# License MIT (https://opensource.org/licenses/MIT). + +from odoo import api, models + +CHANNEL = "pos_debt_notebook_sync" + + +class PosConfig(models.Model): + _inherit = "pos.config" + + # ir.actions.server methods: + @api.model + def notify_debt_updates(self): + model = self.env.context["active_model"] + ids = self.env.context["active_ids"] + records = self.env[model].sudo().browse(ids) + + partners = None + if model == "account.bank.statement.line": + partners = records.mapped(lambda r: r.pos_statement_id.partner_id) + elif model == "pos.order": + partners = records.filtered( + lambda r: r.state in ["paid", "done"] + and any(line.product_id.credit_product for line in r.lines) + ).mapped(lambda r: r.partner_id) + elif model == "account.invoice": + partners = records.filtered( + lambda r: r.state in ["paid"] + and any(line.product_id.credit_product for line in r.invoice_line_ids) + ).mapped(lambda r: r.partner_id) + elif model == "pos.credit.update": + partners = records.mapped(lambda r: r.partner_id) + + if partners: + message = {"updated_partners": partners.ids} + self.search([])._send_to_channel(CHANNEL, message) diff --git a/pos_debt_notebook_sync/static/description/balance_report.png b/pos_debt_notebook_sync/static/description/balance_report.png new file mode 100644 index 0000000000..4f22a5a5dc Binary files /dev/null and b/pos_debt_notebook_sync/static/description/balance_report.png differ diff --git a/pos_debt_notebook_sync/static/description/credit_product.png b/pos_debt_notebook_sync/static/description/credit_product.png new file mode 100644 index 0000000000..0573287457 Binary files /dev/null and b/pos_debt_notebook_sync/static/description/credit_product.png differ diff --git a/pos_debt_notebook_sync/static/description/credit_report-1.png b/pos_debt_notebook_sync/static/description/credit_report-1.png new file mode 100644 index 0000000000..05ee0f3a03 Binary files /dev/null and b/pos_debt_notebook_sync/static/description/credit_report-1.png differ diff --git a/pos_debt_notebook_sync/static/description/credit_report-2.png b/pos_debt_notebook_sync/static/description/credit_report-2.png new file mode 100644 index 0000000000..5fc667fb3a Binary files /dev/null and b/pos_debt_notebook_sync/static/description/credit_report-2.png differ diff --git a/pos_debt_notebook_sync/static/description/credit_report.png b/pos_debt_notebook_sync/static/description/credit_report.png new file mode 100644 index 0000000000..68519f1b90 Binary files /dev/null and b/pos_debt_notebook_sync/static/description/credit_report.png differ diff --git a/pos_debt_notebook_sync/static/description/credit_web.png b/pos_debt_notebook_sync/static/description/credit_web.png new file mode 100644 index 0000000000..8cb89479fa Binary files /dev/null and b/pos_debt_notebook_sync/static/description/credit_web.png differ diff --git a/pos_debt_notebook_sync/static/description/customer_balance.png b/pos_debt_notebook_sync/static/description/customer_balance.png new file mode 100644 index 0000000000..97be257059 Binary files /dev/null and b/pos_debt_notebook_sync/static/description/customer_balance.png differ diff --git a/pos_debt_notebook_sync/static/description/debt_history-1.png b/pos_debt_notebook_sync/static/description/debt_history-1.png new file mode 100644 index 0000000000..9d2f652174 Binary files /dev/null and b/pos_debt_notebook_sync/static/description/debt_history-1.png differ diff --git a/pos_debt_notebook_sync/static/description/debt_history.png b/pos_debt_notebook_sync/static/description/debt_history.png new file mode 100644 index 0000000000..6a92c0f2f5 Binary files /dev/null and b/pos_debt_notebook_sync/static/description/debt_history.png differ diff --git a/pos_debt_notebook_sync/static/description/fest.jpg b/pos_debt_notebook_sync/static/description/fest.jpg new file mode 100644 index 0000000000..834e5302ea Binary files /dev/null and b/pos_debt_notebook_sync/static/description/fest.jpg differ diff --git a/pos_debt_notebook_sync/static/description/icon.png b/pos_debt_notebook_sync/static/description/icon.png new file mode 100644 index 0000000000..33d2ad0b5f Binary files /dev/null and b/pos_debt_notebook_sync/static/description/icon.png differ diff --git a/pos_debt_notebook_sync/static/description/index.html b/pos_debt_notebook_sync/static/description/index.html new file mode 100644 index 0000000000..51369e1aa3 --- /dev/null +++ b/pos_debt_notebook_sync/static/description/index.html @@ -0,0 +1,215 @@ +
+
+
+

Internal Credit System

+

Organize your cash-free system for set of shops with a single payment point. E.g. at festivals, amusements parks, etc.

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

How it works

+
+ +

CASH-FREE

+

+ Use Credits to simplify multiple payment operations +

+
+
+ +

EASY CONTROL

+

+ Make easy a control under the customer balances +

+
+
+ +

SYNCHRONIZE

+

+ Synchronize the customer credit details across multiple POSes +

+
+
+ +

ANALYSIS AND REPORT

+

+ Analyze and review all customer credit transactions. +

+
+
+
+ +
+
+

Max Debt Limit

+
+

+ Step 1. Use the Max Debt Limit setting to specify should customers have to pay in advance (Max Debt = 0) or they allowed to pay later (Max Debt > 0). You can also specify different settings for different customers. +

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

POS Payment Settings

+
+
+ +
+
+
+

+ Step 2. Specify which POSes can accept real-money Payments (cash, bank cards etc) and which ones can register usage of internal-money ("Credits") only. Note, that POS may be allowed to do both. +

+
+
+
+ +
+
+

Customer Identification

+
+

+ Step 3. Take care about device to create and scan customer card. It can be RFID-chip based system or simple barcode based system. +

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

Credits via E-commerce

+
+
+ +
+
+
+

+ Step 4. (Optional) Create "Credit" products as predefined prepayment value (e.g. 20$, 100$, etc). Also, it allows customers to make advance payment via Odoo eCommerce system. +

+
+
+

+ DONE! System is ready! Whenever customer purchase goods or make a deposit, all POSes receive updated customer balance instantly. +

+
+
+
+ +
+
+

Customer Debt/Credit History

+
+

+ See all client debt/credit history from POS interface directly. +

+
+ +
+

+ +

+
+ +
+
+
+
+ +
+
+

Reports. Age Analysis.

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

+ For further information check Documentation tab, description of Debt Notebook module or contact us as described below. +

+
+
+
+ +
+ +
+
+
+

Need our service?

+

Contact us by email or fill out request form

+ +
+
+
+
+ Tested on Odoo
10.0 community +
+
+ Tested on Odoo
10.0 enterprise +
+
+
+
+
diff --git a/pos_debt_notebook_sync/static/description/max_debt.png b/pos_debt_notebook_sync/static/description/max_debt.png new file mode 100644 index 0000000000..fbd0ff7e54 Binary files /dev/null and b/pos_debt_notebook_sync/static/description/max_debt.png differ diff --git a/pos_debt_notebook_sync/static/description/payment.png b/pos_debt_notebook_sync/static/description/payment.png new file mode 100644 index 0000000000..1665a3dd2f Binary files /dev/null and b/pos_debt_notebook_sync/static/description/payment.png differ diff --git a/pos_debt_notebook_sync/static/description/rfid.gif b/pos_debt_notebook_sync/static/description/rfid.gif new file mode 100644 index 0000000000..7f01d2eb20 Binary files /dev/null and b/pos_debt_notebook_sync/static/description/rfid.gif differ diff --git a/pos_debt_notebook_sync/static/description/sync_pos.png b/pos_debt_notebook_sync/static/description/sync_pos.png new file mode 100644 index 0000000000..f7c69700aa Binary files /dev/null and b/pos_debt_notebook_sync/static/description/sync_pos.png differ diff --git a/pos_debt_notebook_sync/static/src/js/sync.js b/pos_debt_notebook_sync/static/src/js/sync.js new file mode 100644 index 0000000000..b0d0e40a5d --- /dev/null +++ b/pos_debt_notebook_sync/static/src/js/sync.js @@ -0,0 +1,109 @@ +// # Copyright 2017 Ivan Yelizariev +// # License MIT (https://opensource.org/licenses/MIT). + +odoo.define("pos_debt_sync", function (require) { + "use strict"; + var models = require("point_of_sale.models"); + require("pos_longpolling.pos"); + var PosModelSuper = models.PosModel; + models.PosModel = models.PosModel.extend({ + initialize: function () { + PosModelSuper.prototype.initialize.apply(this, arguments); + var self = this; + this.bus.add_channel_callback( + "pos_debt_notebook_sync", + this.on_debt_updates, + this + ); + // Poll connection handlers + this.ready.then(function () { + var longpolling_connection = (self.sync_bus || self.bus) + .longpolling_connection; + // Reload_debts request passed, but longpoll is offline + self.on( + "updateDebtHistory", + function (partner_ids) { + if (!longpolling_connection.is_online) { + longpolling_connection.send_ping(); + } + }, + self + ); + // Reload_debts request haven't passed, but longpoll is online + self.on( + "updateDebtHistoryFail", + function () { + if (longpolling_connection.is_online) { + longpolling_connection.send_ping(); + } + }, + self + ); + // Poll_connection is changed, and longpoll status is online now + longpolling_connection.on( + "change:poll_connection", + function (status) { + if (status) { + self.after_restoring_connection(); + } + }, + self + ); + }); + }, + on_debt_updates: function (message) { + this.reload_debts(message.updated_partners); + }, + _on_load_debts: function (debts) { + var unsent_orders = _.filter(this.db.get_orders(), function (o) { + return o.data.updates_debt; + }); + if (unsent_orders) { + // Since unsent orders are presented it means that connection was recently restored, + // request for updating data of offline order partners will be sent right after offline orders is pushed. + // To prevent incorrect debt rendering we delete the partner data come from the server before offline orders were sent + + var offline_order_partners = _.map(unsent_orders, function (o) { + return o.data.partner_id; + }); + debts = _.filter(debts, function (deb) { + return !_.contains(offline_order_partners, deb.partner_id); + }); + } + PosModelSuper.prototype._on_load_debts.apply(this, [debts]); + }, + after_restoring_connection: function () { + var self = this; + var partners_to_reload = []; + _.each(this.get_order_list(), function (o) { + if (o.get_client()) { + partners_to_reload.push(o.get_client().id); + } + }); + _.each(this.db.get_orders(), function (o) { + if (o.data.updates_debt && o.data.partner_id) { + partners_to_reload.push(o.data.partner_id); + } + }); + var client_list_screen = this.gui.screen_instances.clientlist; + var partner = false; + if ( + client_list_screen && + client_list_screen.clientlist_screen_is_opened() + ) { + partner = + client_list_screen.new_client || + client_list_screen.pos.get_client(); + if (partner) { + partners_to_reload.push(partner.id); + } + } + + this.push_order(null, {show_error: true}).then(function () { + if (partners_to_reload.length) { + self.reload_debts(_.uniq(partners_to_reload), 0, {shadow: false}); + } + }); + }, + }); +}); diff --git a/pos_debt_notebook_sync/static/src/js/tour.js b/pos_debt_notebook_sync/static/src/js/tour.js new file mode 100644 index 0000000000..6dbe50a346 --- /dev/null +++ b/pos_debt_notebook_sync/static/src/js/tour.js @@ -0,0 +1,131 @@ +// License MIT (https://opensource.org/licenses/MIT). +odoo.define("pos_debt_notebook_sync.tour", function (require) { + "use strict"; + + var tour = require("web_tour.tour"); + var core = require("web.core"); + var _t = core._t; + + function open_pos_neworder() { + return [ + tour.STEPS.SHOW_APPS_MENU_ITEM, + { + trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]', + content: _t( + "Ready to launch your point of sale? Click here." + ), + position: "right", + edition: "community", + }, + { + trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]', + content: _t( + "Ready to launch your point of sale? Click here." + ), + position: "bottom", + edition: "enterprise", + }, + { + trigger: ".o_pos_kanban button.oe_kanban_action_button", + content: _t( + "

Click to start the point of sale interface. It runs on tablets, laptops, or industrial hardware.

Once the session launched, the system continues to run without an internet connection.

" + ), + position: "bottom", + }, + { + content: "Switch to table or make dummy action", + trigger: + ".table:not(.oe_invisible .neworder-button), .order-button.selected", + position: "bottom", + timeout: 20000, + }, + { + content: "waiting for loading to finish", + trigger: ".order-button.neworder-button", + }, + ]; + } + + function add_product_to_order(product_name) { + return [ + { + content: "buy " + product_name, + trigger: '.product-list .product-name:contains("' + product_name + '")', + }, + { + content: "the " + product_name + " have been added to the order", + trigger: '.order .product-name:contains("' + product_name + '")', + }, + ]; + } + + function set_customer(name) { + return [ + { + trigger: ".button.set-customer", + content: _t("Open the customer screen"), + }, + { + trigger: 'td:contains("' + name + '")', + content: _t("Click the customer"), + }, + { + extra_trigger: '.button.next.highlight:contains("Set Customer")', + trigger: '.button.next.highlight:contains("Set Customer")', + content: "Set Customer", + }, + ]; + } + + function cashier_select() { + return [ + { + trigger: + '.modal-dialog.cashier .selection-item:contains("Mitchell Admin")', + content: "select first cashier", + }, + ]; + } + + function debt_method_paying(pay_method) { + var steps = [ + { + content: "Make a dummy action", + trigger: ".order-button.selected", + }, + { + trigger: ".product-screen .actionpad .pay", + content: _t("Open the payment screen"), + }, + ]; + if ("pos_choosing_cashier" in odoo.__DEBUG__.services) { + steps = steps.concat(cashier_select()); + } + steps = steps.concat([ + { + extra_trigger: '.button.paymentmethod:contains("' + pay_method + '")', + trigger: '.button.paymentmethod:contains("' + pay_method + '")', + content: _t("Click the payment method"), + }, + { + extra_trigger: '.button.next.highlight:contains("Validate")', + trigger: '.button.next.highlight:contains("Validate")', + content: "Validate payment", + }, + { + extra_trigger: ".pos-receipt", + trigger: '.button.next.highlight:contains("Next Order")', + content: "Check proceeded validation", + }, + ]); + return steps; + } + + var steps = []; + steps = steps.concat(open_pos_neworder()); + steps = steps.concat(add_product_to_order("Office Chair")); + steps = steps.concat(set_customer("Joel Willis")); + steps = steps.concat(debt_method_paying("Credits")); + + tour.register("tour_pos_debt_notebook_sync", {test: true, url: "/web"}, steps); +}); diff --git a/pos_debt_notebook_sync/tests/__init__.py b/pos_debt_notebook_sync/tests/__init__.py new file mode 100644 index 0000000000..f4b82d4338 --- /dev/null +++ b/pos_debt_notebook_sync/tests/__init__.py @@ -0,0 +1,2 @@ +# License MIT (https://opensource.org/licenses/MIT). +from . import test_debt_sync diff --git a/pos_debt_notebook_sync/tests/test_debt_sync.py b/pos_debt_notebook_sync/tests/test_debt_sync.py new file mode 100644 index 0000000000..b0504681b7 --- /dev/null +++ b/pos_debt_notebook_sync/tests/test_debt_sync.py @@ -0,0 +1,18 @@ +# Copyright 2018 Kolushov Alexandr +# Copyright 2021 Denis Mudarisov +# License MIT (https://opensource.org/licenses/MIT). + +from odoo.tests import HttpCase, tagged + + +@tagged("post_install", "-at_install") +class TestUi(HttpCase): + def test_pos_debt(self): + # without a delay there might be problems caused by a not yet loaded button's action + self.phantom_js( + "/web", + "odoo.__DEBUG__.services['web_tour.tour'].run('tour_pos_debt_notebook_sync', 1000)", + "odoo.__DEBUG__.services['web_tour.tour'].tours.tour_pos_debt_notebook_sync.ready", + login="admin", + timeout=1000, + ) diff --git a/pos_debt_notebook_sync/views/template.xml b/pos_debt_notebook_sync/views/template.xml new file mode 100644 index 0000000000..a9fbca843b --- /dev/null +++ b/pos_debt_notebook_sync/views/template.xml @@ -0,0 +1,25 @@ + + + +