mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[MIG] stock_quantity_history_location: Migration to 13.0
This commit is contained in:
committed by
GuillemCForgeFlow
parent
44c9929017
commit
d040e05195
@@ -14,13 +14,13 @@ Stock Quantity History Location
|
||||
: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--reporting-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_quantity_history_location
|
||||
:target: https://github.com/OCA/stock-logistics-reporting/tree/13.0/stock_quantity_history_location
|
||||
:alt: OCA/stock-logistics-reporting
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-12-0/stock-logistics-reporting-12-0-stock_quantity_history_location
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-13-0/stock-logistics-reporting-13-0-stock_quantity_history_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/151/12.0
|
||||
:target: https://runbot.odoo-community.org/runbot/151/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -49,7 +49,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/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-reporting/issues/new?body=module:%20stock_quantity_history_location%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_quantity_history_location%0Aversion:%2013.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.
|
||||
|
||||
@@ -59,7 +59,7 @@ Credits
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Eficent
|
||||
* ForgeFlow
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -74,6 +74,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-reporting <https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_quantity_history_location>`_ project on GitHub.
|
||||
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/13.0/stock_quantity_history_location>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
|
||||
# Copyright 2019 ForgeFlow S.L.
|
||||
# Copyright 2019 Aleph Objects, Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Stock Quantity History Location",
|
||||
"summary": "Provides stock quantity by location on past date",
|
||||
"version": "12.0.1.0.1",
|
||||
"version": "13.0.1.0.1",
|
||||
"license": "AGPL-3",
|
||||
"author": "Eficent," "Odoo Community Association (OCA)",
|
||||
"author": "ForgeFlow," "Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-reporting",
|
||||
"depends": ["stock"],
|
||||
"data": ["wizards/stock_quantity_history.xml"],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_quantity_history_location
|
||||
# * stock_quantity_history_location
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Project-Id-Version: Odoo Server 13.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: <>\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@@ -27,4 +27,3 @@ msgstr ""
|
||||
#: model:ir.model,name:stock_quantity_history_location.model_stock_quantity_history
|
||||
msgid "Stock Quantity History"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -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="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-reporting/tree/12.0/stock_quantity_history_location"><img alt="OCA/stock-logistics-reporting" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-reporting-12-0/stock-logistics-reporting-12-0-stock_quantity_history_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/151/12.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-reporting/tree/13.0/stock_quantity_history_location"><img alt="OCA/stock-logistics-reporting" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-reporting-13-0/stock-logistics-reporting-13-0-stock_quantity_history_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/151/13.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 run an Inventory report or Inventory Valuation
|
||||
report by location, for a past date or for current date.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
@@ -404,7 +404,7 @@ report by location, for a past date or for current date.</p>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/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-reporting/issues/new?body=module:%20stock_quantity_history_location%0Aversion:%2012.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-reporting/issues/new?body=module:%20stock_quantity_history_location%0Aversion:%2013.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">
|
||||
@@ -412,7 +412,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Eficent</li>
|
||||
<li>ForgeFlow</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -422,7 +422,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<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-reporting/tree/12.0/stock_quantity_history_location">OCA/stock-logistics-reporting</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/tree/13.0/stock_quantity_history_location">OCA/stock-logistics-reporting</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>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
|
||||
# Copyright 2019 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests.common import SavepointCase
|
||||
@@ -49,11 +49,10 @@ class TestStockQuantityHistoryLocation(SavepointCase):
|
||||
{
|
||||
"location_id": self.test_stock_loc.id,
|
||||
"include_child_locations": True,
|
||||
"compute_at_date": 1,
|
||||
"date": "2019-08-12",
|
||||
"inventory_datetime": "2019-08-12 00:00:00",
|
||||
}
|
||||
)
|
||||
action = wizard.with_context(company_owned=True).open_table()
|
||||
action = wizard.with_context(company_owned=True).open_at_date()
|
||||
self.assertEquals(
|
||||
self.product.with_context(action["context"]).qty_available, 100.0
|
||||
)
|
||||
@@ -66,24 +65,14 @@ class TestStockQuantityHistoryLocation(SavepointCase):
|
||||
|
||||
def test_wizard_current(self):
|
||||
wizard = self.env["stock.quantity.history"].create(
|
||||
{
|
||||
"location_id": self.test_stock_loc.id,
|
||||
"include_child_locations": False,
|
||||
"compute_at_date": 0,
|
||||
}
|
||||
)
|
||||
action = wizard.with_context().open_table()
|
||||
self.assertEquals(
|
||||
action["domain"], [("location_id", "=", self.test_stock_loc.id)]
|
||||
{"location_id": self.test_stock_loc.id, "include_child_locations": False}
|
||||
)
|
||||
action = wizard.with_context().open_at_date()
|
||||
self.assertEquals(action["context"]["compute_child"], False)
|
||||
self.assertEquals(action["context"]["location"], self.test_stock_loc.id)
|
||||
wizard = self.env["stock.quantity.history"].create(
|
||||
{
|
||||
"location_id": self.test_stock_loc.id,
|
||||
"include_child_locations": True,
|
||||
"compute_at_date": 0,
|
||||
}
|
||||
)
|
||||
action = wizard.with_context().open_table()
|
||||
self.assertEquals(
|
||||
action["domain"], [("location_id", "child_of", self.test_stock_loc.id)]
|
||||
{"location_id": self.test_stock_loc.id, "include_child_locations": True}
|
||||
)
|
||||
action = wizard.with_context().open_at_date()
|
||||
self.assertEquals(action["context"]["compute_child"], True)
|
||||
self.assertEquals(action["context"]["location"], self.test_stock_loc.id)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
|
||||
# Copyright 2019 ForgeFlow S.L.
|
||||
# Copyright 2019 Aleph Objects, Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
import ast
|
||||
@@ -14,22 +14,13 @@ class StockQuantityHistory(models.TransientModel):
|
||||
)
|
||||
include_child_locations = fields.Boolean("Include child locations", default=True)
|
||||
|
||||
def open_table(self):
|
||||
action = super(StockQuantityHistory, self).open_table()
|
||||
def open_at_date(self):
|
||||
action = super(StockQuantityHistory, self).open_at_date()
|
||||
ctx = action["context"]
|
||||
if isinstance(ctx, str):
|
||||
ctx = ast.literal_eval(ctx)
|
||||
# If we are opening the current quants, filter by domain
|
||||
if (
|
||||
self.location_id
|
||||
and not self.compute_at_date
|
||||
and not self.env.context.get("valuation")
|
||||
):
|
||||
if self.include_child_locations:
|
||||
action["domain"] = [("location_id", "child_of", self.location_id.id)]
|
||||
else:
|
||||
action["domain"] = [("location_id", "=", self.location_id.id)]
|
||||
elif self.location_id:
|
||||
if self.location_id:
|
||||
ctx["location"] = self.location_id.id
|
||||
ctx["compute_child"] = self.include_child_locations
|
||||
if ctx.get("company_owned", False):
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">stock.quantity.history</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quantity_history"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="compute_at_date" position="before">
|
||||
<field name="inventory_datetime" position="before">
|
||||
<field name="location_id"/>
|
||||
<field name="include_child_locations"
|
||||
attrs="{'invisible': [('location_id', '=', False)]}"/>
|
||||
|
||||
Reference in New Issue
Block a user