diff --git a/stock_picking_report_delivery_cost/README.rst b/stock_picking_report_delivery_cost/README.rst new file mode 100644 index 0000000000..309d17c56a --- /dev/null +++ b/stock_picking_report_delivery_cost/README.rst @@ -0,0 +1,96 @@ +================================ +Delivery cost in Picking Reports +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:1d2873443b3a00a6e9e763590bc455aa6372d8a5003964e17262840db92f0e9c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fdelivery--carrier-lightgray.png?logo=github + :target: https://github.com/OCA/delivery-carrier/tree/17.0/stock_picking_report_delivery_cost + :alt: OCA/delivery-carrier +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/delivery-carrier-17-0/delivery-carrier-17-0-stock_picking_report_delivery_cost + :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/delivery-carrier&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module shows in the delivery slip and picking operations reports +the cost of the delivery method according the rate computed on the fly +according same conditions as standard delivery module would do. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +1. Go to *Inventory > Operations > Transfers* and pick one not in state + *Done* or *Cancelled*. +2. Click on *Print > Delivery Slip* or *Print > Picking Operations*. +3. You will see in the report the computed delivery cost. + +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 `__: + + - Pedro M. Baeza + - Víctor Martínez + - Pilar Vargas + +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia + +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/delivery-carrier `_ 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_delivery_cost/__init__.py b/stock_picking_report_delivery_cost/__init__.py new file mode 100644 index 0000000000..3275ac2adf --- /dev/null +++ b/stock_picking_report_delivery_cost/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import models diff --git a/stock_picking_report_delivery_cost/__manifest__.py b/stock_picking_report_delivery_cost/__manifest__.py new file mode 100644 index 0000000000..bc7ebebbce --- /dev/null +++ b/stock_picking_report_delivery_cost/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Delivery cost in Picking Reports", + "summary": "Show delivery cost in delivery slip and picking operations " " reports", + "version": "17.0.1.0.0", + "category": "Stock", + "website": "https://github.com/OCA/delivery-carrier", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": ["stock_delivery"], + "data": ["report/report_shipping.xml", "report/report_deliveryslip.xml"], +} diff --git a/stock_picking_report_delivery_cost/i18n/es.po b/stock_picking_report_delivery_cost/i18n/es.po new file mode 100644 index 0000000000..b324b9b12a --- /dev/null +++ b/stock_picking_report_delivery_cost/i18n/es.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_delivery_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-28 12:52+0000\n" +"PO-Revision-Date: 2020-10-28 12:52+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_picking_report_delivery_cost +#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_picking +msgid "Delivery cost:" +msgstr "Coste de envío:" + +#. module: stock_picking_report_delivery_cost +#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_delivery_document +msgid "Delivery cost" +msgstr "" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model.fields,field_description:stock_picking_report_delivery_cost.field_stock_picking__carrier_price_for_report +msgid "Carrier Price For Report" +msgstr "Precio del envío para el informe" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model.fields,field_description:stock_picking_report_delivery_cost.field_stock_picking__currency_id +msgid "Currency" +msgstr "Moneda" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model,name:stock_picking_report_delivery_cost.model_stock_picking +msgid "Transfer" +msgstr "Albarán" diff --git a/stock_picking_report_delivery_cost/i18n/fr.po b/stock_picking_report_delivery_cost/i18n/fr.po new file mode 100644 index 0000000000..72d1cbb2b6 --- /dev/null +++ b/stock_picking_report_delivery_cost/i18n/fr.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_delivery_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-08 21:33+0000\n" +"Last-Translator: kbentaleb \n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: stock_picking_report_delivery_cost +#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_picking +msgid "Delivery cost:" +msgstr "Prix de livraison:" + +#. module: stock_picking_report_delivery_cost +#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_delivery_document +msgid "Delivery cost" +msgstr "" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model.fields,field_description:stock_picking_report_delivery_cost.field_stock_picking__carrier_price_for_report +msgid "Carrier Price For Report" +msgstr "" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model.fields,field_description:stock_picking_report_delivery_cost.field_stock_picking__currency_id +msgid "Currency" +msgstr "Devise" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model,name:stock_picking_report_delivery_cost.model_stock_picking +msgid "Transfer" +msgstr "Transfert" diff --git a/stock_picking_report_delivery_cost/i18n/it.po b/stock_picking_report_delivery_cost/i18n/it.po new file mode 100644 index 0000000000..58dcd90e9d --- /dev/null +++ b/stock_picking_report_delivery_cost/i18n/it.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_delivery_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-07-15 09:58+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: stock_picking_report_delivery_cost +#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_picking +msgid "Delivery cost:" +msgstr "Costo di consegna:" + +#. module: stock_picking_report_delivery_cost +#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_delivery_document +msgid "Delivery cost" +msgstr "Costo di consegna" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model.fields,field_description:stock_picking_report_delivery_cost.field_stock_picking__carrier_price_for_report +msgid "Carrier Price For Report" +msgstr "Prezzo vettore per resoconto" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model.fields,field_description:stock_picking_report_delivery_cost.field_stock_picking__currency_id +msgid "Currency" +msgstr "Valuta" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model,name:stock_picking_report_delivery_cost.model_stock_picking +msgid "Transfer" +msgstr "Trasferimento" diff --git a/stock_picking_report_delivery_cost/i18n/stock_picking_report_delivery_cost.pot b/stock_picking_report_delivery_cost/i18n/stock_picking_report_delivery_cost.pot new file mode 100644 index 0000000000..dceab063f7 --- /dev/null +++ b/stock_picking_report_delivery_cost/i18n/stock_picking_report_delivery_cost.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_delivery_cost +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_picking_report_delivery_cost +#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_picking +msgid "Delivery cost:" +msgstr "" + +#. module: stock_picking_report_delivery_cost +#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_delivery_document +msgid "Delivery cost" +msgstr "" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model.fields,field_description:stock_picking_report_delivery_cost.field_stock_picking__carrier_price_for_report +msgid "Carrier Price For Report" +msgstr "" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model.fields,field_description:stock_picking_report_delivery_cost.field_stock_picking__currency_id +msgid "Currency" +msgstr "" + +#. module: stock_picking_report_delivery_cost +#: model:ir.model,name:stock_picking_report_delivery_cost.model_stock_picking +msgid "Transfer" +msgstr "" diff --git a/stock_picking_report_delivery_cost/models/__init__.py b/stock_picking_report_delivery_cost/models/__init__.py new file mode 100644 index 0000000000..406fd74d73 --- /dev/null +++ b/stock_picking_report_delivery_cost/models/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import stock_picking diff --git a/stock_picking_report_delivery_cost/models/stock_picking.py b/stock_picking_report_delivery_cost/models/stock_picking.py new file mode 100644 index 0000000000..abc20a0ba8 --- /dev/null +++ b/stock_picking_report_delivery_cost/models/stock_picking.py @@ -0,0 +1,27 @@ +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, fields, models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + # Needed for fields.Monetary + currency_id = fields.Many2one( + related="sale_id.currency_id", + readonly=True, + string="Currency", + related_sudo=True, # for avoiding access problems + ) + carrier_price_for_report = fields.Monetary( + compute="_compute_carrier_price_for_report", + ) + + @api.depends("sale_id", "carrier_price") + def _compute_carrier_price_for_report(self): + for picking in self: + so_lines = picking.sale_id.order_line.filtered("is_delivery") + if so_lines: + picking.carrier_price_for_report = sum(so_lines.mapped("price_unit")) + else: + picking.carrier_price_for_report = picking.carrier_price diff --git a/stock_picking_report_delivery_cost/pyproject.toml b/stock_picking_report_delivery_cost/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/stock_picking_report_delivery_cost/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_picking_report_delivery_cost/readme/CONTRIBUTORS.md b/stock_picking_report_delivery_cost/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..8dd3ba6ebd --- /dev/null +++ b/stock_picking_report_delivery_cost/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- [Tecnativa](https://www.tecnativa.com): + - Pedro M. Baeza + - Víctor Martínez + - Pilar Vargas +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/stock_picking_report_delivery_cost/readme/DESCRIPTION.md b/stock_picking_report_delivery_cost/readme/DESCRIPTION.md new file mode 100644 index 0000000000..a9241b0095 --- /dev/null +++ b/stock_picking_report_delivery_cost/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module shows in the delivery slip and picking operations reports +the cost of the delivery method according the rate computed on the fly +according same conditions as standard delivery module would do. diff --git a/stock_picking_report_delivery_cost/readme/USAGE.md b/stock_picking_report_delivery_cost/readme/USAGE.md new file mode 100644 index 0000000000..1efc9df783 --- /dev/null +++ b/stock_picking_report_delivery_cost/readme/USAGE.md @@ -0,0 +1,6 @@ +To use this module, you need to: + +1. Go to *Inventory \> Operations \> Transfers* and pick one not in + state *Done* or *Cancelled*. +2. Click on *Print \> Delivery Slip* or *Print \> Picking Operations*. +3. You will see in the report the computed delivery cost. diff --git a/stock_picking_report_delivery_cost/report/report_deliveryslip.xml b/stock_picking_report_delivery_cost/report/report_deliveryslip.xml new file mode 100644 index 0000000000..4cfb2cb1e8 --- /dev/null +++ b/stock_picking_report_delivery_cost/report/report_deliveryslip.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/stock_picking_report_delivery_cost/report/report_shipping.xml b/stock_picking_report_delivery_cost/report/report_shipping.xml new file mode 100644 index 0000000000..5f7f176462 --- /dev/null +++ b/stock_picking_report_delivery_cost/report/report_shipping.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/stock_picking_report_delivery_cost/static/description/icon.png b/stock_picking_report_delivery_cost/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/stock_picking_report_delivery_cost/static/description/icon.png differ diff --git a/stock_picking_report_delivery_cost/static/description/index.html b/stock_picking_report_delivery_cost/static/description/index.html new file mode 100644 index 0000000000..9d01951778 --- /dev/null +++ b/stock_picking_report_delivery_cost/static/description/index.html @@ -0,0 +1,445 @@ + + + + + +Delivery cost in Picking Reports + + + +
+

