mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[11.0][MIG] stock_move_location: fixing/improving code + add a roadmap
for further improvements
This commit is contained in:
@@ -1,21 +1,98 @@
|
||||
**This file is going to be generated by oca-gen-addon-readme.**
|
||||
===================
|
||||
Move Stock Location
|
||||
===================
|
||||
|
||||
*Manual changes will be overwritten.*
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
Please provide content in the ``readme`` directory:
|
||||
.. |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%2Fstock--logistics--warehouse-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_move_location
|
||||
: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-11-0/stock-logistics-warehouse-11-0-stock_move_location
|
||||
: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/11.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
* **DESCRIPTION.rst** (required)
|
||||
* INSTALL.rst (optional)
|
||||
* CONFIGURE.rst (optional)
|
||||
* **USAGE.rst** (optional, highly recommended)
|
||||
* DEVELOP.rst (optional)
|
||||
* ROADMAP.rst (optional)
|
||||
* HISTORY.rst (optional, recommended)
|
||||
* **CONTRIBUTORS.rst** (optional, highly recommended)
|
||||
* CREDITS.rst (optional)
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
Content of this README will also be drawn from the addon manifest,
|
||||
from keys such as name, authors, maintainers, development_status,
|
||||
and license.
|
||||
This module allows to move entire location of products from one place to another
|
||||
|
||||
A good, one sentence summary in the manifest is also highly recommended.
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
* A new menuitem Stock > Move from location... opens a wizard
|
||||
where 2 location ca be specified.
|
||||
* Select origin and destination locations and press "IMMEDIATE TRANSFER" or "PLANNED TRANSFER"
|
||||
* Press `ADD ALL` button to add all products available
|
||||
* Those lines can be edited. Move quantity can't be more than a max available quantity
|
||||
* Move doesn't care about the reservations and will move stuff anyway
|
||||
* If during your operation with the wizard the real quantity will change
|
||||
it will move only the available quantity at the button press
|
||||
* Products will be moved and a form view of picking that did that will show up
|
||||
* If "PLANNED TRANSFER" is used - the picking won't be validated automatically
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
Change the current implementation (suggested by Denis Roussel from ACSONE):
|
||||
|
||||
* A new parameter on stock picking types : 'Product Change Location' (with a little help).
|
||||
* With this, go to the dashboard, create a picking with that type.
|
||||
* Add a button on the picking form which is visible with that type that fill in the picking as now
|
||||
* Nice to have: add a magic button on locations that with context creates a new picking of that type with the origin location already filled in.
|
||||
|
||||
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_move_location%0Aversion:%2011.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
|
||||
~~~~~~~
|
||||
|
||||
* Julius Network Solutions
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Mathieu Vatel <mathieu@julius.fr>
|
||||
* Mykhailo Panarin <m.panarin@mobilunity.com>
|
||||
|
||||
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/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_move_location>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 11.0+e\n"
|
||||
"Project-Id-Version: Odoo Server 11.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-01-08 23:43+0000\n"
|
||||
"PO-Revision-Date: 2019-01-08 23:43+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -30,6 +28,11 @@ msgstr ""
|
||||
msgid "Clear all"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_picking_id
|
||||
msgid "Connected Picking"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_create_uid
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_line_create_uid
|
||||
@@ -42,6 +45,11 @@ msgstr ""
|
||||
msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_line_custom
|
||||
msgid "Custom line"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_destination_location_id
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_line_destination_location_id
|
||||
@@ -61,8 +69,8 @@ msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model,name:stock_move_location.model_stock_inventory
|
||||
msgid "Inventory"
|
||||
#: model:ir.ui.view,arch_db:stock_move_location.view_wiz_stock_move_location_form_stock_move_location
|
||||
msgid "Immediate Transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
@@ -70,11 +78,6 @@ msgstr ""
|
||||
msgid "Inventory Details"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model,name:stock_move_location.model_stock_inventory_line
|
||||
msgid "Inventory Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location___last_update
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_line___last_update
|
||||
@@ -103,11 +106,6 @@ msgstr ""
|
||||
msgid "Maximum available quantity"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.ui.view,arch_db:stock_move_location.view_wiz_stock_move_location_form_stock_move_location
|
||||
msgid "Move Location"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_stock_move_location_line_ids
|
||||
msgid "Move Location lines"
|
||||
@@ -125,7 +123,7 @@ msgid "Move location Wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: code:addons/stock_move_location/wizard/stock_move_location_line.py:56
|
||||
#: code:addons/stock_move_location/wizard/stock_move_location_line.py:70
|
||||
#, python-format
|
||||
msgid "Move quantity can not exceed max quantity or be negative"
|
||||
msgstr ""
|
||||
@@ -136,6 +134,16 @@ msgstr ""
|
||||
msgid "Origin Location"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_stock_move_location_move
|
||||
msgid "Part of move location"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.ui.view,arch_db:stock_move_location.view_wiz_stock_move_location_form_stock_move_location
|
||||
msgid "Planned Transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,field_description:stock_move_location.field_wiz_stock_move_location_line_product_id
|
||||
msgid "Product"
|
||||
@@ -151,11 +159,21 @@ msgstr ""
|
||||
msgid "Quantity to move"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model,name:stock_move_location.model_stock_move
|
||||
msgid "Stock Move"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.ui.view,arch_db:stock_move_location.view_wiz_stock_move_location_form_stock_move_location
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model.fields,help:stock_move_location.field_stock_move_location_move
|
||||
msgid "Whether this move is a part of stock_location moves"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_location
|
||||
#: model:ir.model,name:stock_move_location.model_wiz_stock_move_location
|
||||
msgid "wiz.stock.move.location"
|
||||
|
||||
@@ -9,12 +9,11 @@ class StockMove(models.Model):
|
||||
|
||||
location_move = fields.Boolean(
|
||||
string="Part of move location",
|
||||
help="Wether this move is a part of stock_location moves",
|
||||
help="Whether this move is a part of stock_location moves",
|
||||
)
|
||||
|
||||
@api.depends("location_move")
|
||||
def _compute_show_details_visible(self):
|
||||
super()._compute_show_details_visible()
|
||||
for move in self:
|
||||
if move.location_move:
|
||||
move.show_details_visible = True
|
||||
move.show_details_visible = move.location_move
|
||||
|
||||
6
stock_move_location/readme/ROADMAP.rst
Normal file
6
stock_move_location/readme/ROADMAP.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
Change the current implementation (suggested by Denis Roussel from ACSONE):
|
||||
|
||||
* A new parameter on stock picking types : 'Product Change Location' (with a little help).
|
||||
* With this, go to the dashboard, create a picking with that type.
|
||||
* Add a button on the picking form which is visible with that type that fill in the picking as now
|
||||
* Nice to have: add a magic button on locations that with context creates a new picking of that type with the origin location already filled in.
|
||||
@@ -4,7 +4,7 @@
|
||||
* Press `ADD ALL` button to add all products available
|
||||
* Those lines can be edited. Move quantity can't be more than a max available quantity
|
||||
* Move doesn't care about the reservations and will move stuff anyway
|
||||
* If during you operation with the wizard the real quantity will change
|
||||
* If during your operation with the wizard the real quantity will change
|
||||
it will move only the available quantity at the button press
|
||||
* Products will be moved and a form view of picking that did that will show up
|
||||
* If "PLANNED TRANSFER" is used - the picking won't be validated automatically
|
||||
|
||||
447
stock_move_location/static/description/index.html
Normal file
447
stock_move_location/static/description/index.html
Normal file
@@ -0,0 +1,447 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<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.14: http://docutils.sourceforge.net/" />
|
||||
<title>Move Stock Location</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="move-stock-location">
|
||||
<h1 class="title">Move Stock Location</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-warehouse/tree/11.0/stock_move_location"><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-11-0/stock-logistics-warehouse-11-0-stock_move_location"><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/11.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 move entire location of products from one place to another</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
|
||||
<ul class="simple">
|
||||
<li>A new menuitem Stock > Move from location… opens a wizard
|
||||
where 2 location ca be specified.</li>
|
||||
<li>Select origin and destination locations and press “IMMEDIATE TRANSFER” or “PLANNED TRANSFER”</li>
|
||||
<li>Press <cite>ADD ALL</cite> button to add all products available</li>
|
||||
<li>Those lines can be edited. Move quantity can’t be more than a max available quantity</li>
|
||||
<li>Move doesn’t care about the reservations and will move stuff anyway</li>
|
||||
<li>If during your operation with the wizard the real quantity will change
|
||||
it will move only the available quantity at the button press</li>
|
||||
<li>Products will be moved and a form view of picking that did that will show up</li>
|
||||
<li>If “PLANNED TRANSFER” is used - the picking won’t be validated automatically</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
|
||||
<p>Change the current implementation (suggested by Denis Roussel from ACSONE):</p>
|
||||
<ul class="simple">
|
||||
<li>A new parameter on stock picking types : ‘Product Change Location’ (with a little help).</li>
|
||||
<li>With this, go to the dashboard, create a picking with that type.</li>
|
||||
<li>Add a button on the picking form which is visible with that type that fill in the picking as now</li>
|
||||
<li>Nice to have: add a magic button on locations that with context creates a new picking of that type with the origin location already filled in.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
|
||||
<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_move_location%0Aversion:%2011.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">
|
||||
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Julius Network Solutions</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Mathieu Vatel <<a class="reference external" href="mailto:mathieu@julius.fr">mathieu@julius.fr</a>></li>
|
||||
<li>Mykhailo Panarin <<a class="reference external" href="mailto:m.panarin@mobilunity.com">m.panarin@mobilunity.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id7">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/11.0/stock_move_location">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>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -8,6 +8,10 @@ from odoo.exceptions import ValidationError
|
||||
|
||||
class TestMoveLocation(TestsCommon):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.setup_product_amounts()
|
||||
|
||||
def _create_wizard(self, origin_location, destination_location):
|
||||
return self.wizard_obj.create({
|
||||
"origin_location_id": origin_location.id,
|
||||
@@ -15,9 +19,7 @@ class TestMoveLocation(TestsCommon):
|
||||
})
|
||||
|
||||
def test_move_location_wizard(self):
|
||||
"""Test a simple move.
|
||||
"""
|
||||
self.setup_product_amounts()
|
||||
"""Test a simple move."""
|
||||
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
|
||||
wizard.add_lines()
|
||||
wizard.action_move_location()
|
||||
@@ -47,18 +49,14 @@ class TestMoveLocation(TestsCommon):
|
||||
)
|
||||
|
||||
def test_move_location_wizard_amount(self):
|
||||
"""Can't move more than exists
|
||||
"""
|
||||
self.setup_product_amounts()
|
||||
"""Can't move more than exists."""
|
||||
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
|
||||
wizard.add_lines()
|
||||
with self.assertRaises(ValidationError):
|
||||
wizard.stock_move_location_line_ids[0].move_quantity += 1
|
||||
|
||||
def test_move_location_wizard_ignore_reserved(self):
|
||||
"""Can't move more than exists
|
||||
"""
|
||||
self.setup_product_amounts()
|
||||
"""Can't move more than exists."""
|
||||
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
|
||||
wizard.add_lines()
|
||||
# reserve some quants
|
||||
@@ -86,9 +84,7 @@ class TestMoveLocation(TestsCommon):
|
||||
)
|
||||
|
||||
def test_wizard_clear_lines(self):
|
||||
"""Test lines getting cleared properly
|
||||
"""
|
||||
self.setup_product_amounts()
|
||||
"""Test lines getting cleared properly."""
|
||||
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
|
||||
wizard.add_lines()
|
||||
self.assertEqual(len(wizard.stock_move_location_line_ids), 4)
|
||||
@@ -96,9 +92,7 @@ class TestMoveLocation(TestsCommon):
|
||||
self.assertEqual(len(wizard.stock_move_location_line_ids), 0)
|
||||
|
||||
def test_planned_transfer(self):
|
||||
"""Test planned transfer
|
||||
"""
|
||||
self.setup_product_amounts()
|
||||
"""Test planned transfer."""
|
||||
wizard = self._create_wizard(self.internal_loc_1, self.internal_loc_2)
|
||||
wizard.add_lines()
|
||||
wizard.with_context({'planned': True}).action_move_location()
|
||||
|
||||
@@ -36,19 +36,6 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
def _onchange_locations(self):
|
||||
self._clear_lines()
|
||||
|
||||
@api.onchange("stock_move_location_line_ids")
|
||||
def _onchange_stock_move_location_line_ids(self):
|
||||
lines_to_update = self.stock_move_location_line_ids.filtered(
|
||||
lambda x: x.custom is True and
|
||||
not all([x.origin_location_id, x.destination_location_id])
|
||||
)
|
||||
lines_to_update.update({
|
||||
"origin_location_id": self.origin_location_id,
|
||||
"destination_location_id": self.destination_location_id,
|
||||
})
|
||||
# for an easier extension of this function
|
||||
return lines_to_update
|
||||
|
||||
def _clear_lines(self):
|
||||
origin = self.origin_location_id
|
||||
destination = self.destination_location_id
|
||||
@@ -141,29 +128,27 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
})
|
||||
return action
|
||||
|
||||
def _get_group_quants_sql(self):
|
||||
def _get_group_quants(self):
|
||||
location_id = self.origin_location_id.id
|
||||
company = self.env['res.company']._company_default_get(
|
||||
'stock.inventory',
|
||||
)
|
||||
return """
|
||||
SELECT product_id, lot_id, SUM(quantity)
|
||||
FROM stock_quant
|
||||
WHERE location_id = {location_id} AND company_id = {company_id}
|
||||
GROUP BY product_id, lot_id
|
||||
""".format(
|
||||
location_id=location_id,
|
||||
company_id=company.id,
|
||||
)
|
||||
# Using sql as search_group doesn't support aggregation functions
|
||||
# leading to overhead in queries to DB
|
||||
query = """
|
||||
SELECT product_id, lot_id, SUM(quantity)
|
||||
FROM stock_quant
|
||||
WHERE location_id = %s
|
||||
AND company_id = %s
|
||||
GROUP BY product_id, lot_id
|
||||
"""
|
||||
self.env.cr.execute(query, (location_id, company.id))
|
||||
return self.env.cr.dictfetchall()
|
||||
|
||||
def _get_stock_move_location_lines_values(self):
|
||||
product_obj = self.env['product.product']
|
||||
|
||||
# Using sql as search_group doesn't support aggregation functions
|
||||
# leading to overhead in queries to DB
|
||||
self.env.cr.execute(self._get_group_quants_sql())
|
||||
product_data = []
|
||||
for group in self.env.cr.dictfetchall():
|
||||
for group in self._get_group_quants():
|
||||
product = product_obj.browse(group.get("product_id")).exists()
|
||||
product_data.append({
|
||||
'product_id': product.id,
|
||||
@@ -181,11 +166,13 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
|
||||
def add_lines(self):
|
||||
self.ensure_one()
|
||||
line_model = self.env["wiz.stock.move.location.line"]
|
||||
if not self.stock_move_location_line_ids:
|
||||
for line_val in self._get_stock_move_location_lines_values():
|
||||
if line_val.get('max_quantity') <= 0:
|
||||
continue
|
||||
self.env["wiz.stock.move.location.line"].create(line_val)
|
||||
line = line_model.create(line_val)
|
||||
line.onchange_product_id()
|
||||
return {
|
||||
"type": "ir.actions.do_nothing",
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
<tree string="Inventory Details" editable="bottom" decoration-info="move_quantity != max_quantity" decoration-danger="(move_quantity < 0) or (move_quantity > max_quantity)">
|
||||
<field name="product_id" domain="[('type','=','product')]"/>
|
||||
<field name="product_uom_id" string="UoM" groups="product.group_uom"/>
|
||||
<field name="origin_location_id" readonly="1" />
|
||||
<field name="destination_location_id" readonly="1" />
|
||||
<field name="origin_location_id" readonly="1" force_save="1"/>
|
||||
<field name="destination_location_id" readonly="1" force_save="1"/>
|
||||
<field name="lot_id" domain="[('product_id', '=', product_id)]" context="{'default_product_id': product_id}" groups="stock.group_production_lot" options="{'no_create': True}"/>
|
||||
<field name="move_quantity"/>
|
||||
<field name="custom" invisible="1" />
|
||||
|
||||
@@ -52,22 +52,43 @@ class StockMoveLocationWizardLine(models.TransientModel):
|
||||
default=True,
|
||||
)
|
||||
|
||||
@api.model
|
||||
def get_rounding(self):
|
||||
return self.env.ref("product.decimal_product_uom").digits or 3
|
||||
@staticmethod
|
||||
def _compare(qty1, qty2, precision_rounding):
|
||||
return float_compare(
|
||||
qty1, qty2,
|
||||
precision_rounding=precision_rounding)
|
||||
|
||||
@api.constrains("max_quantity", "move_quantity")
|
||||
def _constraint_max_move_quantity(self):
|
||||
for record in self:
|
||||
if (float_compare(
|
||||
record.move_quantity,
|
||||
record.max_quantity, self.get_rounding()) == 1 or
|
||||
float_compare(record.move_quantity, 0.0,
|
||||
self.get_rounding()) == -1):
|
||||
rounding = record.product_uom_id.rounding
|
||||
move_qty_gt_max_qty = self._compare(
|
||||
record.move_quantity, record.max_quantity, rounding) == 1
|
||||
move_qty_lt_0 = self._compare(
|
||||
record.move_quantity, 0.0, rounding) == -1
|
||||
if (move_qty_gt_max_qty or move_qty_lt_0):
|
||||
raise ValidationError(_(
|
||||
"Move quantity can not exceed max quantity or be negative"
|
||||
))
|
||||
|
||||
@api.onchange('product_id', 'lot_id')
|
||||
def onchange_product_id(self):
|
||||
self.product_uom_id = self.product_id.uom_id
|
||||
wiz = self.move_location_wizard_id
|
||||
search_args = [
|
||||
('location_id', '=', wiz.origin_location_id.id),
|
||||
('product_id', '=', self.product_id.id),
|
||||
]
|
||||
if self.lot_id:
|
||||
search_args.append(('lot_id', '=', self.lot_id.id))
|
||||
else:
|
||||
search_args.append(('lot_id', '=', False))
|
||||
res = self.env['stock.quant'].read_group(search_args, ['quantity'], [])
|
||||
max_quantity = res[0]['quantity']
|
||||
self.max_quantity = max_quantity
|
||||
self.origin_location_id = wiz.origin_location_id
|
||||
self.destination_location_id = wiz.destination_location_id
|
||||
|
||||
def create_move_lines(self, picking, move):
|
||||
for line in self:
|
||||
values = line._get_move_line_values(picking, move)
|
||||
@@ -103,48 +124,23 @@ class StockMoveLocationWizardLine(models.TransientModel):
|
||||
if self.env.context.get("planned"):
|
||||
# for planned transfer we don't care about the amounts at all
|
||||
return self.move_quantity
|
||||
# switched to sql here to improve performance and lower db queries
|
||||
self.env.cr.execute(self._get_specific_quants_sql())
|
||||
available_qty = self.env.cr.fetchone()
|
||||
search_args = [
|
||||
('location_id', '=', self.origin_location_id.id),
|
||||
('product_id', '=', self.product_id.id),
|
||||
]
|
||||
if self.lot_id:
|
||||
search_args.append(('lot_id', '=', self.lot_id.id))
|
||||
else:
|
||||
search_args.append(('lot_id', '=', False))
|
||||
res = self.env['stock.quant'].read_group(search_args, ['quantity'], [])
|
||||
available_qty = res[0]['quantity']
|
||||
if not available_qty:
|
||||
# if it is immediate transfer and product doesn't exist in that
|
||||
# location -> make the transfer of 0.
|
||||
return 0
|
||||
available_qty = available_qty[0]
|
||||
if float_compare(
|
||||
available_qty,
|
||||
self.move_quantity, self.get_rounding()) == -1:
|
||||
rounding = self.product_uom_id.rounding
|
||||
available_qty_lt_move_qty = self._compare(
|
||||
available_qty, self.move_quantity, rounding) == -1
|
||||
if available_qty_lt_move_qty:
|
||||
return available_qty
|
||||
return self.move_quantity
|
||||
|
||||
def _get_specific_quants_sql(self):
|
||||
self.ensure_one()
|
||||
lot = "AND lot_id = {}".format(self.lot_id.id)
|
||||
if not self.lot_id:
|
||||
lot = "AND lot_id is null"
|
||||
return """
|
||||
SELECT sum(quantity)
|
||||
FROM stock_quant
|
||||
WHERE location_id = {location}
|
||||
{lot}
|
||||
AND product_id = {product}
|
||||
GROUP BY location_id, product_id, lot_id
|
||||
""".format(
|
||||
location=self.origin_location_id.id,
|
||||
product=self.product_id.id,
|
||||
lot=lot,
|
||||
)
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
res = super().create(vals)
|
||||
# update of wizard lines is extremely buggy
|
||||
# so i have to handle this additionally in create
|
||||
if not all([res.origin_location_id, res.destination_location_id]):
|
||||
or_loc_id = res.move_location_wizard_id.origin_location_id.id
|
||||
des_loc_id = res.move_location_wizard_id.destination_location_id.id
|
||||
res.write({
|
||||
"origin_location_id": or_loc_id,
|
||||
"destination_location_id": des_loc_id,
|
||||
})
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user