diff --git a/pos_debt_notebook/README.rst b/pos_debt_notebook/README.rst new file mode 100644 index 0000000000..6c8a6c6a3e --- /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/14.0/pos_debt_notebook/ + + +Tested on `Odoo 14.0 `_ diff --git a/pos_debt_notebook/__init__.py b/pos_debt_notebook/__init__.py new file mode 100644 index 0000000000..393891d64c --- /dev/null +++ b/pos_debt_notebook/__init__.py @@ -0,0 +1,25 @@ +# 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..7870acaeed --- /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": "15.0.5.3.4", + "author": "IT-Projects LLC, Ivan Yelizariev", + "support": "apps@itpp.dev", + "website": "https://github.com/itpp-labs/pos-addons/", + "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/CreditNote.xml", + "static/src/xml/OrderReceipt.xml", + "static/src/xml/PaymentMethodButton.xml", + "static/src/xml/ReceiptScreen.xml", + "static/src/xml/pos.xml", + ], + "demo": ["data/demo.xml"], + "installable": True, + "uninstall_hook": "pre_uninstall", +} diff --git a/pos_debt_notebook/data.xml b/pos_debt_notebook/data.xml new file mode 100644 index 0000000000..4833027d8a --- /dev/null +++ b/pos_debt_notebook/data.xml @@ -0,0 +1,48 @@ + + + +