Skip to content

Commit

Permalink
[MIG] stock_inventory_revaluation: Migration to 12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matt454357 committed May 13, 2020
1 parent 048f6e6 commit 50f3dde
Show file tree
Hide file tree
Showing 28 changed files with 2,016 additions and 652 deletions.
181 changes: 134 additions & 47 deletions stock_inventory_revaluation/README.rst
Original file line number Diff line number Diff line change
@@ -1,93 +1,180 @@
.. image:: https://img.shields.io/badge/license-AGPLv3-blue.svg
:target: https://www.gnu.org/licenses/agpl.html
:alt: License: AGPL-3

===================================
Stock Account Inventory Revaluation
===================================
===========================
Stock Inventory Revaluation
===========================

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

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

If your company runs a perpetual inventory system, you may need to perform
inventory revaluation.
inventory revaluation. A revaluation updates both the inventory
account balance, and the stock value of products.

This module takes three different methods of stock revaluation

- Stock-Move-Specific Valuation (FIFO costing)
- Simple Price Change (standard/average costing)
- Inventory-Total-Value Price Change (standard/average costing)


Stock-Move-Specific Valuation
=============================

Stock-Move-Specific valuation applies if the product is configured for FIFO
costing. In this case, the user selects specific stock moves for which to
change value. A journal entry is created for each stock move on which the
value is changed.


Simple Price Change
===================

A simple price change updates the standard/average cost of the product,
regardless of the available stock. The user specifies a new per-unit price,
and posts the change. A journal entry is created for all stock moves having
positive remaining stock value. The amount of the posted entry is the
difference between the new and old price, multiplied by the quantity available.


You can re-valuate inventory values by:
Inventory-Total-Value Price Change
==================================

* Changing the inventory valuation of a specific product. The cost price
is changed, and the inventory value is recalculated according to the new
price. In case of real price, you can select on which quants you want to
change the unit cost.
This is a price change, based on total available stock value. It updates the
standard/average cost of the product, based on available stock. The user
specifies a new total value for available stock. The standard/average price
of the product is updated to the new total value divided by the available
quantity. A journal entry is created for all stock moves having positive
remaining stock value. The amount of the posted entry is the difference
between the new and old total value.

* Changing the value of the inventory. The quantity of inventory remains
unchanged, resulting in a change in the price.
**Table of contents**

.. contents::
:local:

Configuration
=============

* Go to *Inventory / Configuration / Products / Product Categories* and
define, for each category, a Valuation Increase Account and a Valuation
Decrease Account. These accounts will be used as contra-accounts to the
Stock Valuation Account during the inventory re-valuation.

* Users willing to access to the Inventory Revaluation menu should be
* Users wanting to access to the Inventory Revaluation menu should be
members of the group "Manage Inventory Valuation and Costing Methods".

* The Revaluation can automatically select contra-accounts to the Stock
Valuation Account. To configure this, define a Valuation Increase Account
and a Valuation Decrease Account for each product category. Do that here:
*Inventory / Configuration / Products / Product Categories*

Usage
=====

* Go to *Inventory / Inventory Control / Inventory Revaluation*
to create a new Inventory Revaluation. For products set with average or
standard price and real-time valuation, go to the Product form and use the
"Set standard price" link to change the standard price.

* In order to post the inventory revaluation for multiple items at once,
- Go to *Inventory / Inventory Control / Inventory Revaluation* to create a
new Inventory Revaluation.
- For products set with average/standard price, and automated valuation, go
to the Product form and use the "Update Cost" link to change the standard
price.
- In order to post the inventory revaluation for multiple items at once,
select the records in the tree view and go to
*Action / Post Inventory Revaluations*.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/153/10.0
- To set default valuation increase/decrease accounts by product category, go
to *Inventory / Configuration / Product Categories*

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

* It is not possible to cancel inventory revaluations for products set with
average or standard price.
- Known Issue: We can't revalue individual lots/serials if there are multiple
on the same stock move

- Version 11 moved the cost from stock.quant to stock.move. That
means there is no longer an individual cost assigned to specific
lots/serials.
- As a work around, you can internally transfer the lot/serial you want to
revalue. This will separate it from the other lots/serials on the
original inbound stock move.

