diff --git a/nfu_grell_exporter/README.rst b/nfu_grell_exporter/README.rst new file mode 100644 index 0000000..2fe8b18 --- /dev/null +++ b/nfu_grell_exporter/README.rst @@ -0,0 +1,67 @@ +================== +NFU Grell Exporter +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:f5c1fd3329fff4e1de63fae68edca9ba70a1f2444b6674d5fac9ede1a6ff1f94 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-bruecksen%2Fife_nfu-lightgray.png?logo=github + :target: https://github.com/bruecksen/ife_nfu/tree/16.0/nfu_grell_exporter + :alt: bruecksen/ife_nfu + +|badge1| |badge2| |badge3| + +This module adds a CSV exporter action to Sale Order Batch module. +It exports the article number (default_code) and the qty of the Sale Order Batch +Product view. + +**Table of contents** + +.. contents:: + :local: + +Changelog +========= + +:0.0.1: Initial module. + +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 +~~~~~~~ + +* BAKEUP + +Contributors +~~~~~~~~~~~~ + +* Niels Göttsch + +Maintainers +~~~~~~~~~~~ + +This module is part of the `bruecksen/ife_nfu `_ project on GitHub. + +You are welcome to contribute. diff --git a/nfu_grell_exporter/__init__.py b/nfu_grell_exporter/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/nfu_grell_exporter/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/nfu_grell_exporter/__manifest__.py b/nfu_grell_exporter/__manifest__.py new file mode 100644 index 0000000..cbdb161 --- /dev/null +++ b/nfu_grell_exporter/__manifest__.py @@ -0,0 +1,11 @@ +{ + "name": "NFU Grell Exporter", + "summary": "Adds a CSV exporter to Sale Order Batch for Grell", + "author": "BAKEUP", + "website": "https://www.bakeup.org", + "category": "Sale", + "version": "16.0.0.0.1", + "depends": ["sale_order_batch"], + "data": ["views/sale_order_batch_views.xml"], + "license": "LGPL-3", +} diff --git a/nfu_grell_exporter/models/__init__.py b/nfu_grell_exporter/models/__init__.py new file mode 100644 index 0000000..b2dc7f4 --- /dev/null +++ b/nfu_grell_exporter/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order_batch diff --git a/nfu_grell_exporter/models/sale_order_batch.py b/nfu_grell_exporter/models/sale_order_batch.py new file mode 100644 index 0000000..ff8fff3 --- /dev/null +++ b/nfu_grell_exporter/models/sale_order_batch.py @@ -0,0 +1,31 @@ +import base64 + +from odoo import models + + +class SaleOrderBatch(models.Model): + _inherit = "sale.order.batch" + + def export_grell_csv(self): + self.ensure_one() + # Prepare CSV content + csv_content = "Default Code,Quantity\n" + for product in self.product_ids: + if product.product_id.default_code: + csv_content += f"{product.product_id.default_code},{product.product_uom_qty}\n" + + # Encode CSV content to base64 + csv_base64 = base64.b64encode(csv_content.encode("utf-8")) + + # Create attachment + attachment = self.env["ir.attachment"].create( + { + "name": f"grell-{self.name}.csv", + "type": "binary", + "datas": csv_base64, + "res_model": self._name, + "res_id": self.id, + } + ) + + return {"type": "ir.actions.act_url", "url": f"/web/content/{attachment.id}?download=true", "target": "self"} diff --git a/nfu_grell_exporter/readme/CONTRIBUTORS.rst b/nfu_grell_exporter/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..fda28e1 --- /dev/null +++ b/nfu_grell_exporter/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Niels Göttsch \ No newline at end of file diff --git a/nfu_grell_exporter/readme/DESCRIPTION.rst b/nfu_grell_exporter/readme/DESCRIPTION.rst new file mode 100644 index 0000000..c461dc2 --- /dev/null +++ b/nfu_grell_exporter/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module adds a CSV exporter action to Sale Order Batch module. +It exports the article number (default_code) and the qty of the Sale Order Batch +Product view. \ No newline at end of file diff --git a/nfu_grell_exporter/readme/HISTORY.rst b/nfu_grell_exporter/readme/HISTORY.rst new file mode 100644 index 0000000..c17c4cd --- /dev/null +++ b/nfu_grell_exporter/readme/HISTORY.rst @@ -0,0 +1 @@ +:0.0.1: Initial module. diff --git a/nfu_grell_exporter/static/description/icon.png b/nfu_grell_exporter/static/description/icon.png new file mode 100644 index 0000000..1267712 Binary files /dev/null and b/nfu_grell_exporter/static/description/icon.png differ diff --git a/nfu_grell_exporter/static/description/index.html b/nfu_grell_exporter/static/description/index.html new file mode 100644 index 0000000..1abbae7 --- /dev/null +++ b/nfu_grell_exporter/static/description/index.html @@ -0,0 +1,430 @@ + + + + + +NFU Grell Exporter + + + +
+

NFU Grell Exporter

+ + +

Beta License: LGPL-3 bruecksen/ife_nfu

+

This module adds a CSV exporter action to Sale Order Batch module. +It exports the article number (default_code) and the qty of the Sale Order Batch +Product view.

+

Table of contents

+ +
+

Changelog

+ +++ + + + +
0.0.1:Initial module.
+
+
+

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

+
    +
  • BAKEUP
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the bruecksen/ife_nfu project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/nfu_grell_exporter/views/sale_order_batch_views.xml b/nfu_grell_exporter/views/sale_order_batch_views.xml new file mode 100644 index 0000000..e67d30c --- /dev/null +++ b/nfu_grell_exporter/views/sale_order_batch_views.xml @@ -0,0 +1,19 @@ + + + + sale.order.batch.form.inherit + sale.order.batch + + + +