diff --git a/bemade_stock_quant_valuation/__init__.py b/bemade_stock_quant_valuation/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/bemade_stock_quant_valuation/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/bemade_stock_quant_valuation/__manifest__.py b/bemade_stock_quant_valuation/__manifest__.py new file mode 100644 index 0000000..19ffd69 --- /dev/null +++ b/bemade_stock_quant_valuation/__manifest__.py @@ -0,0 +1,33 @@ +# +# Bemade Inc. +# +# Copyright (C) September 2023 Bemade Inc. (). +# Author: Marc Durepos (Contact : marc@bemade.org) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the Software +# or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +{ + 'name': 'Stock Quant Valuation', + 'version': '15.0.1.0.0', + 'summary': 'Adds valuation to stock quant for better inventory adjustment management', + 'description': '', + 'category': 'Inventory', + 'author': 'Bemade Inc.', + 'website': 'https://www.bemade.org', + 'license': 'OPL-1', + 'depends': ['stock_account'], + 'data': ['views/stock_account_views.xml'], + 'demo': [], + 'installable': True, + 'auto_install': False, +} diff --git a/bemade_stock_quant_valuation/models/__init__.py b/bemade_stock_quant_valuation/models/__init__.py new file mode 100644 index 0000000..70f8e6c --- /dev/null +++ b/bemade_stock_quant_valuation/models/__init__.py @@ -0,0 +1 @@ +from . import stock_quant diff --git a/bemade_stock_quant_valuation/models/stock_quant.py b/bemade_stock_quant_valuation/models/stock_quant.py new file mode 100644 index 0000000..17e0d7b --- /dev/null +++ b/bemade_stock_quant_valuation/models/stock_quant.py @@ -0,0 +1,21 @@ +from odoo import models, fields, api + + +class StockQuant(models.Model): + _inherit = 'stock.quant' + + value_unit = fields.Float(related='product_id.standard_price', readonly=True, + groups='stock.group_stock_manager', digits='Product Price') + value_difference = fields.Float(compute='_compute_difference_value', + help='The value of the difference between the ' + 'quantity on hand and the counted ' + 'quantity.', + groups='stock.group_stock_manager', + digits='Product Price', + store=True) + + @api.depends('inventory_diff_quantity', 'value_unit') + def _compute_difference_value(self): + for rec in self: + rec.value_difference = (rec.value_unit * rec.inventory_diff_quantity + if rec.inventory_diff_quantity is not None else None) diff --git a/bemade_stock_quant_valuation/views/stock_account_views.xml b/bemade_stock_quant_valuation/views/stock_account_views.xml new file mode 100644 index 0000000..9078a40 --- /dev/null +++ b/bemade_stock_quant_valuation/views/stock_account_views.xml @@ -0,0 +1,19 @@ + + + + + stock.quant.inventory.tree.editable.inherit + stock.quant + + + + + + + + + + + + + \ No newline at end of file