From 9f2c4a35d7a6b6e4781041a1f98b0207293baa0c Mon Sep 17 00:00:00 2001 From: Mitchell Admin Date: Tue, 6 Jul 2021 17:33:57 +0000 Subject: [PATCH 1/8] :tada::one::three: pos_debt_notebook previous commits history: https://github.com/itpp-labs/pos-addons/commits/13.0/pos_debt_notebook > Made via .github/workflows/DINAR-PORT.yml --- pos_debt_notebook/README.rst | 71 + pos_debt_notebook/__init__.py | 29 + pos_debt_notebook/__manifest__.py | 45 + pos_debt_notebook/data.xml | 28 + pos_debt_notebook/data/demo.xml | 25 + pos_debt_notebook/data/product.xml | 21 + pos_debt_notebook/doc/changelog.rst | 185 +++ pos_debt_notebook/doc/index.rst | 148 ++ pos_debt_notebook/i18n/de.po | 875 ++++++++++ pos_debt_notebook/i18n/es.po | 889 ++++++++++ pos_debt_notebook/i18n/fr.po | 877 ++++++++++ pos_debt_notebook/i18n/it.po | 869 ++++++++++ pos_debt_notebook/i18n/pos_debt_notebook.pot | 1293 +++++++++++++++ pos_debt_notebook/i18n/ru.po | 824 ++++++++++ pos_debt_notebook/images/debt_notebook.png | Bin 0 -> 315958 bytes .../migrations/10.0.5.0.0/post-migrate.py | 10 + .../migrations/10.0.5.0.0/pre-migrate.py | 20 + pos_debt_notebook/models.py | 870 ++++++++++ pos_debt_notebook/report/__init__.py | 3 + pos_debt_notebook/report/pos_debt_report.py | 230 +++ .../security/ir.model.access.csv | 5 + .../security/pos_debt_notebook_security.xml | 18 + .../static/description/credit_report-1.png | Bin 0 -> 68007 bytes .../static/description/credit_report-2.png | Bin 0 -> 112813 bytes .../static/description/credit_report.png | Bin 0 -> 94204 bytes .../static/description/debt_history-1.png | Bin 0 -> 114712 bytes .../static/description/debt_history.png | Bin 0 -> 75242 bytes .../description/ecommerce_credit_product.png | Bin 0 -> 167840 bytes pos_debt_notebook/static/description/icon.png | Bin 0 -> 10848 bytes .../static/description/index.html | 562 +++++++ .../static/description/pos_credit_journal.png | Bin 0 -> 104086 bytes .../static/description/pos_credit_product.png | Bin 0 -> 86193 bytes .../description/pos_credit_product1.png | Bin 0 -> 158369 bytes .../description/pos_credit_product2.png | Bin 0 -> 48523 bytes .../description/pos_credit_product3.png | Bin 0 -> 58289 bytes .../static/description/pos_debt_1.png | Bin 0 -> 70752 bytes .../static/description/pos_debt_2.png | Bin 0 -> 55590 bytes .../static/description/pos_debt_3.png | Bin 0 -> 123924 bytes .../static/description/pos_debt_autopay.png | Bin 0 -> 73904 bytes .../static/description/pos_debt_autopay1.png | Bin 0 -> 77600 bytes .../static/description/pos_debt_autopay2.png | Bin 0 -> 81389 bytes .../static/description/pos_debt_history.png | Bin 0 -> 71822 bytes .../description/pos_debt_history_button.png | Bin 0 -> 85504 bytes .../static/description/pos_debt_options.png | Bin 0 -> 124475 bytes .../static/description/pos_debt_res_1.png | Bin 0 -> 58575 bytes .../static/description/pos_debt_res_2.png | Bin 0 -> 53742 bytes .../static/description/pos_debt_thumbs_up.png | Bin 0 -> 240782 bytes .../static/description/pos_debt_type.png | Bin 0 -> 88649 bytes .../static/description/pos_display_credit.png | Bin 0 -> 71626 bytes .../static/description/pos_display_debt.png | Bin 0 -> 71446 bytes .../description/pos_handling_employees.png | Bin 0 -> 139847 bytes .../description/pos_invoices_generated.png | Bin 0 -> 128127 bytes .../description/pos_manual_credit_updates.png | Bin 0 -> 157503 bytes .../pos_manual_credit_updates_list.png | Bin 0 -> 64390 bytes .../static/description/pos_pay_full_debt1.png | Bin 0 -> 76257 bytes .../static/description/pos_pay_full_debt2.png | Bin 0 -> 42534 bytes .../static/description/pos_pay_full_debt3.png | Bin 0 -> 72725 bytes .../static/description/screenshot-1.png | Bin 0 -> 63973 bytes .../static/description/screenshot-2.png | Bin 0 -> 106854 bytes .../static/description/screenshot-3.png | Bin 0 -> 49480 bytes .../static/description/screenshot-4.png | Bin 0 -> 18848 bytes .../static/description/screenshot-5.png | Bin 0 -> 18918 bytes .../static/description/screenshot-6.png | Bin 0 -> 19514 bytes .../static/description/screenshot-7.png | Bin 0 -> 18088 bytes .../static/description/screenshot-8.png | Bin 0 -> 17753 bytes pos_debt_notebook/static/src/css/pos.css | 1318 +++++++++++++++ pos_debt_notebook/static/src/js/pos.js | 1434 +++++++++++++++++ .../static/src/js/test_pos_debt.js | 131 ++ pos_debt_notebook/static/src/xml/pos.xml | 442 +++++ pos_debt_notebook/tests/__init__.py | 4 + pos_debt_notebook/tests/test_newbalance.py | 104 ++ pos_debt_notebook/tests/test_pos_debt.py | 18 + pos_debt_notebook/views.xml | 257 +++ pos_debt_notebook/views/pos_credit_update.xml | 178 ++ .../views/pos_debt_report_view.xml | 171 ++ pos_debt_notebook/wizard/__init__.py | 4 + .../wizard/pos_credit_company_invoices.py | 114 ++ .../pos_credit_company_invoices_views.xml | 59 + .../wizard/pos_credit_invoices.py | 201 +++ .../wizard/pos_credit_invoices_views.xml | 84 + 80 files changed, 12416 insertions(+) create mode 100644 pos_debt_notebook/README.rst create mode 100644 pos_debt_notebook/__init__.py create mode 100644 pos_debt_notebook/__manifest__.py create mode 100644 pos_debt_notebook/data.xml create mode 100644 pos_debt_notebook/data/demo.xml create mode 100644 pos_debt_notebook/data/product.xml create mode 100644 pos_debt_notebook/doc/changelog.rst create mode 100644 pos_debt_notebook/doc/index.rst create mode 100644 pos_debt_notebook/i18n/de.po create mode 100644 pos_debt_notebook/i18n/es.po create mode 100644 pos_debt_notebook/i18n/fr.po create mode 100644 pos_debt_notebook/i18n/it.po create mode 100644 pos_debt_notebook/i18n/pos_debt_notebook.pot create mode 100644 pos_debt_notebook/i18n/ru.po create mode 100644 pos_debt_notebook/images/debt_notebook.png create mode 100644 pos_debt_notebook/migrations/10.0.5.0.0/post-migrate.py create mode 100644 pos_debt_notebook/migrations/10.0.5.0.0/pre-migrate.py create mode 100644 pos_debt_notebook/models.py create mode 100644 pos_debt_notebook/report/__init__.py create mode 100644 pos_debt_notebook/report/pos_debt_report.py create mode 100644 pos_debt_notebook/security/ir.model.access.csv create mode 100644 pos_debt_notebook/security/pos_debt_notebook_security.xml create mode 100644 pos_debt_notebook/static/description/credit_report-1.png create mode 100644 pos_debt_notebook/static/description/credit_report-2.png create mode 100644 pos_debt_notebook/static/description/credit_report.png create mode 100644 pos_debt_notebook/static/description/debt_history-1.png create mode 100644 pos_debt_notebook/static/description/debt_history.png create mode 100644 pos_debt_notebook/static/description/ecommerce_credit_product.png create mode 100644 pos_debt_notebook/static/description/icon.png create mode 100644 pos_debt_notebook/static/description/index.html create mode 100644 pos_debt_notebook/static/description/pos_credit_journal.png create mode 100644 pos_debt_notebook/static/description/pos_credit_product.png create mode 100644 pos_debt_notebook/static/description/pos_credit_product1.png create mode 100644 pos_debt_notebook/static/description/pos_credit_product2.png create mode 100644 pos_debt_notebook/static/description/pos_credit_product3.png create mode 100644 pos_debt_notebook/static/description/pos_debt_1.png create mode 100644 pos_debt_notebook/static/description/pos_debt_2.png create mode 100644 pos_debt_notebook/static/description/pos_debt_3.png create mode 100644 pos_debt_notebook/static/description/pos_debt_autopay.png create mode 100644 pos_debt_notebook/static/description/pos_debt_autopay1.png create mode 100644 pos_debt_notebook/static/description/pos_debt_autopay2.png create mode 100644 pos_debt_notebook/static/description/pos_debt_history.png create mode 100644 pos_debt_notebook/static/description/pos_debt_history_button.png create mode 100644 pos_debt_notebook/static/description/pos_debt_options.png create mode 100644 pos_debt_notebook/static/description/pos_debt_res_1.png create mode 100644 pos_debt_notebook/static/description/pos_debt_res_2.png create mode 100644 pos_debt_notebook/static/description/pos_debt_thumbs_up.png create mode 100644 pos_debt_notebook/static/description/pos_debt_type.png create mode 100644 pos_debt_notebook/static/description/pos_display_credit.png create mode 100644 pos_debt_notebook/static/description/pos_display_debt.png create mode 100644 pos_debt_notebook/static/description/pos_handling_employees.png create mode 100644 pos_debt_notebook/static/description/pos_invoices_generated.png create mode 100644 pos_debt_notebook/static/description/pos_manual_credit_updates.png create mode 100644 pos_debt_notebook/static/description/pos_manual_credit_updates_list.png create mode 100644 pos_debt_notebook/static/description/pos_pay_full_debt1.png create mode 100644 pos_debt_notebook/static/description/pos_pay_full_debt2.png create mode 100644 pos_debt_notebook/static/description/pos_pay_full_debt3.png create mode 100644 pos_debt_notebook/static/description/screenshot-1.png create mode 100644 pos_debt_notebook/static/description/screenshot-2.png create mode 100644 pos_debt_notebook/static/description/screenshot-3.png create mode 100644 pos_debt_notebook/static/description/screenshot-4.png create mode 100644 pos_debt_notebook/static/description/screenshot-5.png create mode 100644 pos_debt_notebook/static/description/screenshot-6.png create mode 100644 pos_debt_notebook/static/description/screenshot-7.png create mode 100644 pos_debt_notebook/static/description/screenshot-8.png create mode 100644 pos_debt_notebook/static/src/css/pos.css create mode 100644 pos_debt_notebook/static/src/js/pos.js create mode 100644 pos_debt_notebook/static/src/js/test_pos_debt.js create mode 100644 pos_debt_notebook/static/src/xml/pos.xml create mode 100644 pos_debt_notebook/tests/__init__.py create mode 100644 pos_debt_notebook/tests/test_newbalance.py create mode 100644 pos_debt_notebook/tests/test_pos_debt.py create mode 100644 pos_debt_notebook/views.xml create mode 100644 pos_debt_notebook/views/pos_credit_update.xml create mode 100644 pos_debt_notebook/views/pos_debt_report_view.xml create mode 100644 pos_debt_notebook/wizard/__init__.py create mode 100644 pos_debt_notebook/wizard/pos_credit_company_invoices.py create mode 100644 pos_debt_notebook/wizard/pos_credit_company_invoices_views.xml create mode 100644 pos_debt_notebook/wizard/pos_credit_invoices.py create mode 100644 pos_debt_notebook/wizard/pos_credit_invoices_views.xml diff --git a/pos_debt_notebook/README.rst b/pos_debt_notebook/README.rst new file mode 100644 index 0000000000..7067cc0f92 --- /dev/null +++ b/pos_debt_notebook/README.rst @@ -0,0 +1,71 @@ +.. image:: https://itpp.dev/images/infinity-readme.png + :alt: Tested and maintained by IT Projects Labs + :target: https://itpp.dev + +====================== + POS: Prepaid credits +====================== + +The module allows to make sale on credit. + +Debt (Credit) value is changed whenever: + +* Product marked as "Credit Product" is sold via POS or via Invoices. Invoices created via website_sale (eCommerce) module are supported too. +* POS payment is made via journal marked as "Debt journal" +* "Manual Credit Updates" is added + +Other features: + +* each user has Debt Limit field. By default is 0, i.e. user has to pay in advance and cannot have negative credits amount. +* Working with employees of company. You can get a sum of Credits of all employess of any company. You can make invoices per each employee at once to updates their Credits. + +Installation \ Deinstallation +============================= + +* Debt data are still available after the module will be re-installed. +* When new (first after install) POS session is opened, a debt payment method would added in a POS config. +* If the module was install and uninstall immediately (without created POS sessions) then it keeps no data. +* If a user deleted debt journal from POS config manually then after the module is upgraded + POS config would not be changed. +* Multicompany mode is supported + +Roadmap +======= + +* TODO. Field ``journal_id`` in ``pos.credit.update`` model should be replaced with ``pos_payment_method_id = fields.Many2on('pos.payment.method')`` + +* TODO. New option for **Zero transactions** feature: allow to create extra order line with negative amount instead of applying discounts. + + * It creates extra record in accounting system (pos.order.line). It can be used as a backup for *Manual Updates* + * It works with following problem case: + + In case of purchasing products with taxes not included in the price, such journals cannot be used along with normal payments + +* TODO. Improvements on heavy usage (Many POSes, Many Partners) + + * Num of users with cached Debt History must be limited + * Limit issue in ``reload_debts`` (check FIXME note there) + * Many POSes do the same requests on getting updates from longpolling. Solution: + + * Customizable timeout in ``on_debt_updates`` method in ``pos_debt_notebook_sync`` module. + * ``reload_debts`` called with ``"postpone": false`` must ignore existing timer + +Questions? +========== + +To get an assistance on this module contact us by email :arrow_right: help@itpp.dev + +Contributors +============ +* `Ivan Yelizariev `__ +* `Stanislav Krotov `__ +* `Dinar Gabbasov `__ +* `Kolushov Alexandr `__ + +Further information +=================== + +Odoo Apps Store: https://apps.odoo.com/apps/modules/13.0/pos_debt_notebook/ + + +Tested on `Odoo 13.0 `_ diff --git a/pos_debt_notebook/__init__.py b/pos_debt_notebook/__init__.py new file mode 100644 index 0000000000..850ccdbdfb --- /dev/null +++ b/pos_debt_notebook/__init__.py @@ -0,0 +1,29 @@ +# License MIT (https://opensource.org/licenses/MIT). +from . import models +from . import report +from . import wizard + +from odoo import SUPERUSER_ID +from odoo import api +from odoo.tools.translate import _ +from odoo.exceptions import UserError + + +def pre_uninstall(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + if env["pos.session"].search([("state", "=", "opened")]): + raise UserError( + _("You have open session of Point of Sale. Please close them first.") + ) + + debt_journals = env["account.journal"].search([("debt", "=", True)]) + value = [] + for journal in debt_journals: + value.append((3, journal.id)) + + for config in env["pos.config"].search([]): + config.write( + { + "payment_method_ids": value, + } + ) diff --git a/pos_debt_notebook/__manifest__.py b/pos_debt_notebook/__manifest__.py new file mode 100644 index 0000000000..86acfe7d1b --- /dev/null +++ b/pos_debt_notebook/__manifest__.py @@ -0,0 +1,45 @@ +# Copyright 2014-2019 Ivan Yelizariev +# Copyright 2015 Bassirou Ndaw +# Copyright 2015 Alexis de Lattre +# Copyright 2016-2017 Stanislav Krotov +# Copyright 2017 Ilmir Karamov +# Copyright 2017 Artyom Losev +# Copyright 2017 Lilia Salihova +# Copyright 2017-2018 Gabbasov Dinar +# Copyright 2018 Kolushov Alexandr +# Copyright 2021 Denis Mudarisov +# License MIT (https://opensource.org/licenses/MIT). +{ + "name": "POS: Prepaid credits", + "summary": "Comfortable sales for your regular customers. Debt payment method for POS", + "category": "Point Of Sale", + "images": ["images/debt_notebook.png"], + "version": "13.0.5.3.4", + "author": "IT-Projects LLC, Ivan Yelizariev", + "support": "apps@itpp.dev", + "website": "https://apps.odoo.com/apps/modules/13.0/pos_debt_notebook/", + "license": "Other OSI approved licence", # MIT + "external_dependencies": {"python": [], "bin": []}, + "depends": ["point_of_sale"], + "data": [ + "security/pos_debt_notebook_security.xml", + "data/product.xml", + "views/pos_debt_report_view.xml", + "views.xml", + "views/pos_credit_update.xml", + "wizard/pos_credit_invoices_views.xml", + "wizard/pos_credit_company_invoices_views.xml", + "data.xml", + "security/ir.model.access.csv", + ], + "qweb": ["static/src/xml/pos.xml"], + "demo": ["data/demo.xml"], + "installable": True, + "uninstall_hook": "pre_uninstall", + "demo_title": "POS Debt/Credit Notebook", + "demo_addons": [], + "demo_addons_hidden": [], + "demo_url": "pos-debt-notebook", + "demo_summary": "Comfortable sales for your regular customers.", + "demo_images": ["images/debt_notebook.png"], +} diff --git a/pos_debt_notebook/data.xml b/pos_debt_notebook/data.xml new file mode 100644 index 0000000000..324a30f9f6 --- /dev/null +++ b/pos_debt_notebook/data.xml @@ -0,0 +1,28 @@ + + + +