[MIG] stock_usability from v14 to v16

This commit is contained in:
Alexis de Lattre
2022-10-27 00:05:43 +02:00
parent 4f13432bdc
commit 15c77b3e8a
28 changed files with 184 additions and 359 deletions

View File

@@ -1,11 +1,11 @@
# Copyright 2014-2020 Akretion (http://www.akretion.com)
# Copyright 2014-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Stock Usability',
'version': '14.0.1.0.0',
'version': '16.0.1.0.0',
'category': 'Inventory, Logistic, Storage',
'license': 'AGPL-3',
'summary': 'Several usability enhancements in Warehouse management',
@@ -27,18 +27,19 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
'depends': ['stock'],
'data': [
'views/stock_quant.xml',
'views/stock_inventory.xml',
'views/stock_location.xml',
'views/stock_move.xml',
'views/stock_move_line.xml',
'views/stock_picking.xml',
'views/stock_picking_type.xml',
'views/stock_warehouse.xml',
'views/stock_warehouse_orderpoint.xml',
'views/product.xml',
'views/procurement_group.xml',
'views/stock_production_lot.xml',
'views/stock_lot.xml',
'views/procurement_scheduler_log.xml',
'security/ir.model.access.csv',
],
'post_init_hook': 'create_config_parameter_immediate_tranfer',
'installable': False,
'installable': True,
}

View File

@@ -1,9 +1,9 @@
from . import stock_move
from . import stock_move_line
from . import stock_picking
from . import stock_location_route
from . import stock_warehouse_orderpoint
from . import stock_quant
from . import stock_inventory
from . import procurement_group
from . import procurement_scheduler_log
from . import product

View File

@@ -1,4 +1,4 @@
# Copyright 2015-2020 Akretion (http://www.akretion.com)
# Copyright 2015-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,4 +1,4 @@
# Copyright 2015-2020 Akretion (http://www.akretion.com)
# Copyright 2015-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,4 +1,4 @@
# Copyright 2016-2021 Akretion France
# Copyright 2016-2022 Akretion France
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -10,12 +10,12 @@ class ProductTemplate(models.Model):
tracking = fields.Selection(tracking=True)
sale_delay = fields.Float(tracking=True)
# the 'stock' module adds 'product' in type...
# the 'stock' module adds 'product' in detailed_type...
# but forgets to make it the default
type = fields.Selection(default='product')
detailed_type = fields.Selection(default='product')
def action_view_stock_move(self):
action = self.env.ref('stock.stock_move_action').sudo().read()[0]
action = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_action")
action['domain'] = [('product_id.product_tmpl_id', 'in', self.ids)]
action['context'] = {'search_default_done': True}
return action
@@ -25,7 +25,7 @@ class ProductProduct(models.Model):
_inherit = 'product.product'
def action_view_stock_move(self):
action = self.env.ref('stock.stock_move_action').sudo().read()[0]
action = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_action")
action['domain'] = [('product_id', 'in', self.ids)]
action['context'] = {'search_default_done': True}
return action

View File

@@ -1,4 +1,4 @@
# Copyright 2017-2020 Akretion France (https://akretion.com/)
# Copyright 2017-2022 Akretion France (https://akretion.com/)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,45 +0,0 @@
# Copyright 2021-2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models, _
from odoo.tools import float_compare, float_is_zero
class StockInventory(models.Model):
_inherit = 'stock.inventory'
prefill_counted_quantity = fields.Selection(
readonly=True, states={'draft': [('readonly', False)]})
class StockInventoryLine(models.Model):
_inherit = 'stock.inventory.line'
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
difference_qty = fields.Float(search="_search_difference_qty_usability")
def _search_difference_qty_usability(self, operator, value):
# Inspired by the method _search_difference_qty() from the
# official stock module
# So a part of this code is copyright Odoo SA under LGPL licence
if not self.env.context.get('default_inventory_id'):
raise NotImplementedError(_('Unsupported search on %s outside of an Inventory Adjustment', 'difference_qty'))
lines = self.search([('inventory_id', '=', self.env.context.get('default_inventory_id'))])
line_ids = []
for line in lines:
if operator == '=':
if float_is_zero(line.difference_qty, line.product_id.uom_id.rounding):
line_ids.append(line.id)
elif operator == '!=':
if not float_is_zero(line.difference_qty, line.product_id.uom_id.rounding):
line_ids.append(line.id)
elif operator == '>':
if float_compare(line.difference_qty, 0, line.product_id.uom_id.rounding) > 0:
line_ids.append(line.id)
elif operator == '<':
if float_compare(line.difference_qty, 0, line.product_id.uom_id.rounding) < 0:
line_ids.append(line.id)
else:
raise NotImplementedError()
return [('id', 'in', line_ids)]

View File

@@ -1,11 +1,11 @@
# Copyright 2014-2020 Akretion (http://www.akretion.com)
# Copyright 2014-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class StockLocationRoute(models.Model):
_inherit = 'stock.location.route'
class StockRoute(models.Model):
_inherit = 'stock.route'
name = fields.Char(translate=False)

View File

@@ -1,9 +1,8 @@
# Copyright 2014-2020 Akretion (http://www.akretion.com)
# Copyright 2014-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models, _
from odoo.exceptions import UserError
import logging
logger = logging.getLogger(__name__)
@@ -13,26 +12,8 @@ class StockMove(models.Model):
_inherit = 'stock.move'
# for optional display in tree view
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
# def name_get(self):
# '''name_get of stock_move is important for the reservation of the
# quants: so want to add the name of the customer and the expected date
# in it'''
# res = []
# for line in self:
# name = '%s > %s' % (
# line.location_id.name, line.location_dest_id.name)
# if line.product_id.code:
# name = '%s: %s' % (line.product_id.code, name)
# if line.picking_id.origin:
# name = '%s %s' % (line.picking_id.origin, name)
# if line.partner_id:
# name = '%s %s' % (line.partner_id.name, name)
# if line.date_expected:
# name = '%s %s' % (name, line.date_expected)
# res.append((line.id, name))
# return res
product_barcode = fields.Char(
related='product_id.barcode', string="Product Barcode")
def button_do_unreserve(self):
for move in self:
@@ -47,30 +28,3 @@ class StockMove(models.Model):
move.product_qty, product.uom_id.name))
# Copied from do_unreserved of stock.picking
picking.package_level_ids.filtered(lambda p: not p.move_ids).unlink()
class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
# for optional display in tree view
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
# TODO: I think it's not complete
def button_do_unreserve(self):
for moveline in self:
if moveline.state == 'cancel':
continue
elif moveline.state == 'done':
raise UserError(_(
"You cannot unreserve a move line in done state."))
picking = moveline.move_id.picking_id
if picking:
product = moveline.product_id
picking.message_post(body=_(
"Product <a href=# data-oe-model=product.product "
"data-oe-id=%d>%s</a> qty %s %s <b>unreserved</b>")
% (product.id, product.display_name,
moveline.product_qty, product.uom_id.name))
# Copied from do_unreserved of stock.picking
picking.package_level_ids.filtered(lambda p: not p.move_ids).unlink()
moveline.unlink()

View File

@@ -0,0 +1,37 @@
# Copyright 2014-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models, _
from odoo.exceptions import UserError
import logging
logger = logging.getLogger(__name__)
class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
# for optional display in tree view
product_barcode = fields.Char(
related='product_id.barcode', string="Product Barcode")
# TODO: I think it's not complete
def button_do_unreserve(self):
for moveline in self:
if moveline.state == 'cancel':
continue
elif moveline.state == 'done':
raise UserError(_(
"You cannot unreserve a move line in done state."))
picking = moveline.move_id.picking_id
if picking:
product = moveline.product_id
picking.message_post(body=_(
"Product <a href=# data-oe-model=product.product "
"data-oe-id=%d>%s</a> qty %s %s <b>unreserved</b>")
% (product.id, product.display_name,
moveline.reserved_qty, product.uom_id.name))
# Copied from do_unreserved of stock.picking
picking.package_level_ids.filtered(lambda p: not p.move_ids).unlink()
moveline.unlink()

View File

@@ -1,4 +1,4 @@
# Copyright 2014-2020 Akretion (http://www.akretion.com)
# Copyright 2014-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,4 +1,4 @@
# Copyright 2014-2020 Akretion (http://www.akretion.com)
# Copyright 2014-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,8 +1,8 @@
# Copyright 2015-2020 Akretion (http://www.akretion.com)
# Copyright 2015-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
from odoo import models
import logging
logger = logging.getLogger(__name__)
@@ -11,9 +11,8 @@ logger = logging.getLogger(__name__)
class StockWarehouseOrderpoint(models.Model):
_inherit = 'stock.warehouse.orderpoint'
@api.model
def _procure_orderpoint_confirm(
self, use_new_cursor=False, company_id=False, raise_user_error=True):
self, use_new_cursor=False, company_id=None, raise_user_error=True):
logger.info(
'procurement scheduler: START to create moves from '
'orderpoints')
@@ -24,27 +23,3 @@ class StockWarehouseOrderpoint(models.Model):
'procurement scheduler: END creation of moves from '
'orderpoints')
return res
# This is for the button shortcut "reordering rules" on
# stock.location form view, so that the location_id has the
# good value, not the default stock location of the first WH of the company
@api.model
def default_get(self, fields_list):
if self._context.get('default_location_id'):
location = self.env['stock.location'].browse(
self._context['default_location_id'])
wh = location.get_warehouse()
if location and wh:
self = self.with_context(default_warehouse_id=wh.id)
return super().default_get(fields_list)
# This SQL constraint blocks the use of the "active" field
# but I think it's not very useful to have such an "active" field
# on orderpoints ; when you think the order point is bad, you update
# the min/max values, you don't de-active it !
_sql_constraints = [(
'company_wh_location_product_unique',
'unique(company_id, warehouse_id, location_id, product_id)',
'An orderpoint already exists for the same company, same warehouse, '
'same stock location and same product.'
)]

View File

@@ -1,4 +1,4 @@
# Copyright 2021 Akretion France (http://www.akretion.com/)
# Copyright 2021-2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -9,7 +9,6 @@ logger = logging.getLogger(__name__)
def create_config_parameter_immediate_tranfer(cr, registry):
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
ico = env["ir.config_parameter"]
conf_param = ico.search([('key', '=', 'stock.no_default_immediate_tranfer')])

View File

