diff --git a/setup/stock_package_type_category/odoo/addons/stock_package_type_category b/setup/stock_package_type_category/odoo/addons/stock_package_type_category new file mode 120000 index 000000000..50fa80f70 --- /dev/null +++ b/setup/stock_package_type_category/odoo/addons/stock_package_type_category @@ -0,0 +1 @@ +../../../../stock_package_type_category \ No newline at end of file diff --git a/setup/stock_package_type_category/setup.py b/setup/stock_package_type_category/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_package_type_category/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_package_type_category/README.rst b/stock_package_type_category/README.rst new file mode 100644 index 000000000..e54228c27 --- /dev/null +++ b/stock_package_type_category/README.rst @@ -0,0 +1,93 @@ +=========================== +Stock Package Type Category +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a6483ab77d8d36e10d991bedcddc8ae69abc6bf083a26c5ed04c952cad268271 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_package_type_category + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_package_type_category + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to define a category on different package types. + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +When preparing the delivery, users that load packages in their transport +want to sort them per category in order to easy their operations. + +Configuration +============= + +- You should have activated the 'Packages' configuration in Inventory > + Configuration > Settings > Operations. +- Go to Inventory > Configuration > Delivery > Package Type Categories. +- Add as many categories you need by filling in a name and a code + (unique). +- Then, fill in the category on package type that need it. + +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 +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Denis Roussel denis.roussel@acsone.eu +- Jacques-Etienne Baudoux je@bcim.be + +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-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_package_type_category/__init__.py b/stock_package_type_category/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_package_type_category/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_package_type_category/__manifest__.py b/stock_package_type_category/__manifest__.py new file mode 100644 index 000000000..8fa59dc57 --- /dev/null +++ b/stock_package_type_category/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Package Type Category", + "summary": """ + This module allows to group package types in different categories""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "depends": ["stock"], + "data": [ + "security/stock_package_type_category.xml", + "views/stock_package_type_category.xml", + "views/stock_package_type.xml", + ], + "demo": [ + "demo/stock_package_type_category.xml", + ], +} diff --git a/stock_package_type_category/demo/stock_package_type_category.xml b/stock_package_type_category/demo/stock_package_type_category.xml new file mode 100644 index 000000000..ac937b057 --- /dev/null +++ b/stock_package_type_category/demo/stock_package_type_category.xml @@ -0,0 +1,16 @@ + + + + + + Desks + DESK + + + + Spare Parts + PARTS + + + diff --git a/stock_package_type_category/models/__init__.py b/stock_package_type_category/models/__init__.py new file mode 100644 index 000000000..83c95247a --- /dev/null +++ b/stock_package_type_category/models/__init__.py @@ -0,0 +1,2 @@ +from . import stock_package_type +from . import stock_package_type_category diff --git a/stock_package_type_category/models/stock_package_type.py b/stock_package_type_category/models/stock_package_type.py new file mode 100644 index 000000000..6654cbc81 --- /dev/null +++ b/stock_package_type_category/models/stock_package_type.py @@ -0,0 +1,16 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class StockPackageType(models.Model): + + _inherit = "stock.package.type" + + category_id = fields.Many2one( + comodel_name="stock.package.type.category", + string="Category", + help="This is the category this package type belongs to", + index="btree_not_null", + ) diff --git a/stock_package_type_category/models/stock_package_type_category.py b/stock_package_type_category/models/stock_package_type_category.py new file mode 100644 index 000000000..17552b961 --- /dev/null +++ b/stock_package_type_category/models/stock_package_type_category.py @@ -0,0 +1,21 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class StockPackageTypeCategory(models.Model): + + _name = "stock.package.type.category" + _description = "Stock Package Type Category" + + name = fields.Char(translate=True, required=True) + code = fields.Char(required=True) + + _sql_constraints = [ + ( + "code_unique", + "unique(code)", + "The package type category code should be unique", + ) + ] diff --git a/stock_package_type_category/readme/CONFIGURE.md b/stock_package_type_category/readme/CONFIGURE.md new file mode 100644 index 000000000..fda7496af --- /dev/null +++ b/stock_package_type_category/readme/CONFIGURE.md @@ -0,0 +1,4 @@ +- You should have activated the 'Packages' configuration in Inventory > Configuration > Settings > Operations. +- Go to Inventory > Configuration > Delivery > Package Type Categories. +- Add as many categories you need by filling in a name and a code (unique). +- Then, fill in the category on package type that need it. diff --git a/stock_package_type_category/readme/CONTEXT.md b/stock_package_type_category/readme/CONTEXT.md new file mode 100644 index 000000000..5e624e8a1 --- /dev/null +++ b/stock_package_type_category/readme/CONTEXT.md @@ -0,0 +1,2 @@ +When preparing the delivery, users that load packages in their transport want +to sort them per category in order to easy their operations. diff --git a/stock_package_type_category/readme/CONTRIBUTORS.md b/stock_package_type_category/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..48218ea22 --- /dev/null +++ b/stock_package_type_category/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Denis Roussel +- Jacques-Etienne Baudoux diff --git a/stock_package_type_category/readme/DESCRIPTION.md b/stock_package_type_category/readme/DESCRIPTION.md new file mode 100644 index 000000000..9ff7ccd1b --- /dev/null +++ b/stock_package_type_category/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows you to define a category on different package types. diff --git a/stock_package_type_category/security/stock_package_type_category.xml b/stock_package_type_category/security/stock_package_type_category.xml new file mode 100644 index 000000000..35c10b1ac --- /dev/null +++ b/stock_package_type_category/security/stock_package_type_category.xml @@ -0,0 +1,26 @@ + + + + + + stock.package.type.category manager + + + + + + + + + + stock.package.type.category user + + + + + + + + + diff --git a/stock_package_type_category/static/description/icon.png b/stock_package_type_category/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_package_type_category/static/description/icon.png differ diff --git a/stock_package_type_category/static/description/index.html b/stock_package_type_category/static/description/index.html new file mode 100644 index 000000000..6356921f0 --- /dev/null +++ b/stock_package_type_category/static/description/index.html @@ -0,0 +1,439 @@ + + + + + +Stock Package Type Category + + + +
+