- Known Issue: Actual resulting stock value may differ slightly from that
specified by the user. This can result when the Product Price
decimal precision is low, and there is a large quantity of product to
revaluate. For example:

- If we have 147 units on hand, and the precision for Product Price is 2
digits
- When we specify a new value of 750, the actual value applied is 749.70
- At full precision, 750 / 147 = 5.102041, but the product cost gets
rounded to 5.10, and 5.10 * 147 = 749.70
- As a work around, you can change the decimal precision setting for Product
Price to have a greater number of digits

Changelog
=========

12.0.1.0.0 (2020-04-27)
~~~~~~~~~~~~~~~~~~~~~~~

* [MIG] Migrated to v12
* [FIX] Let the user set a posting date other than today
(`#892 <https://github.com/OCA/stock-logistics-warehouse/issues/892>`_)
* [IMP] Operate on stock moves, rather than stock quants
* [IMP] Select stock moves by Lot and Location
* [IMP] Let the user remove move lines from the revaluation, in draft state

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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/stock_account_inventory_revaluation/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.
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_revaluation%0Aversion:%2012.0-mig-stock_inventory_revaluation%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
=======

Images
------
Authors
~~~~~~~

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
* Eficent Business and IT Consulting Services S.L.
* Serpent Consulting Services Pvt. Ltd.
* Matt Taylor

Contributors
------------
~~~~~~~~~~~~

* Eficent Business and IT Consulting Services S.L. <contact@eficent.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Matt Taylor <matt454357@gmail.com> (https://github.com/matt454357)

Maintainer
----------
Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0-mig-stock_inventory_revaluation/stock_inventory_revaluation>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 0 additions & 6 deletions stock_inventory_revaluation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
# -*- coding: utf-8 -*-
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models
from . import wizards
13 changes: 8 additions & 5 deletions stock_inventory_revaluation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2020 Matt Taylor
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
Expand All @@ -9,19 +9,22 @@
"name": "Stock Inventory Revaluation",
"summary": "Introduces inventory revaluation as single point to change "
"the valuation of products.",
"version": "10.0.1.1.0",
"version": "12.0.1.0.0",
"development_status": "Production/Stable",
"author": "Eficent Business and IT Consulting Services S.L., "
"Serpent Consulting Services Pvt. Ltd.,"
"Serpent Consulting Services Pvt. Ltd., "
"Matt Taylor, "
"Odoo Community Association (OCA)",
"website": "http://www.eficent.com",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse",
"depends": ["stock_account", "product"],
"license": "AGPL-3",
"data": [
"wizards/stock_inventory_revaluation_get_quants_view.xml",
"wizards/stock_inventory_revaluation_get_moves_view.xml",
"security/stock_inventory_revaluation_security.xml",
"security/ir.model.access.csv",
"views/stock_inventory_revaluation_view.xml",
"views/stock_inventory_revaluation_template_view.xml",
"views/product_view.xml",
"views/account_move_line_view.xml",
"data/stock_inventory_revaluation_data.xml",
Expand Down
8 changes: 1 addition & 7 deletions stock_inventory_revaluation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import product
from . import account_move
from . import stock_inventory_revaluation
from . import stock_inventory_revaluation_template
6 changes: 4 additions & 2 deletions stock_inventory_revaluation/models/account_move.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2020 Matt Taylor
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
Expand Down Expand Up @@ -36,7 +36,9 @@ class AccountMoveLine(models.Model):
comodel_name='stock.inventory.revaluation',
related='move_id.stock_inventory_revaluation_id',
string='Stock Inventory Revaluation',
store=True, ondelete='restrict', copy=False, readonly=True)
store=True,
ondelete='restrict',
copy=False)

@api.multi
def unlink(self):
Expand Down
1 change: 0 additions & 1 deletion stock_inventory_revaluation/models/product.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2016-17 Serpent Consulting Services Pvt. Ltd.
Expand Down

1 comment on commit 50f3dde

@chandni299
Copy link

@chandni299 chandni299 commented on 50f3dde Oct 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in Unit test at line 53, we should improve the search domain by adding another filter as
self.location = self.stock_location_model.search ([('location_id', '=', location.id), ('name', '=', 'Stock')])
to make it more precise.
Reason: If I have more than one Warehouse having the same parent(location_id), then unit tests will get failed.

Please sign in to comment.