diff --git a/setup/stock_picking_report_product_sticker/odoo/addons/stock_picking_report_product_sticker b/setup/stock_picking_report_product_sticker/odoo/addons/stock_picking_report_product_sticker new file mode 120000 index 0000000..e1d5771 --- /dev/null +++ b/setup/stock_picking_report_product_sticker/odoo/addons/stock_picking_report_product_sticker @@ -0,0 +1 @@ +../../../../stock_picking_report_product_sticker \ No newline at end of file diff --git a/setup/stock_picking_report_product_sticker/setup.py b/setup/stock_picking_report_product_sticker/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/stock_picking_report_product_sticker/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_picking_report_product_sticker/README.rst b/stock_picking_report_product_sticker/README.rst new file mode 100644 index 0000000..133c28d --- /dev/null +++ b/stock_picking_report_product_sticker/README.rst @@ -0,0 +1,88 @@ +====================================== +Stock Picking Report - Product Sticker +====================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/15.0/stock_picking_report_product_sticker + :alt: OCA/stock-logistics-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-15-0/stock-logistics-reporting-15-0-stock_picking_report_product_sticker + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-reporting&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to display the Product Stickers in the Delivery Slip reports. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +You must install the ``product_sticker`` module from +[Product Attribute](https://github.com/OCA/product-attribute) repository. + +Usage +===== + +To use this module, you need to: +#. You must go to the Picking Type that you want to show the Product Stickers +and activate the option to *Show Stickers on Pickings of this type*. +#. You can also enable or disable showing Stickers on each Picking by hand if you wish. +Regardless if your Picking Type has Show Stickers enabled or not. + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Moduon + +Contributors +~~~~~~~~~~~~ + +* Eduardo de Miguel (`Moduon `__) + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/stock-logistics-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_report_product_sticker/__init__.py b/stock_picking_report_product_sticker/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/stock_picking_report_product_sticker/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_picking_report_product_sticker/__manifest__.py b/stock_picking_report_product_sticker/__manifest__.py new file mode 100644 index 0000000..18cdc39 --- /dev/null +++ b/stock_picking_report_product_sticker/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +{ + "name": "Stock Picking Report - Product Sticker", + "version": "15.0.1.0.0", + "author": "Moduon, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/stock-logistics-reporting", + "category": "Stock", + "depends": [ + "product_sticker", + "stock", + ], + "data": [ + "views/stock_picking_type_views.xml", + "views/stock_picking_views.xml", + "report/report_deliveryslip.xml", + "data/menus.xml", + ], + "maintainer": ["Shide"], + "installable": True, +} diff --git a/stock_picking_report_product_sticker/data/menus.xml b/stock_picking_report_product_sticker/data/menus.xml new file mode 100644 index 0000000..3eb5015 --- /dev/null +++ b/stock_picking_report_product_sticker/data/menus.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/stock_picking_report_product_sticker/models/__init__.py b/stock_picking_report_product_sticker/models/__init__.py new file mode 100644 index 0000000..f6db7b2 --- /dev/null +++ b/stock_picking_report_product_sticker/models/__init__.py @@ -0,0 +1,2 @@ +from . import stock_picking_type +from . import stock_picking diff --git a/stock_picking_report_product_sticker/models/stock_picking.py b/stock_picking_report_product_sticker/models/stock_picking.py new file mode 100644 index 0000000..7f44aab --- /dev/null +++ b/stock_picking_report_product_sticker/models/stock_picking.py @@ -0,0 +1,39 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +from odoo import api, fields, models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + show_product_stickers = fields.Boolean( + help="Show Product Stickers on pickings of this type.", + compute="_compute_show_product_stickers", + store=True, + readonly=False, + ) + sticker_ids = fields.Many2many( + comodel_name="product.sticker", + string="Stickers", + compute="_compute_sticker_ids", + store=False, + ) + + @api.depends("picking_type_id.show_product_stickers") + def _compute_show_product_stickers(self): + for picking in self: + picking.show_product_stickers = ( + picking.picking_type_id.show_product_stickers + ) + + @api.depends("show_product_stickers", "move_lines.product_id") + def _compute_sticker_ids(self): + self.sticker_ids = False + for picking in self: + if not picking.show_product_stickers: + continue + products = picking.move_lines.product_id + stickers = products.get_product_stickers() + if stickers: + picking.sticker_ids = stickers diff --git a/stock_picking_report_product_sticker/models/stock_picking_type.py b/stock_picking_report_product_sticker/models/stock_picking_type.py new file mode 100644 index 0000000..64ca60d --- /dev/null +++ b/stock_picking_report_product_sticker/models/stock_picking_type.py @@ -0,0 +1,12 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +from odoo import fields, models + + +class StockPickingType(models.Model): + _inherit = "stock.picking.type" + + show_product_stickers = fields.Boolean( + help="Show Product Stickers on Pickings of this type.", + ) diff --git a/stock_picking_report_product_sticker/readme/CONTRIBUTORS.rst b/stock_picking_report_product_sticker/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..73c0719 --- /dev/null +++ b/stock_picking_report_product_sticker/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Eduardo de Miguel (`Moduon `__) diff --git a/stock_picking_report_product_sticker/readme/DESCRIPTION.rst b/stock_picking_report_product_sticker/readme/DESCRIPTION.rst new file mode 100644 index 0000000..4734bfa --- /dev/null +++ b/stock_picking_report_product_sticker/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows you to display the Product Stickers in the Delivery Slip reports. diff --git a/stock_picking_report_product_sticker/readme/INSTALL.rst b/stock_picking_report_product_sticker/readme/INSTALL.rst new file mode 100644 index 0000000..9771deb --- /dev/null +++ b/stock_picking_report_product_sticker/readme/INSTALL.rst @@ -0,0 +1,2 @@ +You must install the ``product_sticker`` module from +[Product Attribute](https://github.com/OCA/product-attribute) repository. diff --git a/stock_picking_report_product_sticker/readme/USAGE.rst b/stock_picking_report_product_sticker/readme/USAGE.rst new file mode 100644 index 0000000..d33b51c --- /dev/null +++ b/stock_picking_report_product_sticker/readme/USAGE.rst @@ -0,0 +1,6 @@ +To use this module, you need to: + +#. You must go to the Picking Type that you want to show the Product Stickers + and activate the option to *Show Stickers on Pickings of this type*. +#. You can also enable or disable showing Stickers on each Picking by hand if you wish. + Regardless if your Picking Type has Show Stickers enabled or not. diff --git a/stock_picking_report_product_sticker/report/report_deliveryslip.xml b/stock_picking_report_product_sticker/report/report_deliveryslip.xml new file mode 100644 index 0000000..2243393 --- /dev/null +++ b/stock_picking_report_product_sticker/report/report_deliveryslip.xml @@ -0,0 +1,39 @@ + + + + + + + diff --git a/stock_picking_report_product_sticker/static/description/icon.png b/stock_picking_report_product_sticker/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/stock_picking_report_product_sticker/static/description/icon.png differ diff --git a/stock_picking_report_product_sticker/static/description/index.html b/stock_picking_report_product_sticker/static/description/index.html new file mode 100644 index 0000000..b04d7a3 --- /dev/null +++ b/stock_picking_report_product_sticker/static/description/index.html @@ -0,0 +1,434 @@ + + + + + + +Stock Picking Report - Product Sticker + + + +
+

Stock Picking Report - Product Sticker

+ + +

Beta License: AGPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runboat

+

This module allows you to display the Product Stickers in the Delivery Slip reports.

+

Table of contents

+ +
+

Installation

+

You must install the product_sticker module from +[Product Attribute](https://github.com/OCA/product-attribute) repository.

+
+
+

Usage

+

To use this module, you need to: +#. You must go to the Picking Type that you want to show the Product Stickers +and activate the option to Show Stickers on Pickings of this type. +#. You can also enable or disable showing Stickers on each Picking by hand if you wish. +Regardless if your Picking Type has Show Stickers enabled or not.

+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Moduon
  • +
+
+
+

Contributors

+
    +
  • Eduardo de Miguel (Moduon)
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/stock-logistics-reporting project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_picking_report_product_sticker/tests/__init__.py b/stock_picking_report_product_sticker/tests/__init__.py new file mode 100644 index 0000000..438bdb9 --- /dev/null +++ b/stock_picking_report_product_sticker/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_picking diff --git a/stock_picking_report_product_sticker/tests/common.py b/stock_picking_report_product_sticker/tests/common.py new file mode 100644 index 0000000..9a49d46 --- /dev/null +++ b/stock_picking_report_product_sticker/tests/common.py @@ -0,0 +1,41 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +from odoo.tests import tagged + +from odoo.addons.product_sticker.tests.common import ProductStickerCommon + + +@tagged("post_install", "-at_install") +class ProductStickerStockCommon(ProductStickerCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.picking_type_out = cls.env.ref("stock.picking_type_out") + cls.picking_type_out.show_product_stickers = True + cls.stock_location = cls.env.ref("stock.stock_location_stock") + cls.supplier_location = cls.env.ref("stock.stock_location_suppliers") + + def _create_picking(self, picking_type, products): + return self.env["stock.picking"].create( + { + "picking_type_id": picking_type.id, + "location_id": self.stock_location.id, + "location_dest_id": self.supplier_location.id, + "move_lines": [ + ( + 0, + 0, + { + "name": product.name, + "product_id": product.id, + "product_uom": product.uom_id.id, + "location_id": self.stock_location.id, + "location_dest_id": self.supplier_location.id, + "product_uom_qty": 1, + }, + ) + for product in products + ], + } + ) diff --git a/stock_picking_report_product_sticker/tests/test_stock_picking.py b/stock_picking_report_product_sticker/tests/test_stock_picking.py new file mode 100644 index 0000000..b57293d --- /dev/null +++ b/stock_picking_report_product_sticker/tests/test_stock_picking.py @@ -0,0 +1,21 @@ +# Copyright 2023 Moduon Team S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +from .common import ProductStickerStockCommon + + +class TestStickersOnPickings(ProductStickerStockCommon): + def test_stock_picking(self): + target_product = self.product_as400.product_variant_ids[0] + product_stickers = target_product.get_product_stickers() + picking = self._create_picking( + self.picking_type_out, [target_product, target_product] + ) + self.assertTrue( + picking.show_product_stickers, "Picking type should show stickers" + ) + self.assertEqual( + picking.sticker_ids, + product_stickers, + "Not the same images than the product", + ) diff --git a/stock_picking_report_product_sticker/views/stock_picking_type_views.xml b/stock_picking_report_product_sticker/views/stock_picking_type_views.xml new file mode 100644 index 0000000..4ecd02c --- /dev/null +++ b/stock_picking_report_product_sticker/views/stock_picking_type_views.xml @@ -0,0 +1,15 @@ + + + + + stock.picking.type.form + stock.picking.type + + + + + + + + diff --git a/stock_picking_report_product_sticker/views/stock_picking_views.xml b/stock_picking_report_product_sticker/views/stock_picking_views.xml new file mode 100644 index 0000000..56c6898 --- /dev/null +++ b/stock_picking_report_product_sticker/views/stock_picking_views.xml @@ -0,0 +1,15 @@ + + + + + stock.picking.form + stock.picking + + + + + + + +