Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] stock_picking_report_delivery_cost: Migration to version 15.0 #595

Merged
Merged
6 changes: 6 additions & 0 deletions setup/stock_picking_report_delivery_cost/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
89 changes: 89 additions & 0 deletions stock_picking_report_delivery_cost/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
================================
Delivery cost in Picking Reports
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fdelivery--carrier-lightgray.png?logo=github
:target: https://github.com/OCA/delivery-carrier/tree/15.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-15-0/delivery-carrier-15-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/webui/builds.html?repo=OCA/delivery-carrier&target_branch=15.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:

#. Go to *Inventory > Operations > Transfers* and pick one not in state *Done*
or *Cancelled*.
#. Click on *Print > Delivery Slip* or *Print > Picking Operations*.
#. You will see in the report the computed delivery cost.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-carrier/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 <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20stock_picking_report_delivery_cost%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
* Víctor Martínez
* Pilar Vargas

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 <https://github.com/OCA/delivery-carrier/tree/15.0/stock_picking_report_delivery_cost>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions stock_picking_report_delivery_cost/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models
15 changes: 15 additions & 0 deletions stock_picking_report_delivery_cost/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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": "15.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": ["delivery"],
"data": ["report/report_shipping.xml", "report/report_deliveryslip.xml"],
}
38 changes: 38 additions & 0 deletions stock_picking_report_delivery_cost/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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_delivery_document
#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_picking
msgid "<strong>Delivery cost:</strong>"
msgstr "<strong>Coste de envío:</strong>"

#. 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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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"
"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_delivery_document
#: model_terms:ir.ui.view,arch_db:stock_picking_report_delivery_cost.report_picking
msgid "<strong>Delivery cost:</strong>"
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 ""
2 changes: 2 additions & 0 deletions stock_picking_report_delivery_cost/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import stock_picking
27 changes: 27 additions & 0 deletions stock_picking_report_delivery_cost/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions stock_picking_report_delivery_cost/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
* Víctor Martínez
* Pilar Vargas
3 changes: 3 additions & 0 deletions stock_picking_report_delivery_cost/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions stock_picking_report_delivery_cost/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To use this module, you need to:

#. Go to *Inventory > Operations > Transfers* and pick one not in state *Done*
or *Cancelled*.
#. Click on *Print > Delivery Slip* or *Print > Picking Operations*.
#. You will see in the report the computed delivery cost.
18 changes: 18 additions & 0 deletions stock_picking_report_delivery_cost/report/report_deliveryslip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 Tecnativa - Pedro M. Baeza
Copyright 2020 Tecnativa - Víctor Martínez
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="report_delivery_document" inherit_id="stock.report_delivery_document">
<xpath expr="//div[@name='div_sched_date']" position="after">
<div
t-if="o.carrier_price_for_report"
class="col-auto"
name="div_carrier_price_for_report"
>
<strong>Delivery cost:</strong>
<p t-field="o.carrier_price_for_report" />
</div>
</xpath>
</template>
</odoo>
17 changes: 17 additions & 0 deletions stock_picking_report_delivery_cost/report/report_shipping.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 Tecnativa - Pedro M. Baeza
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="report_picking" inherit_id="stock.report_picking">
<xpath expr="//div[@name='div_sched_date']" position="after">
<div
t-if="o.carrier_price_for_report"
class="col-auto"
name="div_carrier_price_for_report"
>
<strong>Delivery cost:</strong>
<p t-field="o.carrier_price_for_report" />
</div>
</xpath>
</template>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading