mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[MIG] stock_account_quantity_history_location: Migration to 15.0
This commit is contained in:
committed by
Pedro M. Baeza
parent
fc6b94c47b
commit
faa212efd1
@@ -14,14 +14,14 @@ Stock Account 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/14.0/stock_account_quantity_history_location
|
||||
:target: https://github.com/OCA/stock-logistics-reporting/tree/15.0/stock_account_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-14-0/stock-logistics-reporting-14-0-stock_account_quantity_history_location
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-15-0/stock-logistics-reporting-15-0-stock_account_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/14.0
|
||||
:alt: Try me on Runbot
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-reporting&target_branch=15.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
@@ -41,7 +41,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_account_quantity_history_location%0Aversion:%2014.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_account_quantity_history_location%0Aversion:%2015.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.
|
||||
|
||||
@@ -53,6 +53,20 @@ Authors
|
||||
|
||||
* Eficent
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
||||
|
||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Víctor Martínez
|
||||
* Ernesto Tejeda
|
||||
|
||||
* `Sodexis <https://www.sodexis.com>`_:
|
||||
|
||||
* Atchuthan Ubendran
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -66,6 +80,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/14.0/stock_account_quantity_history_location>`_ project on GitHub.
|
||||
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/15.0/stock_account_quantity_history_location>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
"summary": """
|
||||
Glue module between Stock Account and Stock Quantity History Location
|
||||
modules""",
|
||||
"version": "14.0.1.0.1",
|
||||
"version": "15.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Eficent, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-reporting",
|
||||
"depends": ["stock_account", "stock_quantity_history_location"],
|
||||
"data": ["wizards/stock_quantity_history.xml"],
|
||||
"auto_install": True,
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
||||
|
||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Víctor Martínez
|
||||
* Ernesto Tejeda
|
||||
|
||||
* `Sodexis <https://www.sodexis.com>`_:
|
||||
|
||||
@@ -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>Stock Account Quantity History Location</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -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/14.0/stock_account_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-14-0/stock-logistics-reporting-14-0-stock_account_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/14.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/15.0/stock_account_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-15-0/stock-logistics-reporting-15-0-stock_account_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://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-reporting&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>Glue module between Stock Account and Stock Quantity History Location modules.</p>
|
||||
<p>Display a warning on the Stock Inventory report that accounting valuation is
|
||||
not calculated when you specify a location.</p>
|
||||
@@ -377,7 +377,8 @@ not calculated when you specify a location.</p>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id4">Maintainers</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -387,7 +388,7 @@ not calculated when you specify a location.</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_account_quantity_history_location%0Aversion:%2014.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_account_quantity_history_location%0Aversion:%2015.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">
|
||||
@@ -398,14 +399,29 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<li>Eficent</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Jordi Ballester Alomar <<a class="reference external" href="mailto:jordi.ballester@forgeflow.com">jordi.ballester@forgeflow.com</a>></li>
|
||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<li>Víctor Martínez</li>
|
||||
<li>Ernesto Tejeda</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference external" href="https://www.sodexis.com">Sodexis</a>:<ul>
|
||||
<li>Atchuthan Ubendran</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id4">Maintainers</a></h2>
|
||||
<h2><a class="toc-backref" href="#id5">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-reporting/tree/14.0/stock_account_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/15.0/stock_account_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>
|
||||
|
||||
@@ -46,11 +46,11 @@ class TestValuationLocation(
|
||||
}
|
||||
)
|
||||
action = wizard.with_context(company_owned=True).open_at_date()
|
||||
qty_svl_prev = self.product.with_context(action["context"]).quantity_svl
|
||||
qty_svl_prev = self.product.with_context(**action["context"]).quantity_svl
|
||||
move = self._create_stock_move(location_dest_id=self.test_stock_loc, qty=60)
|
||||
wizard["inventory_datetime"] = move.stock_valuation_layer_ids.create_date
|
||||
action = wizard.with_context(company_owned=True).open_at_date()
|
||||
product = self.product.with_context(action["context"])
|
||||
product = self.product.with_context(**action["context"])
|
||||
self.assertEqual(product.quantity_svl - qty_svl_prev, 60)
|
||||
|
||||
def test_stock_location_valuation_without_location_id(self):
|
||||
@@ -58,14 +58,14 @@ class TestValuationLocation(
|
||||
{"include_child_locations": True, "inventory_datetime": datetime.today()}
|
||||
)
|
||||
action = wizard.with_context(company_owned=True, valuation=True).open_at_date()
|
||||
qty_svl_prev = self.product.with_context(action["context"]).quantity_svl
|
||||
qty_svl_prev = self.product.with_context(**action["context"]).quantity_svl
|
||||
self._create_stock_move(location_dest_id=self.test_stock_loc, qty=50)
|
||||
move = self._create_stock_move(
|
||||
location_dest_id=self.child_test_stock_loc, qty=10
|
||||
)
|
||||
wizard["inventory_datetime"] = move.stock_valuation_layer_ids.create_date
|
||||
action = wizard.with_context(company_owned=True).open_at_date()
|
||||
product = self.product.with_context(action["context"])
|
||||
product = self.product.with_context(**action["context"])
|
||||
self.assertEqual(product.quantity_svl - qty_svl_prev, 60)
|
||||
|
||||
def test_stock_location_valuation_with_svl(self):
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Copyright 2019 Aleph Objects, Inc.
|
||||
# Copyright 2021 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
import ast
|
||||
|
||||
from odoo import models
|
||||
from odoo.osv import expression
|
||||
@@ -13,39 +12,30 @@ class StockQuantityHistory(models.TransientModel):
|
||||
|
||||
def open_at_date(self):
|
||||
action = super().open_at_date()
|
||||
ctx = action["context"]
|
||||
if isinstance(ctx, str):
|
||||
ctx = ast.literal_eval(ctx)
|
||||
if self.location_id:
|
||||
ctx["location"] = self.location_id.id
|
||||
ctx["compute_child"] = self.include_child_locations
|
||||
if ctx.get("company_owned", False):
|
||||
ctx.pop("company_owned")
|
||||
# Ensure the context isn't added later and catch it
|
||||
ctx["drop_company_owned"] = True
|
||||
action["name"] = "%s (%s)" % (
|
||||
action["name"],
|
||||
self.location_id.complete_name,
|
||||
)
|
||||
action["context"] = ctx
|
||||
if self.env.context.get("active_model") == "stock.valuation.layer":
|
||||
operator = "child_of" if self.include_child_locations else "="
|
||||
action["domain"] = expression.AND(
|
||||
if (
|
||||
self.location_id
|
||||
and self.env.context.get("active_model") == "stock.valuation.layer"
|
||||
):
|
||||
operator = "child_of" if self.include_child_locations else "="
|
||||
action["domain"] = expression.AND(
|
||||
[
|
||||
action["domain"],
|
||||
[
|
||||
action["domain"],
|
||||
[
|
||||
"|",
|
||||
(
|
||||
"stock_move_id.location_dest_id",
|
||||
operator,
|
||||
self.location_id.id,
|
||||
),
|
||||
(
|
||||
"stock_move_id.location_id",
|
||||
operator,
|
||||
self.location_id.id,
|
||||
),
|
||||
],
|
||||
]
|
||||
)
|
||||
"|",
|
||||
(
|
||||
"stock_move_id.location_dest_id",
|
||||
operator,
|
||||
self.location_id.id,
|
||||
),
|
||||
(
|
||||
"stock_move_id.location_id",
|
||||
operator,
|
||||
self.location_id.id,
|
||||
),
|
||||
],
|
||||
]
|
||||
)
|
||||
action[
|
||||
"display_name"
|
||||
] = f"{self.location_id.complete_name} - {action['display_name']}"
|
||||
return action
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_stock_account_quantity_history_location" model="ir.ui.view">
|
||||
<field name="name">Valuation Report</field>
|
||||
<field name="model">stock.quantity.history</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quantity_history" />
|
||||
<field
|
||||
name="groups_id"
|
||||
eval="[(4, ref('stock.group_stock_multi_locations'))]"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="inventory_datetime" position="before">
|
||||
<field
|
||||
name="location_id"
|
||||
invisible="context.get('active_model') != 'stock.valuation.layer'"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user