Merge PR #1861 into 16.0

Signed-off-by JordiBForgeFlow
This commit is contained in:
OCA-git-bot
2024-01-10 12:22:40 +00:00
21 changed files with 1592 additions and 0 deletions

View File

@@ -0,0 +1 @@
../../../../stock_inventory

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -0,0 +1,90 @@
==========================
Stock Inventory Adjustment
==========================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-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/16.0/stock_inventory
: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-16-0/stock-logistics-warehouse-16-0-stock_inventory
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-warehouse&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to group Inventory Adjustments and have a group traceability (like before Odoo 15.0).
**Table of contents**
.. contents::
:local:
Usage
=====
Go to Inventory / Operations / Inventory Adjustments. Here you can see the list of Adjustment Grouped.
If you create a new Group, you can choose 2 types of product selection:
- All Products (all products from theselected locations).
- Manual Selection (choose manually each product in location).
- One Product (choose only one product in locations).
- Lot Serial Number (choose one product, any lots and locations).
- Product Category (choose one product category [childs also taken into account]).
When you start the adjustment (only one at a time) clicking on adjustments gets you to the view where adjustments are made.
From the group view, if you click on Stock Moves you can see the movements done (includes the 0 qty moves).
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%0Aversion:%2016.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
~~~~~~~
* ForgeFlow
Contributors
~~~~~~~~~~~~
* `ForgeFlow <https://www.forgeflow.com>`_:
* David Jiménez <david.jimenez@forgeflow.com>
* Guillem Casassas <guillem.casassas@forgeflow.com>
* Urvisha Desai <udesai@opensourceintegrators.com>
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/16.0/stock_inventory>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,20 @@
{
"name": "Stock Inventory Adjustment",
"version": "16.0.1.0.0",
"license": "LGPL-3",
"maintainer": ["DavidJForgeFlow"],
"development_status": "Beta",
"category": "Inventory/Inventory",
"summary": "Allows to do an easier follow up of the Inventory Adjustments",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"depends": ["stock"],
"data": [
"security/ir.model.access.csv",
"views/stock_inventory.xml",
"views/stock_quant.xml",
"views/stock_move_line.xml",
],
"installable": True,
"application": False,
}

View File

@@ -0,0 +1,233 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_inventory
#
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_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__count_stock_quants
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__count_stock_quants_string
msgid "Adjustments"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields.selection,name:stock_inventory.selection__stock_inventory__product_selection__all
msgid "All Products"
msgstr ""
#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
msgid "Back to Draft"
msgstr ""
#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
msgid "Begin Adjustments"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__create_uid
msgid "Created by"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__create_date
msgid "Created on"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__date
msgid "Date"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__display_name
msgid "Display Name"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields.selection,name:stock_inventory.selection__stock_inventory__state__done
msgid "Done"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields.selection,name:stock_inventory.selection__stock_inventory__state__draft
msgid "Draft"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__id
msgid "ID"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields.selection,name:stock_inventory.selection__stock_inventory__state__in_progress
msgid "In Progress"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__stock_quant_ids
#: model:ir.model.fields,field_description:stock_inventory.field_stock_move_line__inventory_adjustment_id
msgid "Inventory Adjustment"
msgstr ""
#. module: stock_inventory
#: model:ir.actions.act_window,name:stock_inventory.action_view_inventory_group_form
#: model:ir.model,name:stock_inventory.model_stock_inventory
msgid "Inventory Adjustment Group"
msgstr ""
#. module: stock_inventory
#: model:ir.ui.menu,name:stock_inventory.menu_action_inventory_tree
msgid "Inventory Adjustments"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__stock_move_ids
msgid "Inventory Adjustments Done"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__name
msgid "Inventory Reference"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory____last_update
msgid "Last Modified on"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__write_uid
msgid "Last Updated by"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__write_date
msgid "Last Updated on"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__location_ids
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
msgid "Locations"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields.selection,name:stock_inventory.selection__stock_inventory__product_selection__lot
msgid "Lot/Serial Number"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__lot_ids
msgid "Lot/Serial Numbers"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields.selection,name:stock_inventory.selection__stock_inventory__product_selection__manual
msgid "Manual Selection"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields.selection,name:stock_inventory.selection__stock_inventory__product_selection__one
msgid "One Product"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__owner_id
msgid "Owner"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__category_id
#: model:ir.model.fields.selection,name:stock_inventory.selection__stock_inventory__product_selection__category
msgid "Product Category"
msgstr ""
#. module: stock_inventory
#: model:ir.model,name:stock_inventory.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__product_selection
msgid "Product Selection"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__product_ids
msgid "Products"
msgstr ""
#. module: stock_inventory
#: model:ir.model,name:stock_inventory.model_stock_quant
msgid "Quants"
msgstr ""
#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
msgid "Set to Done"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__state
msgid "State"
msgstr ""
#. module: stock_inventory
#: model:ir.actions.act_window,name:stock_inventory.action_view_stock_move_line_inventory_tree
msgid "Stock Move Lines"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__count_stock_moves
msgid "Stock Moves Lines"
msgstr ""
#. module: stock_inventory
#: code:addons/stock_inventory/models/stock_inventory.py:0
#, python-format
msgid ""
"There's already an Adjustment in Process using one requested Location: %s"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,help:stock_inventory.field_stock_inventory__owner_id
msgid "This is the owner of the inventory adjustment"
msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_quant__to_do
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_stock_quant_search_not_done
msgid "To Do"
msgstr ""
#. module: stock_inventory
#: code:addons/stock_inventory/models/stock_inventory.py:0
#, python-format
msgid ""
"When 'Product Selection: Lot Serial Number' is selected you are only able to"
" add one product."
msgstr ""
#. module: stock_inventory
#: code:addons/stock_inventory/models/stock_inventory.py:0
#, python-format
msgid ""
"When 'Product Selection: One Product' is selected you are only able to add "
"one product."
msgstr ""
#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
msgid "e.g. Annual inventory"
msgstr ""

View File

@@ -0,0 +1,3 @@
from . import stock_inventory
from . import stock_quant
from . import stock_move_line

View File

@@ -0,0 +1,216 @@
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.osv import expression
class InventoryAdjustmentsGroup(models.Model):
_name = "stock.inventory"
_description = "Inventory Adjustment Group"
_order = "date desc, id desc"
name = fields.Char(required=True, default="Inventory", string="Inventory Reference")
date = fields.Datetime(default=lambda self: fields.Datetime.now())
state = fields.Selection(
[("draft", "Draft"), ("in_progress", "In Progress"), ("done", "Done")],
default="draft",
)
owner_id = fields.Many2one(
"res.partner", "Owner", help="This is the owner of the inventory adjustment"
)
location_ids = fields.Many2many(
"stock.location", string="Locations", domain="[('usage', '=', 'internal')]"
)
product_selection = fields.Selection(
[
("all", "All Products"),
("manual", "Manual Selection"),
("category", "Product Category"),
("one", "One Product"),
("lot", "Lot/Serial Number"),
],
default="all",
required=True,
)
product_ids = fields.Many2many("product.product", string="Products")
stock_quant_ids = fields.Many2many("stock.quant", string="Inventory Adjustment")
category_id = fields.Many2one("product.category", string="Product Category")
lot_ids = fields.Many2many(
"stock.lot",
string="Lot/Serial Numbers",
)
stock_move_ids = fields.One2many(
"stock.move.line",
"inventory_adjustment_id",
string="Inventory Adjustments Done",
)
count_stock_quants = fields.Integer(
compute="_compute_count_stock_quants", string="# Adjustments"
)
count_stock_quants_string = fields.Char(
compute="_compute_count_stock_quants", string="Adjustments"
)
count_stock_moves = fields.Integer(
compute="_compute_count_stock_moves", string="Stock Moves Lines"
)
@api.depends("stock_quant_ids")
def _compute_count_stock_quants(self):
self.count_stock_quants = len(self.stock_quant_ids)
count_todo = len(
self.stock_quant_ids.search(
[("id", "in", self.stock_quant_ids.ids), ("to_do", "=", "True")]
)
)
self.count_stock_quants_string = "{} / {}".format(
count_todo, self.count_stock_quants
)
@api.depends("stock_move_ids")
def _compute_count_stock_moves(self):
sm_ids = self.mapped("stock_move_ids").ids
self.count_stock_moves = len(sm_ids)
def _get_quants(self, locations):
domain = []
base_domain = self._get_base_domain(locations)
if self.product_selection == "all":
domain = self._get_domain_all_quants(base_domain)
elif self.product_selection == "manual":
domain = self._get_domain_manual_quants(base_domain)
elif self.product_selection == "one":
domain = self._get_domain_one_quant(base_domain)
elif self.product_selection == "lot":
domain = self._get_domain_lot_quants(base_domain)
elif self.product_selection == "category":
domain = self._get_domain_category_quants(base_domain)
return self.env["stock.quant"].search(domain)
def _get_base_domain(self, locations):
return [
"|",
("location_id", "in", locations.mapped("id")),
("location_id", "in", locations.child_ids.ids),
]
def _get_domain_all_quants(self, base_domain):
return base_domain
def _get_domain_manual_quants(self, base_domain):
return expression.AND(
[base_domain, [("product_id", "in", self.product_ids.ids)]]
)
def _get_domain_one_quant(self, base_domain):
return expression.AND(
[
base_domain,
[
("product_id", "in", self.product_ids.ids),
],
]
)
def _get_domain_lot_quants(self, base_domain):
return expression.AND(
[
base_domain,
[
("product_id", "in", self.product_ids.ids),
("lot_id", "in", self.lot_ids.ids),
],
]
)
def _get_domain_category_quants(self, base_domain):
return expression.AND(
[
base_domain,
[
"|",
("product_id.categ_id", "=", self.category_id.id),
("product_id.categ_id", "in", self.category_id.child_id.ids),
],
]
)
def action_state_to_in_progress(self):
active_rec = self.env["stock.inventory"].search(
[
("state", "=", "in_progress"),
"|",
("location_ids", "in", self.location_ids.mapped("id")),
("location_ids", "in", self.location_ids.child_ids.ids),
],
limit=1,
)
if active_rec:
raise ValidationError(
_(
"There's already an Adjustment in Process using one requested Location: %s"
)
% active_rec.name
)
self.state = "in_progress"
self.stock_quant_ids = self._get_quants(self.location_ids)
self.stock_quant_ids.update({"to_do": True})
return
def action_state_to_done(self):
self.state = "done"
self.stock_quant_ids.update({"to_do": True})
return
def action_state_to_draft(self):
self.state = "draft"
self.stock_quant_ids.update({"to_do": True})
self.stock_quant_ids = None
return
def action_view_inventory_adjustment(self):
result = self.env["stock.quant"].action_view_inventory()
ia_ids = self.mapped("stock_quant_ids").ids
result["domain"] = [("id", "in", ia_ids)]
result["search_view_id"] = self.env.ref("stock.quant_search_view").id
result["context"]["search_default_to_do"] = 1
return result
def action_view_stock_moves(self):
result = self.env["ir.actions.act_window"]._for_xml_id(
"stock_inventory.action_view_stock_move_line_inventory_tree"
)
sm_ids = self.mapped("stock_move_ids").ids
result["domain"] = [("id", "in", sm_ids)]
result["context"] = []
return result
@api.constrains("product_selection", "product_ids")
def _check_one_product_in_product_selection(self):
for rec in self:
if len(rec.product_ids) > 1:
if rec.product_selection == "one":
raise ValidationError(
_(
"When 'Product Selection: One Product' is selected"
" you are only able to add one product."
)
)
elif rec.product_selection == "lot":
raise ValidationError(
_(
"When 'Product Selection: Lot Serial Number' is selected"
" you are only able to add one product."
)
)

