From d9f98a2e702a0112e26d45385f90f35f3f7a1c95 Mon Sep 17 00:00:00 2001 From: hparfr Date: Thu, 2 May 2024 15:22:09 +0200 Subject: [PATCH] shopinvader_bicycode: add module --- shopinvader_bicycode/README.rst | 68 +++ shopinvader_bicycode/__init__.py | 5 + shopinvader_bicycode/__manifest__.py | 18 + shopinvader_bicycode/pyproject.toml | 3 + shopinvader_bicycode/readme/CONTRIBUTORS.rst | 1 + shopinvader_bicycode/readme/DESCRIPTION.rst | 1 + shopinvader_bicycode/services/__init__.py | 6 + .../services/abstract_sale.py | 29 ++ shopinvader_bicycode/services/delivery.py | 30 ++ .../static/description/index.html | 417 ++++++++++++++++++ 10 files changed, 578 insertions(+) create mode 100644 shopinvader_bicycode/README.rst create mode 100644 shopinvader_bicycode/__init__.py create mode 100644 shopinvader_bicycode/__manifest__.py create mode 100644 shopinvader_bicycode/pyproject.toml create mode 100644 shopinvader_bicycode/readme/CONTRIBUTORS.rst create mode 100644 shopinvader_bicycode/readme/DESCRIPTION.rst create mode 100644 shopinvader_bicycode/services/__init__.py create mode 100644 shopinvader_bicycode/services/abstract_sale.py create mode 100644 shopinvader_bicycode/services/delivery.py create mode 100644 shopinvader_bicycode/static/description/index.html diff --git a/shopinvader_bicycode/README.rst b/shopinvader_bicycode/README.rst new file mode 100644 index 0000000..ba2ca94 --- /dev/null +++ b/shopinvader_bicycode/README.rst @@ -0,0 +1,68 @@ +==================== +Shopinvader Bicycode +==================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:6795cd91e4bc4cc57b800db64bd12d55e3763698f924c96304b7f4c3b5855df7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-Akretion%2Fvertical--bike-lightgray.png?logo=github + :target: https://github.com/Akretion/vertical-bike/tree/14.0/shopinvader_bicycode + :alt: Akretion/vertical-bike + +|badge1| |badge2| |badge3| + +Make bicycodes available in shopinvader delivery api + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Raphaël Reverdy + +Maintainers +~~~~~~~~~~~ + +.. |maintainer-hparfr| image:: https://github.com/hparfr.png?size=40px + :target: https://github.com/hparfr + :alt: hparfr + +Current maintainer: + +|maintainer-hparfr| + +This module is part of the `Akretion/vertical-bike `_ project on GitHub. + +You are welcome to contribute. diff --git a/shopinvader_bicycode/__init__.py b/shopinvader_bicycode/__init__.py new file mode 100644 index 0000000..b898aad --- /dev/null +++ b/shopinvader_bicycode/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2023 Akretion (http://www.akretion.com) +# @author Raphaël Reverdy +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import services diff --git a/shopinvader_bicycode/__manifest__.py b/shopinvader_bicycode/__manifest__.py new file mode 100644 index 0000000..10ab0cb --- /dev/null +++ b/shopinvader_bicycode/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2023 Akretion (http://www.akretion.com) +# @author Raphaël Reverdy +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Shopinvader Bicycode", + "summary": "Publish bicycode in API", + "version": "14.0.2.0.0", + "category": "Stock", + "website": "https://github.com/akretion/vertical-bike", + "author": "Akretion", + "maintainers": ["hparfr"], + "license": "AGPL-3", + "depends": [ + "bicycode", + "shopinvader_delivery_detail", + ], +} diff --git a/shopinvader_bicycode/pyproject.toml b/shopinvader_bicycode/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/shopinvader_bicycode/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/shopinvader_bicycode/readme/CONTRIBUTORS.rst b/shopinvader_bicycode/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..dc3bfce --- /dev/null +++ b/shopinvader_bicycode/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Raphaël Reverdy diff --git a/shopinvader_bicycode/readme/DESCRIPTION.rst b/shopinvader_bicycode/readme/DESCRIPTION.rst new file mode 100644 index 0000000..00026a2 --- /dev/null +++ b/shopinvader_bicycode/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Make bicycodes available in shopinvader delivery api diff --git a/shopinvader_bicycode/services/__init__.py b/shopinvader_bicycode/services/__init__.py new file mode 100644 index 0000000..c2cfedc --- /dev/null +++ b/shopinvader_bicycode/services/__init__.py @@ -0,0 +1,6 @@ +# Copyright 2023 Akretion (http://www.akretion.com) +# @author Raphaël Reverdy +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import abstract_sale +from . import delivery diff --git a/shopinvader_bicycode/services/abstract_sale.py b/shopinvader_bicycode/services/abstract_sale.py new file mode 100644 index 0000000..3851f3a --- /dev/null +++ b/shopinvader_bicycode/services/abstract_sale.py @@ -0,0 +1,29 @@ +# Copyright 2023 Akretion (http://www.akretion.com) +# @author Raphaël Reverdy +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import logging + +from odoo.addons.component.core import AbstractComponent + +_logger = logging.getLogger(__name__) + + +class AbstractSaleService(AbstractComponent): + _inherit = [ + "shopinvader.abstract.sale.service", + ] + + def _convert_one_line(self, line): + res = super()._convert_one_line(line) + res.update( + { + "bicycodes": (line.move_ids.move_line_ids.mapped("bicycode_ids.name")), + # TODO remove the following line when our clients are moved + # to a new version + "bicycode": ( + line.move_ids.move_line_ids.mapped("bicycode_ids.name")[:1] or [""] + ), + } + ) + return res diff --git a/shopinvader_bicycode/services/delivery.py b/shopinvader_bicycode/services/delivery.py new file mode 100644 index 0000000..5ffd0d7 --- /dev/null +++ b/shopinvader_bicycode/services/delivery.py @@ -0,0 +1,30 @@ +# Copyright 2023 Akretion (http://www.akretion.com) +# @author Raphaël Reverdy +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.addons.component.core import Component + + +class DeliveryService(Component): + _inherit = "shopinvader.delivery.service" + + def _get_picking_schema(self): + """ + :return: dict + """ + schema = super()._get_picking_schema() + schema["lines"]["schema"]["schema"]["bicycodes"] = { + "type": "list", + "nullable": False, + "schema": { + "type": "string", + }, + } + return schema + + def _get_parser_stock_move_line(self): + vals = super()._get_parser_stock_move_line() + vals.append( + ("bicycode_ids:bicycodes"), + ) + return vals diff --git a/shopinvader_bicycode/static/description/index.html b/shopinvader_bicycode/static/description/index.html new file mode 100644 index 0000000..8c68a2b --- /dev/null +++ b/shopinvader_bicycode/static/description/index.html @@ -0,0 +1,417 @@ + + + + + +Shopinvader Bicycode + + + +
+

Shopinvader Bicycode

+ + +

Beta License: AGPL-3 Akretion/vertical-bike

+

Make bicycodes available in shopinvader delivery api

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

Current maintainer:

+

hparfr

+

This module is part of the Akretion/vertical-bike project on GitHub.

+

You are welcome to contribute.

+
+
+
+ +