[MIG] stock_measuring_device: Migration to 14.0

This commit is contained in:
Hai Lang
2021-09-09 17:52:55 +07:00
parent 22b5d41a9f
commit c27fe93565
10 changed files with 53 additions and 27 deletions

View File

@@ -14,13 +14,13 @@ Stock Measuring Device
: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--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_measuring_device
:target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_measuring_device
:alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_measuring_device
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_measuring_device
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/153/13.0
:target: https://runbot.odoo-community.org/runbot/153/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -74,7 +74,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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-warehouse/issues/new?body=module:%20stock_measuring_device%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-warehouse/issues/new?body=module:%20stock_measuring_device%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.
@@ -92,6 +92,13 @@ Contributors
* Patrick Tombez <patrick.tombez@camptocamp.com>
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
* Carlos Serra Toro <carlos.serra@camptocamp.com>
* `Trobz <https://trobz.com>`_:
* Hai Lang <hailn@trobz.com>
Other credits
~~~~~~~~~~~~~
The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp
Maintainers
~~~~~~~~~~~
@@ -114,6 +121,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-gurneyalex|
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_measuring_device>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_measuring_device>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,7 +3,7 @@
{
"name": "Stock Measuring Device",
"summary": "Implement a common interface for measuring and weighing devices",
"version": "13.0.1.1.0",
"version": "14.0.1.0.0",
"category": "Warehouse",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",

View File

@@ -113,7 +113,7 @@ msgid "Last Updated on"
msgstr ""
#. module: stock_measuring_device
#: model:ir.model.fields,field_description:stock_measuring_device.field_measuring_wizard_line__lngth
#: model:ir.model.fields,field_description:stock_measuring_device.field_measuring_wizard_line__packaging_length
msgid "Length (mm)"
msgstr ""

View File

@@ -1,3 +1,5 @@
* Patrick Tombez <patrick.tombez@camptocamp.com>
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
* Carlos Serra Toro <carlos.serra@camptocamp.com>
* `Trobz <https://trobz.com>`_:
* Hai Lang <hailn@trobz.com>

View File

@@ -0,0 +1 @@
The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp

View File

@@ -1,3 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_measuring_device_inventory_manager,measuring.device.inventory.manager,stock_measuring_device.model_measuring_device,stock.group_stock_manager,1,1,1,1
access_measuring_device_inventory_user,measuring.device.inventory.user,stock_measuring_device.model_measuring_device,stock.group_stock_user,1,0,0,0
access_measuring_wizard,access_measuring_wizard,model_measuring_wizard,base.group_user,1,1,1,1
access_measuring_wizard_line,access_measuring_wizard_line,model_measuring_wizard_line,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_measuring_device_inventory_manager measuring.device.inventory.manager stock_measuring_device.model_measuring_device stock.group_stock_manager 1 1 1 1
3 access_measuring_device_inventory_user measuring.device.inventory.user stock_measuring_device.model_measuring_device stock.group_stock_user 1 0 0 0
4 access_measuring_wizard access_measuring_wizard model_measuring_wizard base.group_user 1 1 1 1
5 access_measuring_wizard_line access_measuring_wizard_line model_measuring_wizard_line base.group_user 1 1 1 1

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Stock Measuring Device</title>
<style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! 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="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.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-warehouse/tree/13.0/stock_measuring_device"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_measuring_device"><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/153/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="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.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-warehouse/tree/14.0/stock_measuring_device"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_measuring_device"><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/153/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Different manufacturers produce devices which are able to measure and weigh
packages and parcels. Each brand has a different communication protocol. This
module provides an framework to interface such devices with Odoo.</p>
@@ -388,7 +388,8 @@ Only for development or testing purpose, do not use in production.
<li><a class="reference internal" href="#credits" id="id6">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id7">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id8">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id9">Maintainers</a></li>
<li><a class="reference internal" href="#other-credits" id="id9">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id10">Maintainers</a></li>
</ul>
</li>
</ul>
@@ -423,7 +424,7 @@ measurements.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/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-warehouse/issues/new?body=module:%20stock_measuring_device%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-warehouse/issues/new?body=module:%20stock_measuring_device%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">
@@ -440,10 +441,22 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Patrick Tombez &lt;<a class="reference external" href="mailto:patrick.tombez&#64;camptocamp.com">patrick.tombez&#64;camptocamp.com</a>&gt;</li>
<li>Alexandre Fayolle &lt;<a class="reference external" href="mailto:alexandre.fayolle&#64;camptocamp.com">alexandre.fayolle&#64;camptocamp.com</a>&gt;</li>
<li>Carlos Serra Toro &lt;<a class="reference external" href="mailto:carlos.serra&#64;camptocamp.com">carlos.serra&#64;camptocamp.com</a>&gt;</li>
<li><dl class="first docutils">
<dt><a class="reference external" href="https://trobz.com">Trobz</a>:</dt>
<dd><ul class="first last">
<li>Hai Lang &lt;<a class="reference external" href="mailto:hailn&#64;trobz.com">hailn&#64;trobz.com</a>&gt;</li>
</ul>
</dd>
</dl>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id9">Other credits</a></h2>
<p>The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id9">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id10">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
@@ -451,7 +464,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/gurneyalex"><img alt="gurneyalex" src="https://github.com/gurneyalex.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_measuring_device">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_measuring_device">OCA/stock-logistics-warehouse</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>

View File

@@ -31,7 +31,7 @@ class MeasuringWizard(models.TransientModel):
"name": "Unit",
"qty": 1,
"max_weight": self.product_id.weight,
"lngth": self.product_id.product_length,
"packaging_length": self.product_id.product_length,
"width": self.product_id.product_width,
"height": self.product_id.product_height,
"is_unit_line": True,
@@ -41,7 +41,7 @@ class MeasuringWizard(models.TransientModel):
if mm_uom != product_dimension_uom:
vals.update(
{
"lngth": product_dimension_uom._compute_quantity(
"packaging_length": product_dimension_uom._compute_quantity(
self.product_id.product_length, mm_uom
),
"width": product_dimension_uom._compute_quantity(
@@ -72,7 +72,7 @@ class MeasuringWizard(models.TransientModel):
"name": pack_type.name,
"qty": 0,
"max_weight": 0,
"lngth": 0,
"packaging_length": 0,
"width": 0,
"height": 0,
"barcode": False,
@@ -83,7 +83,7 @@ class MeasuringWizard(models.TransientModel):
{
"qty": pack.qty,
"max_weight": pack.max_weight,
"lngth": pack.lngth,
"packaging_length": pack.packaging_length,
"width": pack.width,
"height": pack.height,
"barcode": pack.barcode,
@@ -108,6 +108,7 @@ class MeasuringWizard(models.TransientModel):
def action_save(self):
self.ensure_one()
mm_uom = self.env.ref("stock_measuring_device.product_uom_mm")
product_vals = {}
packaging_ids_list = []
for line in self.line_ids:
@@ -120,9 +121,10 @@ class MeasuringWizard(models.TransientModel):
"name": line.name,
"qty": line.qty,
"max_weight": line.max_weight,
"lngth": line.lngth,
"packaging_length": line.packaging_length,
"width": line.width,
"height": line.height,
"length_uom_id": mm_uom.id,
"barcode": line.barcode,
"packaging_type_id": line.packaging_type_id.id,
}
@@ -133,10 +135,9 @@ class MeasuringWizard(models.TransientModel):
packaging_ids_list.append((0, 0, vals))
else:
# Handle unit line
mm_uom = self.env.ref("stock_measuring_device.product_uom_mm")
product_vals.update(
{
"product_length": line.lngth,
"product_length": line.packaging_length,
"product_width": line.width,
"product_height": line.height,
"dimensional_uom_id": mm_uom.id,

View File

@@ -64,8 +64,8 @@
options="{'bg_color': 'lightcoral: max_weight == 0.0 and required'}"
/>
<field
name="lngth"
options="{'bg_color': 'lightcoral: lngth == 0.0 and required'}"
name="packaging_length"
options="{'bg_color': 'lightcoral: packaging_length == 0.0 and required'}"
/>
<field
name="width"

View File

@@ -14,9 +14,7 @@ class MeasuringWizardLine(models.TransientModel):
name = fields.Char("Packaging", readonly=True)
qty = fields.Float("Quantity")
max_weight = fields.Float("Weight (kg)", readonly=True)
# this is not a typo:
# https://github.com/odoo/odoo/issues/41353#issuecomment-568037415
lngth = fields.Integer("Length (mm)", readonly=True)
packaging_length = fields.Integer("Length (mm)", readonly=True)
width = fields.Integer("Width (mm)", readonly=True)
height = fields.Integer("Height (mm)", readonly=True)
volume = fields.Float(
@@ -35,10 +33,12 @@ class MeasuringWizardLine(models.TransientModel):
required = fields.Boolean(related="packaging_type_id.required", readonly=True)
is_measured = fields.Boolean()
@api.depends("lngth", "width", "height")
@api.depends("packaging_length", "width", "height")
def _compute_volume(self):
for line in self:
line.volume = (line.lngth * line.width * line.height) / 1000.0 ** 3
line.volume = (
line.packaging_length * line.width * line.height
) / 1000.0 ** 3
def measuring_select_for_measure(self):
"""Current line has been selected for measurement