View File

@@ -0,0 +1,7 @@
from odoo import fields, models
class StockMoveLine(models.Model):
_inherit = "stock.move.line"
inventory_adjustment_id = fields.Many2one("stock.inventory")

View File

@@ -0,0 +1,44 @@
from odoo import _, fields, models
class StockQuant(models.Model):
_inherit = "stock.quant"
to_do = fields.Boolean(default=True)
def _apply_inventory(self):
res = super()._apply_inventory()
record_moves = self.env["stock.move.line"]
for rec in self:
adjustment = (
self.env["stock.inventory"]
.search([("state", "=", "in_progress")])
.filtered(
lambda x: rec.location_id in x.location_ids
or rec.location_id in x.location_ids.child_ids
)
)
moves = record_moves.search(
[
("product_id", "=", rec.product_id.id),
("lot_id", "=", rec.lot_id.id),
"|",
("location_id", "=", rec.location_id.id),
("location_dest_id", "=", rec.location_id.id),
],
order="create_date asc",
).filtered(
lambda x: not x.company_id.id
or not rec.company_id.id
or rec.company_id.id == x.company_id.id
)
if len(moves) == 0:
raise ValueError(_("No move lines have been created"))
move = moves[len(moves) - 1]
adjustment.stock_move_ids |= move
move.inventory_adjustment_id = adjustment
rec.to_do = False
return res
def _get_inventory_fields_write(self):
return super()._get_inventory_fields_write() + ["to_do"]