Delivery cost in Picking Reports

+ + +

Beta License: AGPL-3 OCA/delivery-carrier Translate me on Weblate Try me on Runboat

+

This module shows in the delivery slip and picking operations reports +the cost of the delivery method according the rate computed on the fly +according same conditions as standard delivery module would do.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Inventory > Operations > Transfers and pick one not in state +Done or Cancelled.
  2. +
  3. Click on Print > Delivery Slip or Print > Picking Operations.
  4. +
  5. You will see in the report the computed delivery cost.
  6. +
+
+
+

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

+ +
+
+

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/delivery-carrier 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_delivery_cost/tests/__init__.py b/stock_picking_report_delivery_cost/tests/__init__.py new file mode 100644 index 0000000000..c2d563823d --- /dev/null +++ b/stock_picking_report_delivery_cost/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_picking_report_delivery_cost diff --git a/stock_picking_report_delivery_cost/tests/test_stock_picking_report_delivery_cost.py b/stock_picking_report_delivery_cost/tests/test_stock_picking_report_delivery_cost.py new file mode 100644 index 0000000000..c1b4773c8f --- /dev/null +++ b/stock_picking_report_delivery_cost/tests/test_stock_picking_report_delivery_cost.py @@ -0,0 +1,72 @@ +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests import Form, common + + +class TestStockPickingReportDeliveryCost(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env["res.partner"].create({"name": "Test contact"}) + cls.product = cls.env["product.product"].create( + {"name": "Test product", "type": "consu"} + ) + cls.carrier_product = cls.env["product.product"].create( + { + "name": "Test product", + "type": "service", + "list_price": 5, + "taxes_id": False, + } + ) + cls.carrier = cls.env["delivery.carrier"].create( + { + "name": "Test carrier", + "delivery_type": "fixed", + "product_id": cls.carrier_product.id, + } + ) + cls.pricelist = cls.env["product.pricelist"].create({"name": "Test pricelist"}) + cls.order = cls.env["sale.order"].create( + { + "partner_id": cls.partner.id, + "carrier_id": cls.carrier.id, + "pricelist_id": cls.pricelist.id, + "order_line": [ + ( + 0, + 0, + { + "name": cls.product.name, + "product_id": cls.product.id, + "product_uom_qty": 2, + "product_uom": cls.product.uom_id.id, + "price_unit": 300.00, + }, + ), + ], + } + ) + + def test_carrier_price_for_report_before(self): + delivery_wizard = Form( + self.env["choose.delivery.carrier"].with_context( + default_order_id=self.order.id, + default_carrier_id=self.carrier.id, + ) + ) + choose_delivery_carrier = delivery_wizard.save() + choose_delivery_carrier.button_confirm() + self.order.action_confirm() + picking = self.order.picking_ids + self.assertAlmostEqual(picking.carrier_price_for_report, 5) + + def test_carrier_price_for_report_after(self): + self.order.action_confirm() + picking = self.order.picking_ids + self.assertAlmostEqual(picking.carrier_price_for_report, 0) + move = picking.move_ids_without_package + move.quantity = move.product_qty + picking.button_validate() + self.assertAlmostEqual(picking.carrier_price_for_report, 5)