[MIG] stock_location_tray: Migration to 14.0

This commit is contained in:
Tran Thanh Phuc
2021-02-10 23:41:51 +07:00
committed by Hai Lang
parent f5ecd878ff
commit d307c929c3
8 changed files with 42 additions and 20 deletions

View File

@@ -14,13 +14,13 @@ Location Trays
: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_location_tray
:target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_location_tray
: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_location_tray
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_location_tray
: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|
@@ -30,7 +30,7 @@ A tray type defines a number of columns and rows.
A location with a tray type becomes a tray, and sub-locations are automatically
created according to the columns and rows of the tray type
.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/13.0/stock_location_tray/static/description/location-tray.png
.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/14.0/stock_location_tray/static/description/location-tray.png
:alt: Location Tray
:width: 600 px
@@ -83,7 +83,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_location_tray%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_location_tray%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.
@@ -99,6 +99,14 @@ Contributors
~~~~~~~~~~~~
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Phuc Tran Thanh <phuc@trobz.com>
Other credits
~~~~~~~~~~~~~
The development of this module has been financially supported by:
* Camptocamp
Maintainers
~~~~~~~~~~~
@@ -113,6 +121,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-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_location_tray>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_location_tray>`_ 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": "Location Trays",
"summary": "Organize a location as a matrix of cells",
"version": "13.0.1.0.2",
"version": "14.0.1.0.0",
"category": "Stock",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",

View File

@@ -103,7 +103,7 @@ class StockLocation(models.Model):
def _check_before_add_tray_type(self):
if not self.tray_type_id and self.child_ids:
raise exceptions.UserError(
_("Location %s has sub-locations, it cannot be converted" " to a tray.")
_("Location %s has sub-locations, it cannot be converted to a tray.")
% (self.display_name)
)
@@ -207,7 +207,7 @@ class StockLocation(models.Model):
# trap this check (_tray_check_active) to display a
# contextual error message
raise exceptions.UserError(
_("Trays cannot be modified when " "they contain products.")
_("Trays cannot be modified when they contain products.")
)
if not tray_type:

View File

@@ -57,6 +57,7 @@ class StockLocationTrayType(models.Model):
cells = self._generate_cells_matrix(default_state=1)
record.tray_matrix = {"selected": [], "cells": cells}
@api.model
def _name_search(
self, name, args=None, operator="ilike", limit=100, name_get_uid=None
):
@@ -64,10 +65,10 @@ class StockLocationTrayType(models.Model):
domain = []
if name:
domain = ["|", ("name", operator, name), ("code", operator, name)]
tray_ids = self._search(
return self._search(
expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid
)
return self.browse(tray_ids).name_get()
def _generate_cells_matrix(self, default_state=0):
return [[default_state] * self.cols for __ in range(self.rows)]

View File

@@ -1 +1,2 @@
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Phuc Tran Thanh <phuc@trobz.com>

View File

@@ -0,0 +1,3 @@
The development of this module has been financially supported by:
* Camptocamp

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>Location Trays</title>
<style type="text/css">
@@ -367,13 +367,13 @@ 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="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-warehouse/tree/13.0/stock_location_tray"><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_location_tray"><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="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-warehouse/tree/14.0/stock_location_tray"><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_location_tray"><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>Add an optional Tray Type on Stock Locations.
A tray type defines a number of columns and rows.
A location with a tray type becomes a tray, and sub-locations are automatically
created according to the columns and rows of the tray type</p>
<div class="figure">
<img alt="Location Tray" src="https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/13.0/stock_location_tray/static/description/location-tray.png" style="width: 600px;" />
<img alt="Location Tray" src="https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/14.0/stock_location_tray/static/description/location-tray.png" style="width: 600px;" />
</div>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
@@ -389,7 +389,8 @@ created according to the columns and rows of the tray type</p>
<li><a class="reference internal" href="#credits" id="id7">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id8">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id9">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id10">Maintainers</a></li>
<li><a class="reference internal" href="#other-credits" id="id10">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id11">Maintainers</a></li>
</ul>
</li>
</ul>
@@ -434,7 +435,7 @@ tooltip maybe, if we find how to render a widget in a tooltip.</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_location_tray%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_location_tray%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">
@@ -449,16 +450,24 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<h2><a class="toc-backref" href="#id9">Contributors</a></h2>
<ul class="simple">
<li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li>
<li>Phuc Tran Thanh &lt;<a class="reference external" href="mailto:phuc&#64;trobz.com">phuc&#64;trobz.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id10">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="#id10">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id11">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-warehouse/tree/13.0/stock_location_tray">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_location_tray">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

@@ -43,7 +43,7 @@ class TestLocationTrayType(LocationTrayTypeCase):
location.tray_type_id = self.used_tray_type
location = self.used_tray_type.location_ids
self.assertTrue(location)
message = "cannot be archived.*{}.*".format(location.name)
message = "cannot be archived.\n\n.*{}*".format(location.name)
# we cannot archive used ones
with self.assertRaisesRegex(exceptions.ValidationError, message):
self.used_tray_type.active = False
@@ -55,7 +55,7 @@ class TestLocationTrayType(LocationTrayTypeCase):
location.tray_type_id = self.used_tray_type
location = self.used_tray_type.location_ids
self.assertTrue(location)
message = "size cannot be changed.*{}.*".format(location.name)
message = "size cannot be changed.\n\n.*{}*".format(location.name)
# we cannot modify size of used ones
with self.assertRaisesRegex(exceptions.ValidationError, message):
self.used_tray_type.rows = 10