View File

@@ -0,0 +1,5 @@
* `ForgeFlow <https://www.forgeflow.com>`_:
* David Jiménez <david.jimenez@forgeflow.com>
* Guillem Casassas <guillem.casassas@forgeflow.com>
* Urvisha Desai <gudesai@opensourceintegrators.com>

View File

@@ -0,0 +1 @@
This module allows to group Inventory Adjustments and have a group traceability (like before Odoo 15.0).

View File

@@ -0,0 +1,9 @@
Go to Inventory / Operations / Inventory Adjustments. Here you can see the list of Adjustment Grouped.
If you create a new Group, you can choose 2 types of product selection:
- All Products (all products from theselected locations).
- Manual Selection (choose manually each product in location).
- One Product (choose only one product in locations).
- Lot Serial Number (choose one product, any lots and locations).
- Product Category (choose one product category [childs also taken into account]).
When you start the adjustment (only one at a time) clicking on adjustments gets you to the view where adjustments are made.
From the group view, if you click on Stock Moves you can see the movements done (includes the 0 qty moves).

View File

@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_inventory_user,stock.inventory,model_stock_inventory,base.group_user,1,0,0,0
access_stock_inventory_manager,stock.inventory,model_stock_inventory,base.group_system,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_stock_inventory_user stock.inventory model_stock_inventory base.group_user 1 0 0 0
3 access_stock_inventory_manager stock.inventory model_stock_inventory base.group_system 1 1 1 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,437 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Stock Inventory Adjustment</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="stock-inventory-adjustment">
<h1 class="title">Stock Inventory Adjustment</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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_inventory"><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-16-0/stock-logistics-warehouse-16-0-stock_inventory"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-warehouse&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to group Inventory Adjustments and have a group traceability (like before Odoo 15.0).</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>Go to Inventory / Operations / Inventory Adjustments. Here you can see the list of Adjustment Grouped.
If you create a new Group, you can choose 2 types of product selection:
- All Products (all products from theselected locations).
- Manual Selection (choose manually each product in location).
- One Product (choose only one product in locations).
- Lot Serial Number (choose one product, any lots and locations).
- Product Category (choose one product category [childs also taken into account]).
When you start the adjustment (only one at a time) clicking on adjustments gets you to the view where adjustments are made.
From the group view, if you click on Stock Moves you can see the movements done (includes the 0 qty moves).</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<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%0Aversion:%2016.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">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<ul class="simple">
<li>ForgeFlow</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.forgeflow.com">ForgeFlow</a>:<ul>
<li>David Jiménez &lt;<a class="reference external" href="mailto:david.jimenez&#64;forgeflow.com">david.jimenez&#64;forgeflow.com</a>&gt;</li>
<li>Guillem Casassas &lt;<a class="reference external" href="mailto:guillem.casassas&#64;forgeflow.com">guillem.casassas&#64;forgeflow.com</a>&gt;</li>
<li>Urvisha Desai &lt;<a class="reference external" href="mailto:udesai&#64;opensourceintegrators.com">udesai&#64;opensourceintegrators.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<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/16.0/stock_inventory">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>
</div>
</body>
</html>

View File

@@ -0,0 +1 @@
from . import test_stock_inventory

View File

