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

[14.0] delivery_carrier_label_default: Migrate to version 14.0 #456

Closed
wants to merge 9 commits into from
90 changes: 90 additions & 0 deletions delivery_carrier_label_default/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
================================
Default label for carrier labels
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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/14.0/delivery_carrier_label_default
: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-14-0/delivery-carrier-14-0-delivery_carrier_label_default
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/99/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module defines a basic label to print when no specific carrier is selected.

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

* Make the label report configurable at the company level

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:%20delivery_carrier_label_default%0Aversion:%2014.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
~~~~~~~

* Camptocamp

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

* `Camptocamp <https://camptocamp.com>`_:
* Yannick Vaucher <[email protected]>
* Sébastien Alix <[email protected]>
* Iryna Vyshnevska <[email protected]>
* `Tecnativa <https://tecnativa.com/>`_:
* Sergio Teruel <[email protected]>
* `Trobz <https://trobz.com>`_:
* Son Ho <[email protected]>

Other credits
~~~~~~~~~~~~~

The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp

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/14.0/delivery_carrier_label_default>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions delivery_carrier_label_default/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions delivery_carrier_label_default/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2013-2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Default label for carrier labels",
"summary": "This module defines a basic label to print "
"when no specific carrier is selected.",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "Delivery",
"website": "https://github.com/OCA/delivery-carrier",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": [
"base_delivery_carrier_label",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this dependency really needed? Such a large one for a module that could stand alone...

],
"data": [
"views/report_default_label.xml",
"views/reports.xml",
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * delivery_carrier_label_default
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.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: delivery_carrier_label_default
#: model:ir.actions.report,name:delivery_carrier_label_default.default_label
msgid "Shipping Label"
msgstr ""

#. module: delivery_carrier_label_default
#: model:ir.model,name:delivery_carrier_label_default.model_stock_picking
msgid "Transfer"
msgstr ""

2 changes: 2 additions & 0 deletions delivery_carrier_label_default/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_picking
from . import delivery_carrier
24 changes: 24 additions & 0 deletions delivery_carrier_label_default/models/delivery_carrier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2012 Akretion <http://www.akretion.com>.
# Copyright 2013-2016 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class DeliveryCarrier(models.Model):
_inherit = "delivery.carrier"

def alternative_send_shipping(self, pickings):
default_label = pickings.generate_default_label()
labels = []
for package in pickings.package_ids:
pack_label = default_label.copy()
pack_label["tracking_number"] = package.id
labels.append(pack_label)
return [
{
"exact_price": pickings.carrier_price,
"tracking_number": pickings.package_ids,
"labels": labels,
}
]
20 changes: 20 additions & 0 deletions delivery_carrier_label_default/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2013-2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
import base64

from odoo import models


class StockPicking(models.Model):
_inherit = "stock.picking"

def generate_default_label(self):
"""Generate a label from a qweb report."""
self.ensure_one()
report = self.env.ref("delivery_carrier_label_default.default_label")
file_, file_type = report._render(res_ids=self.ids)
return {
"name": "%s.%s" % (report.name, file_type),
"file": base64.b64encode(file_),
"file_type": file_type,
}
8 changes: 8 additions & 0 deletions delivery_carrier_label_default/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* `Camptocamp <https://camptocamp.com>`_:
* Yannick Vaucher <[email protected]>
* Sébastien Alix <[email protected]>
* Iryna Vyshnevska <[email protected]>
* `Tecnativa <https://tecnativa.com/>`_:
* Sergio Teruel <[email protected]>
* `Trobz <https://trobz.com>`_:
* Son Ho <[email protected]>
1 change: 1 addition & 0 deletions delivery_carrier_label_default/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp
1 change: 1 addition & 0 deletions delivery_carrier_label_default/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module defines a basic label to print when no specific carrier is selected.
1 change: 1 addition & 0 deletions delivery_carrier_label_default/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Make the label report configurable at the company level
Loading