Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][MIG] stock_inventory_virtual_location #739

Merged
2 changes: 1 addition & 1 deletion account_move_line_stock_info/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Eficent,"
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"category": "Warehouse",
"installable": True,
"license": "AGPL-3",
"data": [
Expand Down
2 changes: 1 addition & 1 deletion stock_account_change_qty_reason/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Stock Account Change Quantity Reason """,
'author': 'Eficent, Odoo Community Association (OCA)',
'website': "https://github.com/OCA/stock-logistics-warehouse",
'category': 'Warehouse Management',
'category': 'Warehouse',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'depends': [
Expand Down
2 changes: 1 addition & 1 deletion stock_account_internal_move/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'name': """Stock Account Internal Move""",
'summary': """Allows tracking moves between internal locations"""
""" via accounts.""",
'category': "Warehouse Management",
'category': "Warehouse",
'version': "12.0.1.0.0",
'author': "Camptocamp SA,"
" Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion stock_account_inventory_force_date/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Stock Account Inventory Force Date",
"summary": "Force the inventory adjustments to a date in the past.",
"version": "12.0.1.0.0",
"category": "Warehouse Management",
"category": "Warehouse",
"license": "AGPL-3",
"author": "Eficent, "
"Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion stock_available_unreserved/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"version": "12.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"category": "Warehouse",
"depends": [
"stock",
],
Expand Down
2 changes: 1 addition & 1 deletion stock_change_qty_reason/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Stock Quantity Change Reason """,
'author': 'ACSONE SA/NV, Odoo Community Association (OCA)',
'website': "https://github.com/OCA/stock-logistics-warehouse",
'category': 'Warehouse Management',
'category': 'Warehouse',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'depends': [
Expand Down
2 changes: 1 addition & 1 deletion stock_cycle_count/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "Eficent, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"category": "Warehouse",
"depends": [
"stock_account",
"stock_inventory_discrepancy",
Expand Down
2 changes: 1 addition & 1 deletion stock_demand_estimate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version": "12.0.2.0.1",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"category": "Warehouse",
"depends": [
"stock",
],
Expand Down
2 changes: 1 addition & 1 deletion stock_inventory_discrepancy/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": "Eficent, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"category": "Warehouse",
"depends": ["stock"],
"data": [
'security/stock_inventory_discrepancy_security.xml',
Expand Down
2 changes: 1 addition & 1 deletion stock_inventory_exclude_sublocation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"Tecnativa, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"category": "Warehouse",
"depends": [
"stock",
],
Expand Down
2 changes: 1 addition & 1 deletion stock_inventory_lockdown/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"depends": ["stock"],
"author": "Numérigraphe, Eficent, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"category": "Warehouse",
"images": [
"images/move_error.png",
"images/location_locked.png",
Expand Down
2 changes: 1 addition & 1 deletion stock_inventory_verification_request/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "Eficent, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"category": "Warehouse",
"depends": [
"stock_inventory_discrepancy",
"mail",
Expand Down
79 changes: 79 additions & 0 deletions stock_inventory_virtual_location/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
================================
Stock Inventory Virtual Location
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/12.0/stock_inventory_virtual_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-12-0/stock-logistics-warehouse-12-0-stock_inventory_virtual_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/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the inventory adjustment by allowing to change
the virtual location.

**Table of contents**

.. contents::
:local:

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

* In v13, check _generate_moves(), as it will be easier to call super().

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_inventory_virtual_location%0Aversion:%2012.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
~~~~~~~

* Eficent

Contributors
~~~~~~~~~~~~

* Miquel Raïch <miquel.raich@eficent.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/12.0/stock_inventory_virtual_location>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions stock_inventory_virtual_location/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from . import wizard
20 changes: 20 additions & 0 deletions stock_inventory_virtual_location/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Stock Inventory Virtual Location",
'summary': "Allows to change the virtual location"
" in inventory adjustments.",
'author': 'Eficent, Odoo Community Association (OCA)',
'website': "https://github.com/OCA/stock-logistics-warehouse",
'category': 'Warehouse',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'depends': [
'stock',
],
'data': [
'views/stock_inventory_line_view.xml',
'wizard/stock_product_change_qty.xml',
],
'installable': True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_inventory_virtual_location
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: stock_inventory_virtual_location
#: model:ir.model,name:stock_inventory_virtual_location.model_stock_change_product_qty
msgid "Change Product Quantity"
msgstr ""

#. module: stock_inventory_virtual_location
#: model:ir.model,name:stock_inventory_virtual_location.model_stock_inventory_line
msgid "Inventory Line"
msgstr ""

#. module: stock_inventory_virtual_location
#: model:ir.model.fields,field_description:stock_inventory_virtual_location.field_stock_change_product_qty_virtual_location_id
msgid "Virtual Adjustment Location"
msgstr ""

#. module: stock_inventory_virtual_location
#: model:ir.model.fields,field_description:stock_inventory_virtual_location.field_stock_inventory_line_virtual_location_id
msgid "Virtual Location"
msgstr ""

3 changes: 3 additions & 0 deletions stock_inventory_virtual_location/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import stock_inventory_line
42 changes: 42 additions & 0 deletions stock_inventory_virtual_location/models/stock_inventory_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models
from odoo.tools import float_utils


class StockInventoryLine(models.Model):
_inherit = "stock.inventory.line"

virtual_location_id = fields.Many2one(
comodel_name='stock.location',
domain=[('usage', 'like', 'inventory')],
)

def _generate_moves(self):
moves = move_obj = self.env['stock.move']
unusual_lines = self.filtered(
lambda l: l.virtual_location_id and
l.virtual_location_id != l.product_id.property_stock_inventory)
usual_lines = self - unusual_lines
for line in unusual_lines:
if float_utils.float_compare(
line.theoretical_qty, line.product_qty,
precision_rounding=line.product_id.uom_id.rounding) == 0:
continue
diff = line.theoretical_qty - line.product_qty
if float_utils.float_compare( # found more than expected
diff, 0.0,
precision_rounding=line.product_uom_id.rounding) < 0:
vals = line._get_move_values(
abs(diff),
line.virtual_location_id.id,
line.location_id.id, False)
else:
vals = line._get_move_values(
abs(diff),
line.location_id.id,
line.virtual_location_id.id, True)
moves |= move_obj.create(vals)
moves |= super(StockInventoryLine, usual_lines)._generate_moves()
return moves
1 change: 1 addition & 0 deletions stock_inventory_virtual_location/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Miquel Raïch <miquel.raich@eficent.com>
2 changes: 2 additions & 0 deletions stock_inventory_virtual_location/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends the inventory adjustment by allowing to change
the virtual location.
1 change: 1 addition & 0 deletions stock_inventory_virtual_location/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* In v13, check _generate_moves(), as it will be easier to call super().
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.