mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_quant_cost_info: Migration to 15.0
- Module renamed from stock_inventory_cost_info to stock_quant_cost_info - Add changes to allow show the cost difference when changing qty from stock.quants TT36551
This commit is contained in:
committed by
Yadier A. De Quesada
parent
163ad87fc9
commit
2c2f4d326a
@@ -1,6 +1,6 @@
|
||||
=========================
|
||||
Stock Inventory Cost Info
|
||||
=========================
|
||||
=====================
|
||||
Stock Quant Cost Info
|
||||
=====================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
@@ -14,20 +14,20 @@ Stock Inventory Cost Info
|
||||
: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/14.0/stock_inventory_cost_info
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_quant_cost_info
|
||||
: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-14-0/stock-logistics-warehouse-14-0-stock_inventory_cost_info
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_quant_cost_info
|
||||
: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/14.0
|
||||
:target: https://runbot.odoo-community.org/runbot/153/15.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module extends the functionality of *Inventory Adjustments* to show a new
|
||||
column *Adjustment cost* in *Inventory Details* list and PDF report table. The
|
||||
value of *Adjustment cost* will be self-calculated according to:
|
||||
This module extends the functionality of *Quantity Adjustments* in *Stock Quants* to
|
||||
show a new column *Adjustment cost* in *Quant Details* list and PDF report table.
|
||||
The value of *Adjustment cost* will be self-calculated according to:
|
||||
(`Real Quantity` - `Theoretical Quantity`) * `Product Cost`
|
||||
|
||||
**Table of contents**
|
||||
@@ -39,18 +39,17 @@ Installation
|
||||
============
|
||||
|
||||
A pre_init_hook process is initiated in order to set the *Adjustment cost* to
|
||||
zero in all existing *inventory adjustment* before installation.
|
||||
zero in all existing *stock quant* before installation.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to *Inventory > Operations > Inventory Adjustments* and create a new one.
|
||||
#. Click on *Start Inventory* button.
|
||||
#. In *Inventory Details* list you will see a new column named
|
||||
*Adjustment cost*.
|
||||
#. The cost will be recomputed when the inventory adjustment is validated.
|
||||
#. Go to *Inventory > Products > Products* and create or select one.
|
||||
#. Click on *Update Quantity* button.
|
||||
#. In *Quant* list you will see a new column named *Adjustment cost*.
|
||||
#. The cost will be recomputed when we change the *Counted Quantity*.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
@@ -58,7 +57,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_inventory_cost_info%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-warehouse/issues/new?body=module:%20stock_quant_cost_info%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.
|
||||
|
||||
@@ -78,6 +77,7 @@ Contributors
|
||||
* Ernesto Tejeda
|
||||
* Pedro M. Baeza
|
||||
* Sergio Teruel
|
||||
* Carlos Roca
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -92,6 +92,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/14.0/stock_inventory_cost_info>`_ project on GitHub.
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_quant_cost_info>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
"name": "Stock Inventory Cost Info",
|
||||
"summary": "Shows the cost of the inventory adjustments",
|
||||
"version": "14.0.1.0.0",
|
||||
"name": "Stock Quant Cost Info",
|
||||
"summary": "Shows the cost of the quants",
|
||||
"version": "15.0.1.0.0",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"category": "Warehouse",
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
def pre_init_hook(cr):
|
||||
cr.execute(
|
||||
"""ALTER TABLE stock_inventory_line
|
||||
"""ALTER TABLE stock_quant
|
||||
ADD COLUMN adjustment_cost numeric
|
||||
DEFAULT 0"""
|
||||
)
|
||||
|
||||
cr.execute(
|
||||
"""ALTER TABLE stock_inventory_line
|
||||
"""ALTER TABLE stock_quant
|
||||
ALTER COLUMN adjustment_cost DROP DEFAULT;"""
|
||||
)
|
||||
|
||||
@@ -6,38 +6,41 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 11.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-07-19 18:15+0000\n"
|
||||
"PO-Revision-Date: 2019-07-19 18:15+0000\n"
|
||||
"POT-Creation-Date: 2023-01-16 09:20+0000\n"
|
||||
"PO-Revision-Date: 2023-01-16 10:21+0100\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: \n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: \n"
|
||||
"X-Generator: Poedit 3.2.2\n"
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model_terms:ir.ui.view,arch_db:stock_inventory_cost_info.report_inventory_cost_info
|
||||
#. module: stock_quant_cost_info
|
||||
#: model_terms:ir.ui.view,arch_db:stock_quant_cost_info.report_inventory_cost_info
|
||||
msgid "<strong>Adjustment cost</strong>"
|
||||
msgstr "<strong>Coste de ajuste</strong>"
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_inventory_cost_info.field_stock_inventory_line__adjustment_cost
|
||||
#. module: stock_quant_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_quant_cost_info.field_stock_quant__adjustment_cost
|
||||
msgid "Adjustment cost"
|
||||
msgstr "Coste de ajuste"
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_inventory_cost_info.field_stock_inventory_line__currency_id
|
||||
#. module: stock_quant_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_quant_cost_info.field_stock_quant__currency_id
|
||||
msgid "Currency"
|
||||
msgstr "Moneda"
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model,name:stock_inventory_cost_info.model_stock_inventory_line
|
||||
msgid "Inventory Line"
|
||||
msgstr "Línea de inventario"
|
||||
#. module: stock_quant_cost_info
|
||||
#: model:ir.model,name:stock_quant_cost_info.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Quants"
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model_terms:ir.ui.view,arch_db:stock_inventory_cost_info.stock_inventory_line_tree
|
||||
#: model_terms:ir.ui.view,arch_db:stock_inventory_cost_info.stock_inventory_line_tree2
|
||||
#. module: stock_quant_cost_info
|
||||
#: model_terms:ir.ui.view,arch_db:stock_quant_cost_info.view_stock_quant_tree_inventory_editable
|
||||
msgid "Total"
|
||||
msgstr ""
|
||||
msgstr "Total"
|
||||
|
||||
#~ msgid "Inventory Line"
|
||||
#~ msgstr "Línea de inventario"
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_inventory_cost_info
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.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_cost_info
|
||||
#: model_terms:ir.ui.view,arch_db:stock_inventory_cost_info.report_inventory_cost_info
|
||||
msgid "<strong>Adjustment cost</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_inventory_cost_info.field_stock_inventory_line__adjustment_cost
|
||||
msgid "Adjustment cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_inventory_cost_info.field_stock_inventory_line__currency_id
|
||||
msgid "Currency"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_inventory_cost_info.field_stock_inventory_line__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_inventory_cost_info.field_stock_inventory_line__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model,name:stock_inventory_cost_info.model_stock_inventory_line
|
||||
msgid "Inventory Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_inventory_cost_info.field_stock_inventory_line____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_inventory_cost_info
|
||||
#: model_terms:ir.ui.view,arch_db:stock_inventory_cost_info.stock_inventory_line_tree
|
||||
msgid "Total"
|
||||
msgstr ""
|
||||
39
stock_quant_cost_info/i18n/stock_quant_cost_info.pot
Normal file
39
stock_quant_cost_info/i18n/stock_quant_cost_info.pot
Normal file
@@ -0,0 +1,39 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_quant_cost_info
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 15.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_quant_cost_info
|
||||
#: model_terms:ir.ui.view,arch_db:stock_quant_cost_info.report_inventory_cost_info
|
||||
msgid "<strong>Adjustment cost</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_quant_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_quant_cost_info.field_stock_quant__adjustment_cost
|
||||
msgid "Adjustment cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_quant_cost_info
|
||||
#: model:ir.model.fields,field_description:stock_quant_cost_info.field_stock_quant__currency_id
|
||||
msgid "Currency"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_quant_cost_info
|
||||
#: model:ir.model,name:stock_quant_cost_info.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_quant_cost_info
|
||||
#: model_terms:ir.ui.view,arch_db:stock_quant_cost_info.view_stock_quant_tree_inventory_editable
|
||||
msgid "Total"
|
||||
msgstr ""
|
||||
@@ -1,3 +1,3 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import stock_inventory
|
||||
from . import stock_quant
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class InventoryLine(models.Model):
|
||||
_inherit = "stock.inventory.line"
|
||||
|
||||
currency_id = fields.Many2one(
|
||||
string="Currency", related="inventory_id.company_id.currency_id"
|
||||
)
|
||||
adjustment_cost = fields.Monetary(
|
||||
string="Adjustment cost", compute="_compute_adjustment_cost", store=True
|
||||
)
|
||||
|
||||
@api.depends("difference_qty", "inventory_id.state")
|
||||
def _compute_adjustment_cost(self):
|
||||
for record in self:
|
||||
record.adjustment_cost = (
|
||||
record.difference_qty * record.product_id.standard_price
|
||||
)
|
||||
24
stock_quant_cost_info/models/stock_quant.py
Normal file
24
stock_quant_cost_info/models/stock_quant.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockQuant(models.Model):
|
||||
_inherit = "stock.quant"
|
||||
|
||||
currency_id = fields.Many2one(
|
||||
comodel_name="res.currency", string="Currency", related="company_id.currency_id"
|
||||
)
|
||||
adjustment_cost = fields.Monetary(
|
||||
string="Adjustment cost", compute="_compute_adjustment_cost", store=True
|
||||
)
|
||||
|
||||
@api.depends("inventory_diff_quantity", "product_id.standard_price")
|
||||
def _compute_adjustment_cost(self):
|
||||
for record in self:
|
||||
record.adjustment_cost = False
|
||||
if record.inventory_diff_quantity:
|
||||
record.adjustment_cost = (
|
||||
record.inventory_diff_quantity * record.product_id.standard_price
|
||||
)
|
||||
@@ -3,3 +3,4 @@
|
||||
* Ernesto Tejeda
|
||||
* Pedro M. Baeza
|
||||
* Sergio Teruel
|
||||
* Carlos Roca
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
This module extends the functionality of *Inventory Adjustments* to show a new
|
||||
column *Adjustment cost* in *Inventory Details* list and PDF report table. The
|
||||
value of *Adjustment cost* will be self-calculated according to:
|
||||
This module extends the functionality of *Quantity Adjustments* in *Stock Quants* to
|
||||
show a new column *Adjustment cost* in *Quant Details* list and PDF report table.
|
||||
The value of *Adjustment cost* will be self-calculated according to:
|
||||
(`Real Quantity` - `Theoretical Quantity`) * `Product Cost`
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
A pre_init_hook process is initiated in order to set the *Adjustment cost* to
|
||||
zero in all existing *inventory adjustment* before installation.
|
||||
zero in all existing *stock quant* before installation.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to *Inventory > Operations > Inventory Adjustments* and create a new one.
|
||||
#. Click on *Start Inventory* button.
|
||||
#. In *Inventory Details* list you will see a new column named
|
||||
*Adjustment cost*.
|
||||
#. The cost will be recomputed when the inventory adjustment is validated.
|
||||
#. Go to *Inventory > Products > Products* and create or select one.
|
||||
#. Click on *Update Quantity* button.
|
||||
#. In *Quant* list you will see a new column named *Adjustment cost*.
|
||||
#. The cost will be recomputed when we change the *Counted Quantity*.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<title>Stock Inventory Cost Info</title>
|
||||
<title>Stock Quant Cost Info</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
@@ -360,17 +360,17 @@ ul.auto-toc {
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="stock-inventory-cost-info">
|
||||
<h1 class="title">Stock Inventory Cost Info</h1>
|
||||
<div class="document" id="stock-quant-cost-info">
|
||||
<h1 class="title">Stock Quant Cost Info</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! 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/14.0/stock_inventory_cost_info"><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-14-0/stock-logistics-warehouse-14-0-stock_inventory_cost_info"><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/14.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 functionality of <em>Inventory Adjustments</em> to show a new
|
||||
column <em>Adjustment cost</em> in <em>Inventory Details</em> list and PDF report table. The
|
||||
value of <em>Adjustment cost</em> will be self-calculated according to:
|
||||
<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/15.0/stock_quant_cost_info"><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-15-0/stock-logistics-warehouse-15-0-stock_quant_cost_info"><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/15.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 functionality of <em>Quantity Adjustments</em> in <em>Stock Quants</em> to
|
||||
show a new column <em>Adjustment cost</em> in <em>Quant Details</em> list and PDF report table.
|
||||
The value of <em>Adjustment cost</em> will be self-calculated according to:
|
||||
(<cite>Real Quantity</cite> - <cite>Theoretical Quantity</cite>) * <cite>Product Cost</cite></p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
@@ -389,17 +389,16 @@ value of <em>Adjustment cost</em> will be self-calculated according to:
|
||||
<div class="section" id="installation">
|
||||
<h1><a class="toc-backref" href="#id1">Installation</a></h1>
|
||||
<p>A pre_init_hook process is initiated in order to set the <em>Adjustment cost</em> to
|
||||
zero in all existing <em>inventory adjustment</em> before installation.</p>
|
||||
zero in all existing <em>stock quant</em> before installation.</p>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
|
||||
<p>To use this module, you need to:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Go to <em>Inventory > Operations > Inventory Adjustments</em> and create a new one.</li>
|
||||
<li>Click on <em>Start Inventory</em> button.</li>
|
||||
<li>In <em>Inventory Details</em> list you will see a new column named
|
||||
<em>Adjustment cost</em>.</li>
|
||||
<li>The cost will be recomputed when the inventory adjustment is validated.</li>
|
||||
<li>Go to <em>Inventory > Products > Products</em> and create or select one.</li>
|
||||
<li>Click on <em>Update Quantity</em> button.</li>
|
||||
<li>In <em>Quant</em> list you will see a new column named <em>Adjustment cost</em>.</li>
|
||||
<li>The cost will be recomputed when we change the <em>Counted Quantity</em>.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
@@ -407,7 +406,7 @@ zero in all existing <em>inventory adjustment</em> before installation.</p>
|
||||
<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_inventory_cost_info%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-warehouse/issues/new?body=module:%20stock_quant_cost_info%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">
|
||||
@@ -425,6 +424,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<li>Ernesto Tejeda</li>
|
||||
<li>Pedro M. Baeza</li>
|
||||
<li>Sergio Teruel</li>
|
||||
<li>Carlos Roca</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -436,7 +436,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/14.0/stock_inventory_cost_info">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/15.0/stock_quant_cost_info">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,3 +1,3 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import test_stock_inventory_cost_info
|
||||
from . import test_stock_quant_cost_info
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests.common import TransactionCase, tagged
|
||||
|
||||
|
||||
@tagged("post_install", "-at_install")
|
||||
class TestStockInventoryCostInfo(TransactionCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
product_obj = self.env["product.product"]
|
||||
self.product_1 = product_obj.create(
|
||||
{"name": "product test 1", "type": "product", "standard_price": 1000}
|
||||
)
|
||||
self.product_2 = product_obj.create(
|
||||
{"name": "product test 2", "type": "product", "standard_price": 2000}
|
||||
)
|
||||
self.inventory = self.env["stock.inventory"].create(
|
||||
{
|
||||
"name": "Another inventory",
|
||||
"line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"product_id": self.product_1.id,
|
||||
"product_qty": 10,
|
||||
"location_id": self.env.ref(
|
||||
"stock.warehouse0"
|
||||
).lot_stock_id.id,
|
||||
},
|
||||
),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"product_id": self.product_2.id,
|
||||
"product_qty": 20,
|
||||
"location_id": self.env.ref(
|
||||
"stock.warehouse0"
|
||||
).lot_stock_id.id,
|
||||
},
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
def test_compute_adjustment_cost(self):
|
||||
"""Tests if the adjustment_cost is correctly computed."""
|
||||
lines = self.inventory.line_ids
|
||||
line1 = lines.filtered(lambda r: r.product_id == self.product_1)
|
||||
self.assertEqual(line1.adjustment_cost, 10000)
|
||||
line2 = lines.filtered(lambda r: r.product_id == self.product_2)
|
||||
self.assertEqual(line2.adjustment_cost, 40000)
|
||||
37
stock_quant_cost_info/tests/test_stock_quant_cost_info.py
Normal file
37
stock_quant_cost_info/tests/test_stock_quant_cost_info.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests.common import TransactionCase, tagged
|
||||
|
||||
|
||||
@tagged("post_install", "-at_install")
|
||||
class TestStockQuantCostInfo(TransactionCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
product_obj = self.env["product.product"]
|
||||
self.product_1 = product_obj.create(
|
||||
{"name": "product test 1", "type": "product", "standard_price": 1000}
|
||||
)
|
||||
self.product_2 = product_obj.create(
|
||||
{"name": "product test 2", "type": "product", "standard_price": 2000}
|
||||
)
|
||||
|
||||
def test_compute_adjustment_cost(self):
|
||||
"""Tests if the adjustment_cost is correctly computed."""
|
||||
quant_prod_1 = self.env["stock.quant"].create(
|
||||
{
|
||||
"product_id": self.product_1.id,
|
||||
"location_id": self.env.ref("stock.stock_location_stock").id,
|
||||
"inventory_quantity": 10.0,
|
||||
}
|
||||
)
|
||||
self.assertEqual(quant_prod_1.adjustment_cost, 10000)
|
||||
quant_prod_2 = self.env["stock.quant"].create(
|
||||
{
|
||||
"product_id": self.product_2.id,
|
||||
"location_id": self.env.ref("stock.stock_location_stock").id,
|
||||
"inventory_quantity": 20.0,
|
||||
}
|
||||
)
|
||||
self.assertEqual(quant_prod_2.adjustment_cost, 40000)
|
||||
@@ -2,14 +2,17 @@
|
||||
<odoo>
|
||||
<template id="report_inventory_cost_info" inherit_id="stock.report_inventory">
|
||||
<xpath
|
||||
expr="//table[.//span[@t-field='line.product_qty']]/thead/tr"
|
||||
expr="//table[.//span[@t-field='line.inventory_quantity']]/thead/tr"
|
||||
position="inside"
|
||||
>
|
||||
<th class="text-right">
|
||||
<strong>Adjustment cost</strong>
|
||||
</th>
|
||||
</xpath>
|
||||
<xpath expr="//tr[.//span[@t-field='line.product_qty']]" position="inside">
|
||||
<xpath
|
||||
expr="//tr[.//span[@t-field='line.inventory_quantity']]"
|
||||
position="inside"
|
||||
>
|
||||
<td class="text-right">
|
||||
<span t-field="line.adjustment_cost" />
|
||||
</td>
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="stock_inventory_line_tree" model="ir.ui.view">
|
||||
<field name="name">stock.inventory.line.tree.cost.info</field>
|
||||
<field name="model">stock.inventory.line</field>
|
||||
<field name="inherit_id" ref="stock.stock_inventory_line_tree" />
|
||||
<record id="view_stock_quant_tree_inventory_editable" model="ir.ui.view">
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quant_tree_inventory_editable" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_uom_id" position="after">
|
||||
<field name="inventory_diff_quantity" position="after">
|
||||
<field name="currency_id" invisible="1" />
|
||||
<field name="adjustment_cost" sum="Total" />
|
||||
<field name="adjustment_cost" sum="Total" optional="show" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user