mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_account_change_qty_reason: Migration to 13.0
This commit is contained in:
@@ -14,13 +14,13 @@ Stock Account Change Quantity Reason
|
||||
: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_account_change_qty_reason
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_account_change_qty_reason
|
||||
: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_account_change_qty_reason
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_account_change_qty_reason
|
||||
: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
|
||||
:target: https://runbot.odoo-community.org/runbot/153/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -52,7 +52,7 @@ 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_account_change_qty_reason%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-warehouse/issues/new?body=module:%20stock_account_change_qty_reason%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.
|
||||
|
||||
@@ -62,12 +62,13 @@ Credits
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Eficent
|
||||
* ForgeFlow
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Héctor Villarreal <hector.villarreal@eficent.com>
|
||||
* Héctor Villarreal <hector.villarreal@forgeflow.com>
|
||||
* Adrià Gil Sorribes <adria.gil@forgeflow.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -82,6 +83,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-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_account_change_qty_reason>`_ project on GitHub.
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_account_change_qty_reason>`_ 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.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Stock Account Change Quantity Reason",
|
||||
"summary": """
|
||||
Stock Account Change Quantity Reason """,
|
||||
"author": "Eficent, Odoo Community Association (OCA)",
|
||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"category": "Warehouse Management",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "13.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"depends": ["stock_account", "stock_change_qty_reason"],
|
||||
"data": ["views/stock_inventory_line_reason_view.xml", "views/stock_move_view.xml"],
|
||||
|
||||
@@ -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 (https://www.gnu.org/licenses/agpl.html).
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
|
||||
# Copyright 2019 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
from odoo import api, models
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = "stock.move"
|
||||
|
||||
@api.multi
|
||||
def _get_accounting_data_for_valuation(self):
|
||||
self.ensure_one()
|
||||
journal_id, acc_src, acc_dest, acc_valuation = super(
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
* Héctor Villarreal <hector.villarreal@eficent.com>
|
||||
* Héctor Villarreal <hector.villarreal@forgeflow.com>
|
||||
* Adrià Gil Sorribes <adria.gil@forgeflow.com>
|
||||
|
||||
@@ -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-warehouse/tree/12.0/stock_account_change_qty_reason"><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-12-0/stock-logistics-warehouse-12-0-stock_account_change_qty_reason"><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/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-warehouse/tree/13.0/stock_account_change_qty_reason"><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-13-0/stock-logistics-warehouse-13-0-stock_account_change_qty_reason"><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/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module extends the product stock management and allows to assign specific account
|
||||
to manage changes on product quantities, either from product wizard or inventory adjustments.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
@@ -401,7 +401,7 @@ to manage changes on product quantities, either from product wizard or inventory
|
||||
<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_account_change_qty_reason%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-warehouse/issues/new?body=module:%20stock_account_change_qty_reason%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">
|
||||
@@ -409,13 +409,14 @@ 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="contributors">
|
||||
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Héctor Villarreal <<a class="reference external" href="mailto:hector.villarreal@eficent.com">hector.villarreal@eficent.com</a>></li>
|
||||
<li>Héctor Villarreal <<a class="reference external" href="mailto:hector.villarreal@forgeflow.com">hector.villarreal@forgeflow.com</a>></li>
|
||||
<li>Adrià Gil Sorribes <<a class="reference external" href="mailto:adria.gil@forgeflow.com">adria.gil@forgeflow.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -425,7 +426,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-warehouse/tree/12.0/stock_account_change_qty_reason">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_account_change_qty_reason">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>
|
||||
|
||||
@@ -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 (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo.tests.common import SavepointCase
|
||||
@@ -13,6 +13,7 @@ class TestStockAccountChangeQtyReason(SavepointCase):
|
||||
cls.product_product_model = cls.env["product.product"]
|
||||
cls.product_category_model = cls.env["product.category"]
|
||||
cls.wizard_model = cls.env["stock.change.product.qty"]
|
||||
cls.stock_inventory = cls.env["stock.inventory"]
|
||||
cls.preset_reason = cls.env["stock.inventory.line.reason"]
|
||||
|
||||
# INSTANCES
|
||||
@@ -76,6 +77,14 @@ class TestStockAccountChangeQtyReason(SavepointCase):
|
||||
# Start Inventory with 10 units
|
||||
cls.product = cls._create_product(cls, "product_product")
|
||||
cls._product_change_qty(cls, cls.product, 10)
|
||||
cls.inventory = cls.stock_inventory.create(
|
||||
{
|
||||
"name": "Inventory Adjustment Product",
|
||||
"product_ids": [(4, cls.product.id)],
|
||||
"preset_reason_id": cls.reason.id,
|
||||
}
|
||||
)
|
||||
cls.inventory.action_start()
|
||||
|
||||
def _create_product(self, name):
|
||||
return self.product_product_model.create(
|
||||
@@ -87,12 +96,12 @@ class TestStockAccountChangeQtyReason(SavepointCase):
|
||||
}
|
||||
)
|
||||
|
||||
def _product_change_qty(self, product, new_qty, reason=None, preset_reason_id=None):
|
||||
values = {"product_id": product.id, "new_quantity": new_qty}
|
||||
if reason:
|
||||
values = {**values, "reason": reason}
|
||||
if preset_reason_id:
|
||||
values = {**values, "preset_reason_id": preset_reason_id.id}
|
||||
def _product_change_qty(self, product, new_qty):
|
||||
values = {
|
||||
"product_tmpl_id": product.product_tmpl_id.id,
|
||||
"product_id": product.id,
|
||||
"new_quantity": new_qty,
|
||||
}
|
||||
wizard = self.wizard_model.create(values)
|
||||
wizard.change_product_qty()
|
||||
|
||||
@@ -101,7 +110,8 @@ class TestStockAccountChangeQtyReason(SavepointCase):
|
||||
|
||||
def test_product_change_qty_account_input(self):
|
||||
# update qty on hand and add reason
|
||||
self._product_change_qty(self.product, 100, self.reason.name, self.reason)
|
||||
self.inventory.line_ids[0].write({"product_qty": 100})
|
||||
self.inventory.action_validate()
|
||||
|
||||
# check stock moves and account moves created
|
||||
stock_move = self.env["stock.move"].search(
|
||||
@@ -130,7 +140,8 @@ class TestStockAccountChangeQtyReason(SavepointCase):
|
||||
|
||||
def test_product_change_qty_account_output(self):
|
||||
# update qty on hand and add reason
|
||||
self._product_change_qty(self.product, 5, self.reason.name, self.reason)
|
||||
self.inventory.line_ids[0].write({"product_qty": 5})
|
||||
self.inventory.action_validate()
|
||||
|
||||
# check stock moves and account moves created
|
||||
stock_move = self.env["stock.move"].search(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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). -->
|
||||
<odoo>
|
||||
<record id="view_account_preset_reason" model="ir.ui.view">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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). -->
|
||||
<odoo>
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
|
||||
Reference in New Issue
Block a user