new module stock_valuation_location
This commit is contained in:
parent
317b3f5bc4
commit
a8eb44a83e
5 changed files with 89 additions and 0 deletions
1
stock_valuation_location/__init__.py
Normal file
1
stock_valuation_location/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
from . import models
|
||||||
33
stock_valuation_location/__manifest__.py
Normal file
33
stock_valuation_location/__manifest__.py
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
#
|
||||||
|
# Bemade Inc.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023-June Bemade Inc. (<https://www.bemade.org>).
|
||||||
|
# Author: Marc Durepos (Contact : marc@bemade.org)
|
||||||
|
#
|
||||||
|
# This program is under the terms of the GNU Lesser General Public License,
|
||||||
|
# version 3.
|
||||||
|
#
|
||||||
|
# For full license details, see https://www.gnu.org/licenses/lgpl-3.0.en.html.
|
||||||
|
#
|
||||||
|
# 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 Valuation Location",
|
||||||
|
"version": "17.0.1.0.0",
|
||||||
|
"summary": "Add Location Information to Stock Valuation",
|
||||||
|
"category": "Inventory/Accounting",
|
||||||
|
"author": "Bemade Inc.",
|
||||||
|
"website": "http://www.bemade.org",
|
||||||
|
"license": "LGPL-3",
|
||||||
|
"depends": ["stock_account"],
|
||||||
|
"data": ["views/stock_valuation_layer_views.xml"],
|
||||||
|
"assets": {},
|
||||||
|
"installable": True,
|
||||||
|
"auto_install": False,
|
||||||
|
}
|
||||||
1
stock_valuation_location/models/__init__.py
Normal file
1
stock_valuation_location/models/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
from . import stock_valuation_layer
|
||||||
25
stock_valuation_location/models/stock_valuation_layer.py
Normal file
25
stock_valuation_location/models/stock_valuation_layer.py
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
"""
|
||||||
|
Adds the location to stock valuation layer, much in the same way the base code adds
|
||||||
|
warehouse_id.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class StockValuationLayer(models.Model):
|
||||||
|
_inherit = "stock.valuation.layer"
|
||||||
|
|
||||||
|
location_id = fields.Many2one(
|
||||||
|
comodel_name="stock.location",
|
||||||
|
string="Location",
|
||||||
|
compute="_compute_location_id",
|
||||||
|
store=True,
|
||||||
|
compute_sudo=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _compute_location_id(self):
|
||||||
|
for svl in self:
|
||||||
|
if svl.stock_move_id.location_id.usage == "internal":
|
||||||
|
svl.location_id = svl.stock_move_id.location_id
|
||||||
|
else:
|
||||||
|
svl.location_id = svl.stock_move_id.location_dest_id
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="stock_valuation_layer_tree_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">stock.valuation.layer.tree.inherit</field>
|
||||||
|
<field name="inherit_id" ref="stock_account.stock_valuation_layer_tree" />
|
||||||
|
<field name="model">stock.valuation.layer</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="company_id" position="after">
|
||||||
|
<field name="location_id" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record
|
||||||
|
id="stock_valuation_layer_valuation_at_date_tree_inherited_inherit"
|
||||||
|
model="ir.ui.view"
|
||||||
|
>
|
||||||
|
<field name="name">inventory.aging.tree.inherit</field>
|
||||||
|
<field name="model">stock.valuation.layer</field>
|
||||||
|
<field
|
||||||
|
name="inherit_id"
|
||||||
|
ref="stock_account.stock_valuation_layer_valuation_at_date_tree_inherited"
|
||||||
|
/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="product_id" position="before">
|
||||||
|
<field name="location_id" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Loading…
Reference in a new issue