Skip to content

Commit

Permalink
[16.0][MIG] stock_warehouse_relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-dacosta committed Jan 29, 2024
1 parent d0beee3 commit b2823b1
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 130 deletions.
12 changes: 3 additions & 9 deletions stock_warehouse_relationship/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Stock Warehouse relationship
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:65a3639c6b885f1f5a54d26b6d714c01a4521ca1fdbe39e466386d1b6999bf79
!! source digest: sha256:82b354f748f037bca8d435f4e7a20f14144645ca9c9679b93b76c7329c10fc50
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
Expand Down Expand Up @@ -42,9 +42,6 @@ Following models are linked by this module:
* *stock.quant*
* *stock.quant.package*

You'll probably like to use `stock_location_warehouse` as well
which add `warehouse_id` on `stock.location`.

This module is inspired from the experiences of
`stock_multi_warehouse_security <https://github.com/akretion/stock-logistics-warehouse/tree/12-muli-wh-security/stock_multi_warehouse_security/>`_
on version 12.0 but has some key differences on user experience:
Expand All @@ -59,11 +56,6 @@ on version 12.0 but has some key differences on user experience:
.. contents::
:local:

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

* link inventories to warehouse(s) somehow

Bug Tracker
===========

Expand All @@ -90,6 +82,8 @@ Contributors

* Pierre Verkest <[email protected]>

* Florian da Costa <[email protected]>

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

Expand Down
2 changes: 1 addition & 1 deletion stock_warehouse_relationship/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Stock Warehouse relationship",
"summary": "Technical module to add warehouse_id field on various stock.* models",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Akretion, Pierre Verkest, Odoo Community Association (OCA)",
Expand Down

This file was deleted.

13 changes: 7 additions & 6 deletions stock_warehouse_relationship/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ def _get_move_default_warehouse(self, vals):
wh = len(whs) <= 1 and whs or self.env["stock.warehouse"]
return wh

@api.model
def create(self, vals):
if not vals.get("warehouse_id"):
wh = self._get_move_default_warehouse(vals)
vals["warehouse_id"] = wh.id or False
return super().create(vals)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if not vals.get("warehouse_id"):
wh = self._get_move_default_warehouse(vals)
vals["warehouse_id"] = wh.id or False
return super().create(vals_list)
2 changes: 2 additions & 0 deletions stock_warehouse_relationship/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* `Foodles <https://www.foodles.co>`_

* Pierre Verkest <[email protected]>

* Florian da Costa <[email protected]>
3 changes: 0 additions & 3 deletions stock_warehouse_relationship/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ Following models are linked by this module:
* *stock.quant*
* *stock.quant.package*

You'll probably like to use `stock_location_warehouse` as well
which add `warehouse_id` on `stock.location`.

This module is inspired from the experiences of
`stock_multi_warehouse_security <https://github.com/akretion/stock-logistics-warehouse/tree/12-muli-wh-security/stock_multi_warehouse_security/>`_
on version 12.0 but has some key differences on user experience:
1 change: 0 additions & 1 deletion stock_warehouse_relationship/readme/ROADMAP.rst

This file was deleted.

33 changes: 13 additions & 20 deletions stock_warehouse_relationship/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Stock Warehouse relationship</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:65a3639c6b885f1f5a54d26b6d714c01a4521ca1fdbe39e466386d1b6999bf79
!! source digest: sha256:82b354f748f037bca8d435f4e7a20f14144645ca9c9679b93b76c7329c10fc50
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_warehouse_relationship"><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 image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_warehouse_relationship"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module add relationship on various stock models to warehouses (<cite>stock.warehouse</cite>).</p>
Expand All @@ -383,8 +383,6 @@ <h1 class="title">Stock Warehouse relationship</h1>
<li><em>stock.quant</em></li>
<li><em>stock.quant.package</em></li>
</ul>
<p>You’ll probably like to use <cite>stock_location_warehouse</cite> as well
which add <cite>warehouse_id</cite> on <cite>stock.location</cite>.</p>
<p>This module is inspired from the experiences of
<a class="reference external" href="https://github.com/akretion/stock-logistics-warehouse/tree/12-muli-wh-security/stock_multi_warehouse_security/">stock_multi_warehouse_security</a>
on version 12.0 but has some key differences on user experience:</p>
Expand All @@ -397,41 +395,34 @@ <h1 class="title">Stock Warehouse relationship</h1>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-1">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-1">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>link inventories to warehouse(s) somehow</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-1">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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_warehouse_relationship%0Aversion:%2016.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="#toc-entry-3">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
<li>Pierre Verkest</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul>
<li><p class="first"><a class="reference external" href="https://www.foodles.co">Foodles</a></p>
<blockquote>
Expand All @@ -440,10 +431,12 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</ul>
</blockquote>
</li>
<li><p class="first">Florian da Costa &lt;<a class="reference external" href="mailto:florian.dacosta&#64;akretion.com">florian.dacosta&#64;akretion.com</a>&gt;</p>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-5">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
Expand Down
1 change: 1 addition & 0 deletions stock_warehouse_relationship/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_warehouse_relationship
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright 2022 Foodles (http://www.foodles.co).
# @author Pierre Verkest <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import SavepointCase
from odoo.tests.common import TransactionCase


class TestWarehouseRelationship(SavepointCase):
class TestWarehouseRelationship(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand Down Expand Up @@ -104,10 +104,10 @@ def test_stock_picking_warehouse_id(self):

def test_stock_move_warehouse_id(self):
self.assertEqual(
self.stock_picking_wh_1.move_lines.mapped("warehouse_id"), self.warehouse_1
self.stock_picking_wh_1.move_ids.mapped("warehouse_id"), self.warehouse_1
)
self.assertEqual(
self.stock_picking_wh_2.move_lines.mapped("warehouse_id"), self.warehouse_2
self.stock_picking_wh_2.move_ids.mapped("warehouse_id"), self.warehouse_2
)

def test_stock_move_line_warehouse_id(self):
Expand All @@ -124,7 +124,7 @@ def test_stock_move_line_warehouse_id(self):
def test_stock_quant_warehouse_id(self):
pickings = self.stock_picking_wh_1 | self.stock_picking_wh_2
pickings.action_assign()
pickings.move_lines.write({"quantity_done": 5})
pickings.move_ids.write({"quantity_done": 5})
pickings.button_validate()

self.assertEqual(
Expand Down Expand Up @@ -180,5 +180,5 @@ def test_create_picking_with_picking_type(self):
)
stock_picking.action_assign()
self.assertEqual(
self.stock_picking_wh_2.move_lines.mapped("warehouse_id"), self.warehouse_2
self.stock_picking_wh_2.move_ids.mapped("warehouse_id"), self.warehouse_2
)
2 changes: 1 addition & 1 deletion stock_warehouse_relationship/views/stock_move_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.stock_move_line_view_search" />
<field name="arch" type="xml">
<field name="location_dest_id" position="after">
<field name="owner_id" position="after">
<field name="warehouse_id" />
</field>
</field>
Expand Down

0 comments on commit b2823b1

Please sign in to comment.