@@ -0,0 +1,316 @@
# Copyright 2022 ForgeFlow S.L
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
class TestStockInventory(TransactionCase):
def setUp(self):
super(TestStockInventory, self).setUp()
self.quant_model = self.env["stock.quant"]
self.move_model = self.env["stock.move.line"]
self.inventory_model = self.env["stock.inventory"]
self.location_model = self.env["stock.location"]
self.product_categ = self.env["product.category"].create({"name": "Test Categ"})
self.product = self.env["product.product"].create(
{
"name": "Product 1 test",
"type": "product",
"tracking": "lot",
}
)
self.product2 = self.env["product.product"].create(
{
"name": "Product 1 test",
"type": "product",
"categ_id": self.product_categ.id,
}
)
self.lot_1 = self.env["stock.lot"].create(
{
"product_id": self.product.id,
"name": "Lot 1",
"company_id": self.env.company.id,
}
)
self.lot_2 = self.env["stock.lot"].create(
{
"product_id": self.product.id,
"name": "Lot 2",
"company_id": self.env.company.id,
}
)
self.lot_3 = self.env["stock.lot"].create(
{
"product_id": self.product.id,
"name": "Lot 3",
"company_id": self.env.company.id,
}
)
self.location_src = self.env.ref("stock.stock_location_locations_virtual")
self.location_dst = self.env.ref("stock.stock_location_customers")
self.location1 = self.location_model.create(
{
"name": "Location 1",
"usage": "internal",
"location_id": self.location_src.id,
}
)
self.location2 = self.location_model.create(
{
"name": "Location 2",
"usage": "internal",
"location_id": self.location_dst.id,
}
)
self.location3 = self.location_model.create(
{
"name": "Location 3",
"usage": "internal",
"location_id": self.location1.id,
}
)
self.quant1 = self.quant_model.sudo().create(
{
"product_id": self.product.id,
"lot_id": self.lot_1.id,
"quantity": 100.0,
"location_id": self.location1.id,
}
)
self.quant2 = self.quant_model.sudo().create(
{
"product_id": self.product.id,
"lot_id": self.lot_2.id,
"quantity": 100.0,
"location_id": self.location2.id,
}
)
self.quant3 = self.quant_model.sudo().create(
{
"product_id": self.product.id,
"lot_id": self.lot_3.id,
"quantity": 100.0,
"location_id": self.location3.id,
}
)
self.quant4 = self.quant_model.sudo().create(
{
"product_id": self.product2.id,
"quantity": 100.0,
"location_id": self.location3.id,
}
)
def test_01_all_locations(self):
inventory1 = self.inventory_model.create(
{
"name": "Inventory_Test_1",
"product_selection": "all",
"location_ids": [self.location1.id],
}
)
inventory1.action_state_to_in_progress()
inventory2 = self.inventory_model.create(
{
"name": "Inventory_Test_2",
"product_selection": "all",
"location_ids": [self.location1.id],
}
)
with self.assertRaises(ValidationError), self.cr.savepoint():
inventory2.action_state_to_in_progress()
self.assertEqual(inventory1.state, "in_progress")
self.assertEqual(
inventory1.stock_quant_ids.ids,
[self.quant1.id, self.quant3.id, self.quant4.id],
)
inventory1.action_state_to_draft()
self.assertEqual(inventory1.stock_quant_ids.ids, [])
inventory1.action_state_to_in_progress()
self.assertEqual(inventory1.count_stock_moves, 0)
self.assertEqual(inventory1.count_stock_quants, 3)
self.assertEqual(inventory1.count_stock_quants_string, "3 / 3")
inventory1.action_view_inventory_adjustment()
self.quant1.inventory_quantity = 92
self.quant1.action_apply_inventory()
inventory1._compute_count_stock_quants()
inventory1.action_view_stock_moves()
self.assertEqual(inventory1.count_stock_moves, 1)
self.assertEqual(inventory1.count_stock_quants, 3)
self.assertEqual(inventory1.count_stock_quants_string, "2 / 3")
self.assertEqual(inventory1.stock_move_ids.qty_done, 8)
self.assertEqual(inventory1.stock_move_ids.product_id.id, self.product.id)
self.assertEqual(inventory1.stock_move_ids.lot_id.id, self.lot_1.id)
self.assertEqual(inventory1.stock_move_ids.location_id.id, self.location1.id)
inventory1.action_state_to_done()
def test_02_manual_selection(self):
inventory1 = self.inventory_model.create(
{
"name": "Inventory_Test_3",
"product_selection": "manual",
"location_ids": [self.location1.id],
"product_ids": [self.product.id],
}
)
inventory1.action_state_to_in_progress()
self.assertEqual(inventory1.state, "in_progress")
self.assertEqual(
inventory1.stock_quant_ids.ids, [self.quant1.id, self.quant3.id]
)
inventory1.action_state_to_draft()
self.assertEqual(inventory1.stock_quant_ids.ids, [])
inventory1.action_state_to_in_progress()
self.assertEqual(inventory1.state, "in_progress")
self.assertEqual(inventory1.count_stock_moves, 0)
self.assertEqual(inventory1.count_stock_quants, 2)
self.assertEqual(inventory1.count_stock_quants_string, "2 / 2")
inventory1.action_view_inventory_adjustment()
self.quant3.inventory_quantity = 74
self.quant3.action_apply_inventory()
inventory1._compute_count_stock_quants()
inventory1.action_view_stock_moves()
self.assertEqual(inventory1.count_stock_moves, 1)
self.assertEqual(inventory1.count_stock_quants, 2)
self.assertEqual(inventory1.count_stock_quants_string, "1 / 2")
self.assertEqual(inventory1.stock_move_ids.qty_done, 26)
self.assertEqual(inventory1.stock_move_ids.product_id.id, self.product.id)
self.assertEqual(inventory1.stock_move_ids.lot_id.id, self.lot_3.id)
self.assertEqual(inventory1.stock_move_ids.location_id.id, self.location3.id)
self.quant1.inventory_quantity = 65
self.quant1.action_apply_inventory()
inventory1._compute_count_stock_quants()
self.assertEqual(inventory1.count_stock_moves, 2)
self.assertEqual(inventory1.count_stock_quants, 2)
self.assertEqual(inventory1.count_stock_quants_string, "0 / 2")
inventory1.action_state_to_done()
def test_03_one_selection(self):
with self.assertRaises(ValidationError), self.cr.savepoint():
inventory1 = self.inventory_model.create(
{
"name": "Inventory_Test_5",
"product_selection": "one",
"location_ids": [self.location1.id],
"product_ids": [self.product.id, self.product2.id],
}
)
inventory1 = self.inventory_model.create(
{
"name": "Inventory_Test_5",
"product_selection": "one",
"location_ids": [self.location1.id],
"product_ids": [self.product.id],
}
)
inventory1.action_state_to_in_progress()
inventory1.product_ids = [self.product.id]
self.assertEqual(
inventory1.stock_quant_ids.ids, [self.quant1.id, self.quant3.id]
)
inventory1.action_state_to_draft()
self.assertEqual(inventory1.stock_quant_ids.ids, [])
inventory1.action_state_to_in_progress()
self.assertEqual(inventory1.state, "in_progress")
self.assertEqual(inventory1.count_stock_moves, 0)
self.assertEqual(inventory1.count_stock_quants, 2)
self.assertEqual(inventory1.count_stock_quants_string, "2 / 2")
inventory1.action_view_inventory_adjustment()
self.quant3.inventory_quantity = 74
self.quant3.action_apply_inventory()
inventory1._compute_count_stock_quants()
inventory1.action_view_stock_moves()
self.assertEqual(inventory1.count_stock_moves, 1)
self.assertEqual(inventory1.count_stock_quants, 2)
self.assertEqual(inventory1.count_stock_quants_string, "1 / 2")
self.assertEqual(inventory1.stock_move_ids.qty_done, 26)
self.assertEqual(inventory1.stock_move_ids.product_id.id, self.product.id)
self.assertEqual(inventory1.stock_move_ids.lot_id.id, self.lot_3.id)
self.assertEqual(inventory1.stock_move_ids.location_id.id, self.location3.id)
self.quant1.inventory_quantity = 65
self.quant1.action_apply_inventory()
inventory1._compute_count_stock_quants()
self.assertEqual(inventory1.count_stock_moves, 2)
self.assertEqual(inventory1.count_stock_quants, 2)
self.assertEqual(inventory1.count_stock_quants_string, "0 / 2")
inventory1.action_state_to_done()
def test_04_lot_selection(self):
with self.assertRaises(ValidationError), self.cr.savepoint():
inventory1 = self.inventory_model.create(
{
"name": "Inventory_Test_6",
"product_selection": "lot",
"location_ids": [self.location1.id],
"lot_ids": [self.lot_3.id],
"product_ids": [self.product.id, self.product2.id],
}
)
inventory1 = self.inventory_model.create(
{
"name": "Inventory_Test_6",
"product_selection": "lot",
"location_ids": [self.location1.id],
"lot_ids": [self.lot_3.id],
"product_ids": [self.product.id],
}
)
inventory1.product_ids = [self.product.id]
inventory1.action_state_to_in_progress()
self.assertEqual(inventory1.stock_quant_ids.ids, [self.quant3.id])
inventory1.action_state_to_draft()
self.assertEqual(inventory1.stock_quant_ids.ids, [])
inventory1.action_state_to_in_progress()
self.assertEqual(inventory1.state, "in_progress")
self.assertEqual(inventory1.count_stock_moves, 0)
self.assertEqual(inventory1.count_stock_quants, 1)
self.assertEqual(inventory1.count_stock_quants_string, "1 / 1")
inventory1.action_view_inventory_adjustment()
self.quant3.inventory_quantity = 74
self.quant3.action_apply_inventory()
inventory1._compute_count_stock_quants()
inventory1.action_view_stock_moves()
self.assertEqual(inventory1.count_stock_moves, 1)
self.assertEqual(inventory1.count_stock_quants, 1)
self.assertEqual(inventory1.count_stock_quants_string, "0 / 1")
self.assertEqual(inventory1.stock_move_ids.qty_done, 26)
self.assertEqual(inventory1.stock_move_ids.product_id.id, self.product.id)
self.assertEqual(inventory1.stock_move_ids.lot_id.id, self.lot_3.id)
self.assertEqual(inventory1.stock_move_ids.location_id.id, self.location3.id)
inventory1.action_state_to_done()
def test_05_category_selection(self):
inventory1 = self.inventory_model.create(
{
"name": "Inventory_Test_7",
"product_selection": "category",
"location_ids": [self.location3.id],
"category_id": self.product_categ.id,
}
)
inventory1.action_state_to_in_progress()
# Remove company_id from stock-quant to test it works as expected
inventory1.stock_quant_ids.write({"company_id": False})
self.assertEqual(inventory1.stock_quant_ids.ids, [self.quant4.id])
inventory1.action_state_to_draft()
self.assertEqual(inventory1.stock_quant_ids.ids, [])
inventory1.action_state_to_in_progress()
self.assertEqual(inventory1.state, "in_progress")
self.assertEqual(inventory1.count_stock_moves, 0)
self.assertEqual(inventory1.count_stock_quants, 1)
self.assertEqual(inventory1.count_stock_quants_string, "1 / 1")
inventory1.action_view_inventory_adjustment()
self.quant4.inventory_quantity = 74
self.quant4.action_apply_inventory()
inventory1._compute_count_stock_quants()
inventory1.action_view_stock_moves()
self.assertEqual(inventory1.count_stock_moves, 1)
self.assertEqual(inventory1.count_stock_quants, 1)
self.assertEqual(inventory1.count_stock_quants_string, "0 / 1")
self.assertEqual(inventory1.stock_move_ids.qty_done, 26)
self.assertEqual(inventory1.stock_move_ids.product_id.id, self.product2.id)
self.assertEqual(inventory1.stock_move_ids.location_id.id, self.location3.id)
inventory1.action_state_to_done()

View File

@@ -0,0 +1,154 @@
<odoo>
<record id="view_inventory_group_form" model="ir.ui.view">
<field name="name">stock.inventory.form.view</field>
<field name="model">stock.inventory</field>
<field name="priority">1000</field>
<field name="arch" type="xml">
<form>
<header>
<button
type="object"
name="action_state_to_in_progress"
class="oe_highlight"
attrs="{'invisible':[('state', 'in', ['in_progress', 'done'])]}"
string="Begin Adjustments"
/>
<button
type="object"
name="action_state_to_draft"
attrs="{'invisible':['|',('state', 'in', ['draft', 'done']), ('count_stock_moves', '!=', 0)]}"
string="Back to Draft"
/>
<button
type="object"
name="action_state_to_done"
class="oe_highlight"
attrs="{'invisible':[('state', 'in', ['draft', 'done'])]}"
string="Set to Done"
/>
<field
name="state"
widget="statusbar"
statusbar_visible="draft,in_progress,done"
/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button
type="object"
name="action_view_inventory_adjustment"
class="oe_stat_button"
icon="fa-pencil-square-o"
attrs="{'invisible':['|', ('state', 'in', ['draft', 'done']), ('count_stock_quants', '=', 0)]}"
>
<field
name="count_stock_quants_string"
widget="statinfo"
readonly="1"
/>
<field invisible="True" name="count_stock_quants" />
</button>
<button
type="object"
name="action_view_stock_moves"
class="oe_stat_button"
icon="fa-cubes"
attrs="{'invisible':['|', ('state', '=', 'draft'), ('count_stock_moves', '=', 0)]}"
>
<field
name="count_stock_moves"
widget="statinfo"
readonly="1"
/>
</button>
</div>
<div class="oe_title" name="title">
<label for="name" class="oe_edit_only" />
<h1><field name="name" placeholder="e.g. Annual inventory" /></h1>
</div>
<group>
<group>
<field
name="product_selection"
widget="radio"
attrs="{'readonly':[('state', 'in', ['in_progress', 'done'])]}"
/>
<field
name="location_ids"
string="Locations"
widget="many2many_tags"
attrs="{'readonly':[('state', 'in', ['in_progress', 'done'])]}"
required="1"
/>
</group>
<group>
<field name="date" />
<field
name="owner_id"
attrs="{'readonly':[('state', '=', 'done')]}"
/>
<field
name="product_ids"
widget="many2many_tags"
attrs="{'readonly':[('state', 'in', ['in_progress', 'done'])], 'required': [('product_selection', 'in', ['manual', 'lot'])],'invisible': [('product_selection', 'in', ['all', 'category', 'one'])]}"
/>
<field
name="product_ids"
widget="many2many_tags"
options="{'limit': 10}"
attrs="{'readonly':[('state', 'in', ['in_progress', 'done'])], 'required': [('product_selection', '=', 'one')],'invisible': [('product_selection', '!=', 'one')]}"
/>
<field
name="category_id"
attrs="{'readonly':[('state', 'in', ['in_progress', 'done'])], 'required': [('product_selection', '=', 'category')],'invisible': [('product_selection', '!=', 'category')]}"
/>
<field
name="lot_ids"
widget="many2many_tags"
domain="[('product_id', 'in', product_ids)]"
attrs="{'readonly':[('state', 'in', ['in_progress', 'done'])], 'required': [('product_selection', '=', 'lot')],'invisible': [('product_selection', '!=', 'lot')]}"
/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_inventory_group_tree" model="ir.ui.view">
<field name="name">stock.inventory.tree.view</field>
<field name="model">stock.inventory</field>
<field name="priority">1000</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
<field
name="state"
widget="badge"
decoration-success="state == 'done'"
decoration-info="state not in ('done', 'draft')"
decoration-muted="state == 'draft'"
/>
<field name="date" />
</tree>
</field>
</record>
<record id="action_view_inventory_group_form" model="ir.actions.act_window">
<field name="name">Inventory Adjustment Group</field>
<field name="res_model">stock.inventory</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_inventory_group_tree" />
</record>
<menuitem
id="menu_action_inventory_tree"
name="Inventory Adjustments"
parent="stock.menu_stock_warehouse_mgmt"
sequence="30"
action="action_view_inventory_group_form"
/>
<delete model="ir.ui.menu" id="stock.menu_action_inventory_tree" />
</odoo>

View File

@@ -0,0 +1,29 @@
<odoo>
<record id="view_stock_move_line_inventory_tree" model="ir.ui.view">
<field name="name">stock.move.line.tree.view.inventory</field>
<field name="model">stock.move.line</field>
<field name="priority">1000</field>
<field name="arch" type="xml">
<tree>
<field name="date" />
<field name="product_id" />
<field name="lot_id" />
<field name="location_id" />
<field name="location_dest_id" />
<field name="qty_done" />
<field name="company_id" optional="hide" />
<field name="reference" optional="show" />
</tree>
</field>
</record>
<record
id="action_view_stock_move_line_inventory_tree"
model="ir.actions.act_window"
>
<field name="name">Stock Move Lines</field>
<field name="res_model">stock.move.line</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_stock_move_line_inventory_tree" />
</record>
</odoo>

View File

@@ -0,0 +1,16 @@
<odoo>
<record id="view_stock_quant_search_not_done" model="ir.ui.view">
<field name="name">stock.quant.search.not.done</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.quant_search_view" />
<field name="arch" type="xml">
<filter name="to_apply" position="after">
<filter
name='to_do'
string="To Do"
domain="[('to_do', '=', 'True')]"
/>
</filter>
</field>
</record>
</odoo>