Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] stock_quant_cost_info: Migration to 17.0 #2191

Open
wants to merge 15 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions stock_quant_cost_info/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
=====================
Stock Quant Cost Info
=====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8077d3323b274fbfc8b14d22a75a0fe271c726c3c2046ea01aad6faa52089b96
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/17.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-17-0/stock-logistics-warehouse-17-0-stock_quant_cost_info
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=17.0
:alt: Try me on Runboat

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

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**

.. contents::
:local:

Installation
============

A pre_init_hook process is initiated in order to set the *Adjustment
cost* to zero in all existing *stock quant* before installation.

Usage
=====

To use this module, you need to:

1. Go to *Inventory > Products > Products* and create or select one.
2. Click on *Update Quantity* button.
3. In *Quant* list you will see a new column named *Adjustment cost*.
4. The cost will be recomputed when we change the *Counted Quantity*.

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_quant_cost_info%0Aversion:%2017.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.

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- Ernesto Tejeda
- Pedro M. Baeza
- Sergio Teruel
- Carlos Roca

Maintainers
-----------

This module is maintained by the OCA.

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

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/17.0/stock_quant_cost_info>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions stock_quant_cost_info/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
from .hooks import pre_init_hook
17 changes: 17 additions & 0 deletions stock_quant_cost_info/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 Tecnativa - Ernesto Tejeda
# Copyright 2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock Quant Cost Info",
"summary": "Shows the cost of the quants",
"version": "17.0.1.0.0",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse",
"depends": ["stock"],
"data": ["views/stock_inventory_views.xml", "views/report_stockinventory.xml"],
"pre_init_hook": "pre_init_hook",
"license": "AGPL-3",
"installable": True,
"application": False,
}
15 changes: 15 additions & 0 deletions stock_quant_cost_info/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).


def pre_init_hook(env):
env.cr.execute(
"""ALTER TABLE stock_quant
ADD COLUMN adjustment_cost numeric
DEFAULT 0"""
)

env.cr.execute(
"""ALTER TABLE stock_quant
ALTER COLUMN adjustment_cost DROP DEFAULT;"""
)
46 changes: 46 additions & 0 deletions stock_quant_cost_info/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_inventory_cost_info
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \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: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 3.2.2\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 "<strong>Coste de ajuste</strong>"

#. 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_quant_cost_info
#: model:ir.model.fields,field_description:stock_quant_cost_info.field_stock_quant__currency_id
msgid "Currency"
msgstr "Moneda"

#. module: stock_quant_cost_info
#: model:ir.model,name:stock_quant_cost_info.model_stock_quant
msgid "Quants"
msgstr "Quants"

#. 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 "Total"

#~ msgid "Inventory Line"
#~ msgstr "Línea de inventario"
42 changes: 42 additions & 0 deletions stock_quant_cost_info/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_quant_cost_info
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-21 13:33+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\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 "<strong>Correttivo costo</strong>"

#. module: stock_quant_cost_info
#: model:ir.model.fields,field_description:stock_quant_cost_info.field_stock_quant__adjustment_cost
msgid "Adjustment cost"
msgstr "Correttivo costo"

#. module: stock_quant_cost_info
#: model:ir.model.fields,field_description:stock_quant_cost_info.field_stock_quant__currency_id
msgid "Currency"
msgstr "Valuta"

#. module: stock_quant_cost_info
#: model:ir.model,name:stock_quant_cost_info.model_stock_quant
msgid "Quants"
msgstr "Quanti"

#. 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 "Totale"
39 changes: 39 additions & 0 deletions stock_quant_cost_info/i18n/stock_quant_cost_info.pot
Original file line number Diff line number Diff line change
@@ -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 16.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 ""
3 changes: 3 additions & 0 deletions stock_quant_cost_info/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import stock_quant
24 changes: 24 additions & 0 deletions stock_quant_cost_info/models/stock_quant.py
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions stock_quant_cost_info/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions stock_quant_cost_info/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Ernesto Tejeda
- Pedro M. Baeza
- Sergio Teruel
- Carlos Roca
5 changes: 5 additions & 0 deletions stock_quant_cost_info/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
2 changes: 2 additions & 0 deletions stock_quant_cost_info/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
A pre_init_hook process is initiated in order to set the *Adjustment
cost* to zero in all existing *stock quant* before installation.
6 changes: 6 additions & 0 deletions stock_quant_cost_info/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To use this module, you need to:

1. Go to *Inventory \> Products \> Products* and create or select one.
2. Click on *Update Quantity* button.
3. In *Quant* list you will see a new column named *Adjustment cost*.
4. The cost will be recomputed when we change the *Counted Quantity*.
Binary file added stock_quant_cost_info/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading