ADD module stock_inventory_usability

This commit is contained in:
Benoit
2022-07-25 16:21:15 +02:00
parent d64262099b
commit c51a847f80
5 changed files with 64 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,18 @@
# Copyright 2022 Akretion (https://www.akretion.com).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Inventory Usability",
"summary": "Stock inventory usability.",
"version": "14.0.1.0.1",
"development_status": "Mature",
"author": "Akretion",
"website": "https://github.com/akretion/odoo-usability",
"category": "Warehouse",
"depends": ["stock"],
"data": [
"views/stock_inventory.xml",
],
"license": "AGPL-3",
"installable": True,
"application": False,
}

View File

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

View File

@@ -0,0 +1,17 @@
# Copyright 2022 Akretion (https://www.akretion.com).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, fields, models, api
from odoo.exceptions import UserError
class Inventory(models.Model):
_inherit = "stock.inventory"
prefill_counted_quantity = fields.Selection(default="zero")
estimated_inventory_lines = fields.Float(compute="_compute_estimated_inventory_lines") #store ?
@api.depends("location_ids", "product_ids")
def _compute_estimated_inventory_lines(self):
for inv in self:
inv.estimated_inventory_lines = len(inv._get_quantities())

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 Akretion (https://www.akretion.com).
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_inventory_form" model="ir.ui.view">
<field
name="name"
>Inventory form view - stock_inventory_usability extension</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock.view_inventory_form" />
<field name="arch" type="xml">
<field name="prefill_counted_quantity" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="exhausted" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="accounting_date" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="product_ids" position="after">
<field name="estimated_inventory_lines" readonly="1" states="draft"/>
</field>
</field>
</record>
</odoo>