diff --git a/setup/stock_weighing_auto_package/odoo/addons/stock_weighing_auto_package b/setup/stock_weighing_auto_package/odoo/addons/stock_weighing_auto_package new file mode 120000 index 00000000..d7b32236 --- /dev/null +++ b/setup/stock_weighing_auto_package/odoo/addons/stock_weighing_auto_package @@ -0,0 +1 @@ +../../../../stock_weighing_auto_package \ No newline at end of file diff --git a/setup/stock_weighing_auto_package/setup.py b/setup/stock_weighing_auto_package/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/stock_weighing_auto_package/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_weighing_auto_package/README.rst b/stock_weighing_auto_package/README.rst new file mode 100644 index 00000000..5b81967a --- /dev/null +++ b/stock_weighing_auto_package/README.rst @@ -0,0 +1,79 @@ +===================== +Weighing auto package +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:27936af3cb3e69603e29a6b7b587ca48dbf64e05bb9d829f4ef904648866772d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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--weighing-lightgray.png?logo=github + :target: https://github.com/OCA/stock-weighing/tree/15.0/stock_weighing_auto_package + :alt: OCA/stock-weighing +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-weighing-15-0/stock-weighing-15-0-stock_weighing_auto_package + :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-weighing&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Add auto package creator in weighing operations + +**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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Sergio Teruel + * Carlor Dauden + +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-weighing `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_weighing_auto_package/__init__.py b/stock_weighing_auto_package/__init__.py new file mode 100644 index 00000000..d6a490a3 --- /dev/null +++ b/stock_weighing_auto_package/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from . import models +from . import wizards diff --git a/stock_weighing_auto_package/__manifest__.py b/stock_weighing_auto_package/__manifest__.py new file mode 100644 index 00000000..625f6ef3 --- /dev/null +++ b/stock_weighing_auto_package/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2024 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +{ + "name": "Weighing auto package", + "summary": "Auto create package for every weighing operation", + "version": "15.0.1.0.0", + "development_status": "Beta", + "category": "Warehouse", + "website": "https://github.com/OCA/stock-weighing", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "stock_weighing", + ], + "data": ["wizards/weighing_wizard_views.xml"], + "installable": True, +} diff --git a/stock_weighing_auto_package/models/__init__.py b/stock_weighing_auto_package/models/__init__.py new file mode 100644 index 00000000..9649db77 --- /dev/null +++ b/stock_weighing_auto_package/models/__init__.py @@ -0,0 +1 @@ +from . import product diff --git a/stock_weighing_auto_package/models/product.py b/stock_weighing_auto_package/models/product.py new file mode 100644 index 00000000..91d3b7a6 --- /dev/null +++ b/stock_weighing_auto_package/models/product.py @@ -0,0 +1,10 @@ +# Copyright 2024 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from odoo import fields, models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + stock_weighing_auto_package = fields.Boolean() diff --git a/stock_weighing_auto_package/readme/CONTRIBUTORS.rst b/stock_weighing_auto_package/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..41325e8c --- /dev/null +++ b/stock_weighing_auto_package/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Sergio Teruel + * Carlor Dauden diff --git a/stock_weighing_auto_package/readme/DESCRIPTION.rst b/stock_weighing_auto_package/readme/DESCRIPTION.rst new file mode 100644 index 00000000..72ff9420 --- /dev/null +++ b/stock_weighing_auto_package/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Add auto package creator in weighing operations diff --git a/stock_weighing_auto_package/static/description/icon.png b/stock_weighing_auto_package/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/stock_weighing_auto_package/static/description/icon.png differ diff --git a/stock_weighing_auto_package/static/description/index.html b/stock_weighing_auto_package/static/description/index.html new file mode 100644 index 00000000..80f35f10 --- /dev/null +++ b/stock_weighing_auto_package/static/description/index.html @@ -0,0 +1,424 @@ + + + + + +Weighing auto package + + + +
+

Weighing auto package

+ + +

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

+

Add auto package creator in weighing operations

+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Sergio Teruel
    • +
    • Carlor Dauden
    • +
    +
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/stock_weighing_auto_package/wizards/__init__.py b/stock_weighing_auto_package/wizards/__init__.py new file mode 100644 index 00000000..edea3aa6 --- /dev/null +++ b/stock_weighing_auto_package/wizards/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from . import weighing_wizard diff --git a/stock_weighing_auto_package/wizards/weighing_wizard.py b/stock_weighing_auto_package/wizards/weighing_wizard.py new file mode 100644 index 00000000..531f6aad --- /dev/null +++ b/stock_weighing_auto_package/wizards/weighing_wizard.py @@ -0,0 +1,23 @@ +# Copyright 2024 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo import fields, models + + +class WeighingWizard(models.TransientModel): + _inherit = "weighing.wizard" + + stock_weighing_auto_package = fields.Boolean( + related="product_id.stock_weighing_auto_package", + readonly=False, + string="Auto package", + ) + + def _post_add_detailed_operation(self): + res = super(WeighingWizard, self)._post_add_detailed_operation() + if self.result_package_id: + self.selected_move_line_id.result_package_id = self.result_package_id + elif self.stock_weighing_auto_package: + self.selected_move_line_id.result_package_id = self.env[ + "stock.quant.package" + ].create({}) + return res diff --git a/stock_weighing_auto_package/wizards/weighing_wizard_views.xml b/stock_weighing_auto_package/wizards/weighing_wizard_views.xml new file mode 100644 index 00000000..52bb22f2 --- /dev/null +++ b/stock_weighing_auto_package/wizards/weighing_wizard_views.xml @@ -0,0 +1,13 @@ + + + + weighing.wizard + + + + + + + +