Skip to content

Commit

Permalink
[MIG] delivery_package_default_shipping_weight: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dzungtran89 committed Sep 20, 2021
1 parent 4ebbb8f commit 71308b3
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 14 deletions.
21 changes: 16 additions & 5 deletions delivery_package_default_shipping_weight/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Delivery Package Default Shipping Weight
: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--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/13.0/delivery_package_default_shipping_weight
:target: https://github.com/OCA/stock-logistics-workflow/tree/14.0/delivery_package_default_shipping_weight
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-13-0/stock-logistics-workflow-13-0-delivery_package_default_shipping_weight
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-14-0/stock-logistics-workflow-14-0-delivery_package_default_shipping_weight
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/154/13.0
:target: https://runbot.odoo-community.org/runbot/154/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -40,7 +40,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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/stock-logistics-workflow/issues/new?body=module:%20delivery_package_default_shipping_weight%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20delivery_package_default_shipping_weight%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.

Expand All @@ -57,6 +57,17 @@ Contributors

* Akim Juillerat <akim.juillerat@camptocamp.com>

Trobz

* Dung Tran <dungtd@trobz.com>

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

The development of this module has been financially supported by:

* Camptocamp

Maintainers
~~~~~~~~~~~

Expand All @@ -70,6 +81,6 @@ 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-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/13.0/delivery_package_default_shipping_weight>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/14.0/delivery_package_default_shipping_weight>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions delivery_package_default_shipping_weight/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{
"name": "Delivery Package Default Shipping Weight",
"summary": "Set default package shipping weight according to packaging",
"version": "13.0.1.0.1",
"development_status": "Beta",
"version": "14.0.1.0.0",
"development_status": "Production/Stable",
"category": "Inventory",
"website": "https://github.com/OCA/stock-logistics-workflow",
"author": "Camptocamp, Odoo Community Association (OCA)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ProductPackaging(models.Model):

package_default_shipping_weight = fields.Float(
string="Default shipping weight",
digits="Stock Weight",
help="If set, this weight will be used as default value for Shipping "
"weight, when this Package Type is selected on a Package.",
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
* Akim Juillerat <akim.juillerat@camptocamp.com>

Trobz

* Dung Tran <dungtd@trobz.com>
3 changes: 3 additions & 0 deletions delivery_package_default_shipping_weight/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The development of this module has been financially supported by:

* Camptocamp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Delivery Package Default Shipping Weight</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/13.0/delivery_package_default_shipping_weight"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-13-0/stock-logistics-workflow-13-0-delivery_package_default_shipping_weight"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/154/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/14.0/delivery_package_default_shipping_weight"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-14-0/stock-logistics-workflow-14-0-delivery_package_default_shipping_weight"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/154/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows to define a Default shipping weight on Delivery packages
(<cite>product.packaging</cite>) in order to set automatically the Shipping weight on the
packages (<cite>stock.quant.package</cite>) using this Package type.</p>
Expand All @@ -378,7 +378,8 @@ <h1 class="title">Delivery Package Default Shipping Weight</h1>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
<li><a class="reference internal" href="#other-credits" id="id5">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
Expand All @@ -388,7 +389,7 @@ <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20delivery_package_default_shipping_weight%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20delivery_package_default_shipping_weight%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -404,15 +405,26 @@ <h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Akim Juillerat &lt;<a class="reference external" href="mailto:akim.juillerat&#64;camptocamp.com">akim.juillerat&#64;camptocamp.com</a>&gt;</li>
</ul>
<p>Trobz</p>
<ul class="simple">
<li>Dung Tran &lt;<a class="reference external" href="mailto:dungtd&#64;trobz.com">dungtd&#64;trobz.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id5">Other credits</a></h2>
<p>The development of this module has been financially supported by:</p>
<ul class="simple">
<li>Camptocamp</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/13.0/delivery_package_default_shipping_weight">OCA/stock-logistics-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/14.0/delivery_package_default_shipping_weight">OCA/stock-logistics-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)shipping_weight
from odoo import fields
from odoo.exceptions import ValidationError
from odoo.tests.common import SavepointCase
Expand All @@ -13,6 +13,9 @@ def setUpClass(cls):
cls.packaging = cls.env["product.packaging"].create(
{"name": "Delivery package", "package_default_shipping_weight": 10.0}
)
cls.new_packaging = cls.env["product.packaging"].create(
{"name": "Delivery package", "package_default_shipping_weight": 12.0}
)
cls.picking_type_out = cls.env.ref("stock.picking_type_out")

def test_check_negative_value(self):
Expand All @@ -29,10 +32,29 @@ def test_default_weight(self):
)
move_line = fields.first(picking.move_line_ids_without_package)
move_line.qty_done = move_line.product_uom_qty
picking.put_in_pack()
picking.action_put_in_pack()
package = move_line.result_package_id
self.assertAlmostEqual(package.shipping_weight, 0.0)
package.packaging_id = self.packaging
self.assertAlmostEqual(
package.shipping_weight, self.packaging.package_default_shipping_weight
)

def test_onchange_packaging_id(self):
picking = self.env["stock.picking"].search(
[
("picking_type_id", "=", self.picking_type_out.id),
("state", "=", "assigned"),
],
limit=1,
)
move_line = fields.first(picking.move_line_ids_without_package)
move_line.qty_done = move_line.product_uom_qty
picking.action_put_in_pack()
package = move_line.result_package_id
package.packaging_id = self.packaging
package.packaging_id = self.new_packaging
self.assertAlmostEqual(
package.shipping_weight,
package.packaging_id.package_default_shipping_weight,
)

0 comments on commit 71308b3

Please sign in to comment.