Stock Package Type Category

+ + +

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

+

This module allows you to define a category on different package types.

+

Table of contents

+ +
+

Use Cases / Context

+

When preparing the delivery, users that load packages in their transport +want to sort them per category in order to easy their operations.

+
+
+

Configuration

+
    +
  • You should have activated the ‘Packages’ configuration in Inventory > +Configuration > Settings > Operations.
  • +
  • Go to Inventory > Configuration > Delivery > Package Type Categories.
  • +
  • Add as many categories you need by filling in a name and a code +(unique).
  • +
  • Then, fill in the category on package type that need it.
  • +
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

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-warehouse project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_package_type_category/tests/__init__.py b/stock_package_type_category/tests/__init__.py new file mode 100644 index 000000000..26b3fbe2c --- /dev/null +++ b/stock_package_type_category/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_package_type_category diff --git a/stock_package_type_category/tests/test_stock_package_type_category.py b/stock_package_type_category/tests/test_stock_package_type_category.py new file mode 100644 index 000000000..a3db37eab --- /dev/null +++ b/stock_package_type_category/tests/test_stock_package_type_category.py @@ -0,0 +1,24 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from psycopg2.errors import IntegrityError + +from odoo.addons.base.tests.common import BaseCommon + + +class TestPackageCategory(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.category_obj = cls.env["stock.package.type.category"] + + def test_category_unique(self): + """ + Categories with same code should not exist. + """ + with self.assertRaises(IntegrityError): + self.category_obj.create( + { + "name": "Desk 2", + "code": "DESK", + } + ) diff --git a/stock_package_type_category/views/stock_package_type.xml b/stock_package_type_category/views/stock_package_type.xml new file mode 100644 index 000000000..9126f3e0c --- /dev/null +++ b/stock_package_type_category/views/stock_package_type.xml @@ -0,0 +1,35 @@ + + + + + + stock.package.type.form (in stock_package_type_category) + stock.package.type + + + + + + + + + + + + + stock.package.type.tree (in stock_package_type_category) + stock.package.type + + + + + + + + + diff --git a/stock_package_type_category/views/stock_package_type_category.xml b/stock_package_type_category/views/stock_package_type_category.xml new file mode 100644 index 000000000..989b03297 --- /dev/null +++ b/stock_package_type_category/views/stock_package_type_category.xml @@ -0,0 +1,64 @@ + + + + + + stock.package.type.category.form (in stock_package_type_category) + stock.package.type.category + +
+ + + + + + +
+
+
+ + + stock.package.type.category.search (in stock_package_type_category) + stock.package.type.category + + + + + + + + + + stock.package.type.category.tree (in stock_package_type_category) + stock.package.type.category + + + + + + + + + Package Type Categories + stock.package.type.category + tree,form + [] + {} + + + + Package Type Categories + + + + + + +