diff --git a/qr_payments/README.rst b/qr_payments/README.rst new file mode 100644 index 0000000000..6f1f15165e --- /dev/null +++ b/qr_payments/README.rst @@ -0,0 +1,33 @@ +.. 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 + +=================== + QR-based payments +=================== + +Technical module to support qr-based payments like Alipay, WeChat + +Questions? +========== + +To get an assistance on this module contact us by email :arrow_right: help@itpp.dev + +Contributors +============ +* `Ivan Yelizariev `__ + + +Further information +=================== + +Odoo Apps Store: https://apps.odoo.com/apps/modules/13.0/pos_qr_payments/ + + +Notifications on updates: `via Atom `_, `by Email `_ + +Tested on `Odoo 11.0 `_ diff --git a/qr_payments/__init__.py b/qr_payments/__init__.py new file mode 100644 index 0000000000..795e2483a9 --- /dev/null +++ b/qr_payments/__init__.py @@ -0,0 +1,2 @@ +# License MIT (https://opensource.org/licenses/MIT). +from . import tools diff --git a/qr_payments/__manifest__.py b/qr_payments/__manifest__.py new file mode 100644 index 0000000000..9c7a74fdbd --- /dev/null +++ b/qr_payments/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright 2018 Ivan Yelizariev +# License MIT (https://opensource.org/licenses/MIT). +{ + "name": """QR-based payments""", + "summary": """Technical module to support qr-based payments like Alipay, WeChat""", + "category": "Hidden", + "images": ["images/QR-based payments.jpg"], + "version": "14.0.1.0.1", + "application": False, + "author": "IT-Projects LLC, Ivan Yelizariev", + "support": "help@itpp.dev", + "website": "https://github.com/itpp-labs/pos-addons#readme", + "license": "Other OSI approved licence", # MIT + "depends": [], + "external_dependencies": {"python": [], "bin": []}, + "data": [], + "demo": [], + "qweb": [], + "post_load": None, + "pre_init_hook": None, + "post_init_hook": None, + "uninstall_hook": None, + "auto_install": False, + "installable": True, +} diff --git a/qr_payments/doc/changelog.rst b/qr_payments/doc/changelog.rst new file mode 100644 index 0000000000..0d1efb2355 --- /dev/null +++ b/qr_payments/doc/changelog.rst @@ -0,0 +1,9 @@ +`1.0.1` +------- + +- **Fix:** invalid syntax error in python3.5+ + +`1.0.0` +------- + +- **Init version** diff --git a/qr_payments/doc/index.rst b/qr_payments/doc/index.rst new file mode 100644 index 0000000000..688cdf7a0d --- /dev/null +++ b/qr_payments/doc/index.rst @@ -0,0 +1,5 @@ +=================== + QR-based payments +=================== + +The module cannot be used alone. Try to install, for example, `pos_wechat `__. diff --git a/qr_payments/i18n/qr_payments.pot b/qr_payments/i18n/qr_payments.pot new file mode 100644 index 0000000000..d2e396f159 --- /dev/null +++ b/qr_payments/i18n/qr_payments.pot @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +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" + diff --git a/qr_payments/images/QR-based payments.jpg b/qr_payments/images/QR-based payments.jpg new file mode 100644 index 0000000000..cc27d6d2ff Binary files /dev/null and b/qr_payments/images/QR-based payments.jpg differ diff --git a/qr_payments/static/description/icon.png b/qr_payments/static/description/icon.png new file mode 100644 index 0000000000..b43a0a135f Binary files /dev/null and b/qr_payments/static/description/icon.png differ diff --git a/qr_payments/static/description/index.html b/qr_payments/static/description/index.html new file mode 100644 index 0000000000..f0506ef5be --- /dev/null +++ b/qr_payments/static/description/index.html @@ -0,0 +1,61 @@ +
+
+
+

QR-based payments

+

Technical module to support qr-based payments like Alipay, WeChat

+
+
+
+ +
+
+
+

Need our service?

+

Contact us by email or fill out request form

+ +
+
+
+
+ Tested on Odoo
12.0 community +
+ +
+
+
+
diff --git a/qr_payments/tools/__init__.py b/qr_payments/tools/__init__.py new file mode 100644 index 0000000000..4149ad95f5 --- /dev/null +++ b/qr_payments/tools/__init__.py @@ -0,0 +1,2 @@ +# License MIT (https://opensource.org/licenses/MIT). +from .async_call import odoo_async_call diff --git a/qr_payments/tools/async_call.py b/qr_payments/tools/async_call.py new file mode 100644 index 0000000000..bc15277902 --- /dev/null +++ b/qr_payments/tools/async_call.py @@ -0,0 +1,38 @@ +# Copyright 2018 Ivan Yelizariev +# License MIT (https://opensource.org/licenses/MIT). +import threading + +from odoo import api + +__all__ = ["odoo_async_call"] + + +def odoo_async_call(target, args, kwargs, callback=None): + t = threading.Thread(target=odoo_wrapper, args=(target, args, kwargs, callback)) + t.start() + return t + + +# TODO: is there more elegant way? +def odoo_wrapper(target, args, kwargs, callback): + self = get_self(target) + with api.Environment.manage(), self.pool.cursor() as cr: + result = call_with_new_cr(cr, target, args, kwargs) + if callback: + call_with_new_cr(cr, callback, (result,)) + + +def get_self(method): + try: + # python 3 + return method.__self__ + except Exception: + # python 2 + return method.im_self + + +def call_with_new_cr(cr, method, args=None, kwargs=None): + method_name = method.__name__ + self = get_self(method) + self = self.with_env(self.env(cr=cr)) + return getattr(self, method_name)(*(args or ()), **(kwargs or {})) diff --git a/setup/qr_payments/odoo/addons/qr_payments b/setup/qr_payments/odoo/addons/qr_payments new file mode 120000 index 0000000000..c59444c29b --- /dev/null +++ b/setup/qr_payments/odoo/addons/qr_payments @@ -0,0 +1 @@ +../../../../qr_payments \ No newline at end of file diff --git a/setup/qr_payments/setup.py b/setup/qr_payments/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/qr_payments/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)