@@ -3,4 +3,3 @@ access_procurement_scheduler_log_full,Full access on procurement.scheduler.log t
access_procurement_scheduler_log_user,Read/Create procurement.scheduler.log to Stock user,model_procurement_scheduler_log,stock.group_stock_user,1,0,1,0
access_procurement_scheduler_log_read,Read access on procurement.scheduler.log to Employee,model_procurement_scheduler_log,base.group_user,1,0,0,0
access_stock_warehouse_orderpoint_employee,Read access on stock.warehouse.orderpoint to employee (needed to open product form view with employee-only group),stock.model_stock_warehouse_orderpoint,base.group_user,1,0,0,0
stock.access_stock_inventory_line_user,stock.inventory.line user,stock.model_stock_inventory_line,stock.group_stock_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 access_procurement_scheduler_log_user Read/Create procurement.scheduler.log to Stock user model_procurement_scheduler_log stock.group_stock_user 1 0 1 0
4 access_procurement_scheduler_log_read Read access on procurement.scheduler.log to Employee model_procurement_scheduler_log base.group_user 1 0 0 0
5 access_stock_warehouse_orderpoint_employee Read access on stock.warehouse.orderpoint to employee (needed to open product form view with employee-only group) stock.model_stock_warehouse_orderpoint base.group_user 1 0 0 0
stock.access_stock_inventory_line_user stock.inventory.line user stock.model_stock_inventory_line stock.group_stock_user 1 1 1 1

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015-2020 Akretion (http://www.akretion.com/)
Copyright 2015-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

View File

@@ -28,6 +28,6 @@
<menuitem id="procurement_scheduler_log_menu"
action="procurement_scheduler_log_action"
parent="stock.menu_stock_warehouse_mgmt" sequence="140"/>
parent="stock.menu_warehouse_report" sequence="300"/>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 Akretion (http://www.akretion.com/)
Copyright 2021-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

View File

@@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2020 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@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">usability.stock.inventory.form</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock.view_inventory_form"/>
<field name="arch" type="xml">
<button name="action_open_inventory_lines" states="confirm" position="after">
<button name="action_open_inventory_lines" states="done" string="Show Inventory Lines" type="object"/>
</button>
<field name="prefill_counted_quantity" position="attributes">
<attribute name="attrs">{}</attribute>
</field>
</field>
</record>
<record id="stock_inventory_line_tree" model="ir.ui.view">
<field name="name">usability.stock.inventory.line.tree</field>
<field name="model">stock.inventory.line</field>
<field name="inherit_id" ref="stock.stock_inventory_line_tree"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_barcode" optional="hide"/>
</field>
<tree position="attributes">
<!-- native :
decoration-danger="product_qty != theoretical_qty"
decoration-muted="product_qty == theoretical_qty"
decoration-bf="is_editable"
-->
<attribute name="decoration-info">product_qty &gt; theoretical_qty</attribute>
<attribute name="decoration-danger">product_qty &lt; theoretical_qty</attribute>
</tree>
<field name="location_id" position="attributes">
<attribute name="invisible">0</attribute>
</field>
</field>
</record>
<record id="stock_inventory_line_search" model="ir.ui.view">
<field name="name">usability.stock.inventory.line.search</field>
<field name="model">stock.inventory.line</field>
<field name="inherit_id" ref="stock.stock_inventory_line_search"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="categ_id"/>
</field>
<filter name="difference" position="after">
<filter string="Difference = 0"
name="counted_equal" domain="[('difference_qty', '=', 0)]"/>
<filter string="Counted lower than Theoretical"
name="counted_lower" domain="[('difference_qty', '&lt;', 0)]"/>
<filter string="Counted higher than Theoretical"
name="counted_higher" domain="[('difference_qty', '&gt;', 0)]"/>
<separator/>
<filter string="Counted" name="counted" domain="[('product_qty', '>', 0)]"/>
</filter>
</field>
</record>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2020 Akretion (http://www.akretion.com/)
Copyright 2014-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -52,6 +52,6 @@ should be able to access it. So I add a menu entry under Inventory Control. -->
<menuitem id="stock_location_menu" action="stock.action_location_form"
parent="stock.menu_warehouse_report"
groups="stock.group_stock_multi_locations"
sequence="50"/>
sequence="160"/>
</odoo>

View File

@@ -22,7 +22,7 @@
</record>
<record id="view_production_lot_form" model="ir.ui.view">
<field name="model">stock.production.lot</field>
<field name="model">stock.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form"/>
<field name="arch" type="xml">
<button name="action_lot_open_quants" position="after">

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2020 Akretion (http://www.akretion.com/)
Copyright 2014-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -22,7 +22,6 @@
</field> -->
<field name="origin" position="after">
<field name="picking_id" readonly="1" string="Picking"/>
<field name="inventory_id" readonly="1"/>
</field>
<group name="origin_grp" position="after">
<group name="advanced" string="Advanced" groups="stock.group_stock_manager">
@@ -38,20 +37,11 @@
</field>
</record>
<!-- By default, stock.move have:
_order = 'sequence, id'
I don't know if they have a good reason to choose this order,
but, when you open tree view of move lines from product, you want
the most recent moves at the top, so we change the default
order in the tree view (lower impact than changing _order -->
<record id="view_move_tree" model="ir.ui.view">
<field name="name">stock_usability.move.tree.better.order</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_tree" />
<field name="arch" type="xml">
<tree position="attributes">
<attribute name="default_order">date desc, picking_id, sequence</attribute>
</tree>
<field name="state" position="after">
<button type="object" name="button_do_unreserve" string="Unreserve"
groups="stock.group_stock_user"
@@ -64,64 +54,4 @@
</field>
</record>
<record id="stock.stock_move_action" model="ir.actions.act_window">
<!-- Remove from context 'search_default_groupby_location_id': 1 -->
<field name="context">{'search_default_done': 1}</field>
</record>
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">stock_usability.stock.move.line.tree</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_tree" />
<field name="arch" type="xml">
<field name="qty_done" position="before">
<field name="product_qty" sum="1" string="Reserved Qty"/>
</field>
<field name="qty_done" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="state" position="after">
<button type="object" name="button_do_unreserve" string="Unreserve"
groups="stock.group_stock_user"
states="partially_available,assigned"
icon="fa-ban"/>
</field>
<field name="product_id" position="after">
<field name="product_barcode" optional="hide"/>
</field>
</field>
</record>
<!-- View embedded in picking -->
<record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_barcode" optional="hide"/>
</field>
<field name="qty_done" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="product_uom_qty" position="attributes">
<attribute name="sum">1</attribute>
</field>
</field>
</record>
<record id="stock_move_line_view_search" model="ir.ui.view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.stock_move_line_view_search"/>
<field name="arch" type="xml">
<field name="location_dest_id" position="after">
<field name="lot_id"/>
</field>
</field>
</record>
<record id="stock.stock_move_line_action" model="ir.actions.act_window">
<!-- remove from context 'search_default_groupby_product_id': 1 -->
<field name="context">{'search_default_done': 1, 'create': 0}</field>
</record>
</odoo>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">stock_usability.stock.move.line.tree</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_tree" />
<field name="arch" type="xml">
<field name="qty_done" position="before">
<field name="reserved_uom_qty" sum="1"/>
</field>
<field name="qty_done" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="state" position="after">
<button type="object" name="button_do_unreserve" string="Unreserve"
groups="stock.group_stock_user"
states="partially_available,assigned"
icon="fa-ban"/>
</field>
<field name="product_id" position="after">
<field name="product_barcode" optional="hide"/>
</field>
</field>
</record>
<!-- View embedded in picking -->
<record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_barcode" optional="hide"/>
</field>
<field name="qty_done" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="reserved_uom_qty" position="attributes">
<attribute name="sum">1</attribute>
</field>
</field>
</record>
</odoo>

View File

@@ -50,26 +50,15 @@
<field name="location_id" groups="stock.group_stock_multi_locations" domain="[('id', 'child_of', 'parent.location_id')]" options="{'no_create': True}"/>
<field name="location_dest_id" groups="stock.group_stock_multi_locations" domain="[('id', 'child_of', 'parent.location_dest_id')]" options="{'no_create': True}"/>
</xpath>
<xpath expr="//sheet/group/group/field[@name='location_id']" position="attributes">
<xpath expr="//sheet/group/group/field[@name='location_id' and @groups='stock.group_stock_multi_locations']" position="attributes">
<attribute name="attrs">{}</attribute>
</xpath>
<xpath expr="//sheet/group/group/field[@name='location_dest_id']" position="attributes">
<xpath expr="//sheet/group/group/field[@name='location_dest_id' and @groups='stock.group_stock_multi_locations']" position="attributes">
<attribute name="attrs">{}</attribute>
</xpath>
</field>
</record>
<record id="vpicktree" model="ir.ui.view">
<field name="name">stock_usability.view_picking_tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree" />
<field name="arch" type="xml">
<field name="date_deadline" position="after">
<field name="date_done" optional="show"/>
</field>
</field>
</record>
<record id="view_picking_internal_search" model="ir.ui.view">
<field name="name">stock_usability.view_picking_search</field>
<field name="model">stock.picking</field>
@@ -124,17 +113,4 @@
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record>
<record id="view_picking_type_tree" model="ir.ui.view">
<field name="name">usability.stock.picking.type.tree</field>
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_picking_type_tree"/>
<field name="arch" type="xml">
<field name="warehouse_id" position="after">
<field name="default_location_src_id"/>
<field name="default_location_dest_id"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_picking_type_tree" model="ir.ui.view">
<field name="name">usability.stock.picking.type.tree</field>
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_picking_type_tree"/>
<field name="arch" type="xml">
<field name="warehouse_id" position="after">
<field name="default_location_src_id"/>
<field name="default_location_dest_id"/>
</field>
</field>
</record>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2020 Akretion (http://www.akretion.com/)
Copyright 2014-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -31,27 +31,40 @@
</field>
</record>
<record id="view_stock_quant_tree_editable" model="ir.ui.view">
<!-- view used from product form -->
<record id="view_stock_quant_tree_inventory_editable" model="ir.ui.view">
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_tree_editable"/>
<field name="inherit_id" ref="stock.view_stock_quant_tree_inventory_editable"/>
<field name="arch" type="xml">
<field name="available_quantity" position="before">
<field name="quantity" position="after">
<field name="reserved_quantity" sum="1" optional="show"/>
<button type="object" name="action_stock_move_lines_reserved" string="Reservations" attrs="{'invisible': [('reserved_quantity', '=', 0)]}"/>
<field name="available_quantity" position="move"/>
</field>
<field name="quantity" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="inventory_quantity" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="available_quantity" position="attributes">
<attribute name="sum">1</attribute>
<attribute name="optional">show</attribute>
</field>
</field>
</record>
<!--
<record id="view_stock_quant_tree_editable" model="ir.ui.view">
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_tree_editable"/>
<field name="arch" type="xml">
<field name="reserved_quantity" position="after">
<button type="object" name="action_stock_move_lines_reserved" string="Reservations" attrs="{'invisible': [('reserved_quantity', '=', 0)]}"/>
<field name="available_quantity" sum="1" optional="show"/>
</field>
</field>
</record>
-->
<!-- mig to v16 ?
<record id="view_stock_quant_form" model="ir.ui.view">
<field name="name">stock.usability.quant.form</field>
<field name="model">stock.quant</field>
@@ -69,6 +82,7 @@
</xpath>
</field>
</record>
-->
<!-- more detailed stock.move tree view when using the button from product form -->
<!-- TODO TEST
@@ -76,18 +90,10 @@
<field name="view_id" ref="stock.view_move_tree"/>
</record> -->
<!-- The native menu entry of quants is called "Inventory Valuation"
but it forces a group by on products that you can't remove
So I create another "regular" Quants" menu entry -->
<record id="stock_quant_action" model="ir.actions.act_window">
<!-- Rename menu entry Locations -> Quants -->
<record id="stock.menu_valuation" model="ir.ui.menu">
<field name="name">Quants</field>
<field name="res_model">stock.quant</field>
<field name="view_mode">tree,form,pivot</field>
<field name="context">{'search_default_internal_loc': 1}</field>
</record>
<menuitem id="stock_quant_menu" action="stock_quant_action"
parent="stock.menu_warehouse_report"
sequence="160"/>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2020 Akretion (http://www.akretion.com/)
Copyright 2014-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2020 Akretion (http://www.akretion.com/)
Copyright 2014-2022 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -28,16 +28,5 @@
</field>
</record>
<record id="view_warehouse_orderpoint_tree_editable_config" model="ir.ui.view">
<field name="model">stock.warehouse.orderpoint</field>
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable_config" />
<field name="arch" type="xml">
<field name="trigger" position="attributes">
<attribute name="optional">show</attribute>
</field>
</field>
</record>
</odoo>