[MIG] stock_usability to v14
This commit is contained in:
@@ -1,7 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import stock
|
||||
from . import procurement
|
||||
from . import product
|
||||
from . import partner
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Copyright 2014-2019 Akretion (http://www.akretion.com)
|
||||
# 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).
|
||||
|
||||
|
||||
{
|
||||
'name': 'Stock Usability',
|
||||
'version': '12.0.1.0.0',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Inventory, Logistic, Storage',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Several usability enhancements in Warehouse management',
|
||||
@@ -19,7 +19,6 @@ The usability enhancements include:
|
||||
* add a group by Partner in the picking search view (particularly usefull for receptions)
|
||||
* add graph view for pickings
|
||||
* remove ability to translate stock.location, stock.location.route and stock.picking.type
|
||||
* unactive view "stock.view_production_lot_form_simple" because it doesn't include smart buttons Locate and Traceability Report ; then we only use the main view "stock.view_production_lot_form" like in previous odoo versions
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
@@ -27,10 +26,15 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['stock'],
|
||||
'data': [
|
||||
'stock_view.xml',
|
||||
'procurement_view.xml',
|
||||
'wizard/stock_quantity_history_view.xml',
|
||||
'views/stock_quant.xml',
|
||||
'views/stock_inventory.xml',
|
||||
'views/stock_location.xml',
|
||||
'views/stock_move.xml',
|
||||
'views/stock_picking.xml',
|
||||
'views/stock_warehouse.xml',
|
||||
'views/procurement_group.xml',
|
||||
'views/procurement_scheduler_log.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
9
stock_usability/models/__init__.py
Normal file
9
stock_usability/models/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from . import stock_move
|
||||
from . import stock_picking
|
||||
from . import stock_location_route
|
||||
from . import stock_warehouse_orderpoint
|
||||
from . import stock_quant
|
||||
from . import procurement_group
|
||||
from . import procurement_scheduler_log
|
||||
from . import product_template
|
||||
from . import res_partner
|
||||
@@ -1,8 +1,8 @@
|
||||
# Copyright 2015-2019 Akretion (http://www.akretion.com)
|
||||
# Copyright 2015-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).
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo import api, fields, models
|
||||
from datetime import datetime
|
||||
import logging
|
||||
|
||||
@@ -12,29 +12,18 @@ logger = logging.getLogger(__name__)
|
||||
class ProcurementGroup(models.Model):
|
||||
_inherit = 'procurement.group'
|
||||
|
||||
@api.model
|
||||
def _procure_orderpoint_confirm(
|
||||
self, use_new_cursor=False, company_id=False):
|
||||
logger.info(
|
||||
'procurement scheduler: START to create moves from '
|
||||
'orderpoints')
|
||||
res = super(ProcurementGroup, self)._procure_orderpoint_confirm(
|
||||
use_new_cursor=use_new_cursor, company_id=company_id)
|
||||
logger.info(
|
||||
'procurement scheduler: END creation of moves from '
|
||||
'orderpoints')
|
||||
return res
|
||||
picking_ids = fields.One2many(
|
||||
'stock.picking', 'group_id', string='Pickings', readonly=True)
|
||||
|
||||
@api.model
|
||||
def run_scheduler(
|
||||
self, use_new_cursor=False, company_id=False):
|
||||
def run_scheduler(self, use_new_cursor=False, company_id=False):
|
||||
'''Inherit to add info logs'''
|
||||
logger.info(
|
||||
'START procurement scheduler '
|
||||
'(company ID=%d, uid=%d, use_new_cursor=%s)',
|
||||
company_id, self._uid, use_new_cursor)
|
||||
start_datetime = datetime.now()
|
||||
res = super(ProcurementGroup, self).run_scheduler(
|
||||
res = super().run_scheduler(
|
||||
use_new_cursor=use_new_cursor, company_id=company_id)
|
||||
logger.info(
|
||||
'END procurement scheduler '
|
||||
@@ -55,13 +44,3 @@ class ProcurementGroup(models.Model):
|
||||
logger.warning(
|
||||
'Could not create procurement.scheduler.log (error: %s)', e)
|
||||
return res
|
||||
|
||||
|
||||
class ProcurementSchedulerLog(models.Model):
|
||||
_name = 'procurement.scheduler.log'
|
||||
_description = 'Logs of the Procurement Scheduler'
|
||||
_order = 'create_date desc'
|
||||
|
||||
company_id = fields.Many2one(
|
||||
'res.company', string='Company', readonly=True)
|
||||
start_datetime = fields.Datetime(string='Start Date', readonly=True)
|
||||
15
stock_usability/models/procurement_scheduler_log.py
Normal file
15
stock_usability/models/procurement_scheduler_log.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# Copyright 2015-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).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProcurementSchedulerLog(models.Model):
|
||||
_name = 'procurement.scheduler.log'
|
||||
_description = 'Logs of the Procurement Scheduler'
|
||||
_order = 'create_date desc'
|
||||
|
||||
company_id = fields.Many2one(
|
||||
'res.company', string='Company', readonly=True)
|
||||
start_datetime = fields.Datetime(string='Start Date', readonly=True)
|
||||
12
stock_usability/models/product_template.py
Normal file
12
stock_usability/models/product_template.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright 2016-2020 Akretion France
|
||||
# @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 ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
tracking = fields.Selection(tracking=True)
|
||||
sale_delay = fields.Float(tracking=True)
|
||||
@@ -1,11 +1,11 @@
|
||||
# Copyright 2017-2019 Akretion France (https://akretion.com/)
|
||||
# Copyright 2017-2020 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).
|
||||
|
||||
from odoo import models, fields
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
picking_warn = fields.Selection(track_visibility='onchange')
|
||||
picking_warn = fields.Selection(tracking=True)
|
||||
11
stock_usability/models/stock_location_route.py
Normal file
11
stock_usability/models/stock_location_route.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# 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).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class StockLocationRoute(models.Model):
|
||||
_inherit = 'stock.location.route'
|
||||
|
||||
name = fields.Char(translate=False)
|
||||
70
stock_usability/models/stock_move.py
Normal file
70
stock_usability/models/stock_move.py
Normal file
@@ -0,0 +1,70 @@
|
||||
# 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).
|
||||
|
||||
from odoo import models, _
|
||||
from odoo.exceptions import UserError
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
# 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
|
||||
|
||||
def button_do_unreserve(self):
|
||||
for move in self:
|
||||
move._do_unreserve()
|
||||
picking = move.picking_id
|
||||
if picking:
|
||||
product = move.product_id
|
||||
picking.message_post(_(
|
||||
"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,
|
||||
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'
|
||||
|
||||
# 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(_(
|
||||
"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()
|
||||
32
stock_usability/models/stock_picking.py
Normal file
32
stock_usability/models/stock_picking.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# 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).
|
||||
|
||||
from odoo import fields, models, _
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
# _order = 'id desc'
|
||||
# In the stock module: _order = "priority desc, scheduled_date asc, id desc"
|
||||
# The problem is date asc
|
||||
|
||||
partner_id = fields.Many2one(tracking=True)
|
||||
picking_type_id = fields.Many2one(tracking=True)
|
||||
move_type = fields.Selection(tracking=True)
|
||||
is_locked = fields.Boolean(tracking=True)
|
||||
|
||||
def do_unreserve(self):
|
||||
res = super().do_unreserve()
|
||||
for pick in self:
|
||||
pick.message_post(body=_("Picking <b>unreserved</b>."))
|
||||
return res
|
||||
|
||||
|
||||
class StockPickingType(models.Model):
|
||||
_inherit = 'stock.picking.type'
|
||||
|
||||
name = fields.Char(translate=False)
|
||||
15
stock_usability/models/stock_quant.py
Normal file
15
stock_usability/models/stock_quant.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# 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).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockQuant(models.Model):
|
||||
_inherit = 'stock.quant'
|
||||
|
||||
def action_stock_move_lines_reserved(self):
|
||||
self.ensure_one()
|
||||
action = self.action_view_stock_moves()
|
||||
action['context'] = {'search_default_todo': True}
|
||||
return action
|
||||
50
stock_usability/models/stock_warehouse_orderpoint.py
Normal file
50
stock_usability/models/stock_warehouse_orderpoint.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# Copyright 2015-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).
|
||||
|
||||
from odoo import api, models
|
||||
import logging
|
||||
|
||||
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):
|
||||
logger.info(
|
||||
'procurement scheduler: START to create moves from '
|
||||
'orderpoints')
|
||||
res = super()._procure_orderpoint_confirm(
|
||||
use_new_cursor=use_new_cursor, company_id=company_id,
|
||||
raise_user_error=raise_user_error)
|
||||
logger.info(
|
||||
'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.'
|
||||
)]
|
||||
@@ -1,12 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
tracking = fields.Selection(track_visibility='onchange')
|
||||
sale_delay = fields.Float(track_visibility='onchange')
|
||||
@@ -1,147 +0,0 @@
|
||||
# Copyright 2014-2019 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 models, fields, api, _
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
_order = 'id desc'
|
||||
# In the stock module: _order = "priority desc, date asc, id desc"
|
||||
# The problem is date asc
|
||||
|
||||
partner_id = fields.Many2one(track_visibility='onchange')
|
||||
picking_type_id = fields.Many2one(track_visibility='onchange')
|
||||
move_type = fields.Selection(track_visibility='onchange')
|
||||
# Can be used in view to hide some fields depending of pick type
|
||||
picking_type_code = fields.Selection(related='picking_type_id.code')
|
||||
is_locked = fields.Boolean(track_visibility='onchange')
|
||||
|
||||
@api.multi
|
||||
def do_unreserve(self):
|
||||
res = super(StockPicking, self).do_unreserve()
|
||||
for pick in self:
|
||||
pick.message_post(body=_("Picking <b>unreserved</b>."))
|
||||
return res
|
||||
|
||||
|
||||
class StockPickingType(models.Model):
|
||||
_inherit = 'stock.picking.type'
|
||||
|
||||
name = fields.Char(translate=False)
|
||||
|
||||
|
||||
class StockLocationRoute(models.Model):
|
||||
_inherit = 'stock.location.route'
|
||||
|
||||
name = fields.Char(translate=False)
|
||||
|
||||
|
||||
class StockWarehouseOrderpoint(models.Model):
|
||||
_inherit = 'stock.warehouse.orderpoint'
|
||||
|
||||
# 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):
|
||||
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(StockWarehouseOrderpoint, self).default_get(fields)
|
||||
|
||||
# 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.'
|
||||
)]
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
@api.multi
|
||||
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
|
||||
|
||||
def button_do_unreserve(self):
|
||||
for move in self:
|
||||
move._do_unreserve()
|
||||
picking = move.picking_id
|
||||
if picking:
|
||||
product = move.product_id
|
||||
picking.message_post(_(
|
||||
"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,
|
||||
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'
|
||||
|
||||
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(_(
|
||||
"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()
|
||||
|
||||
|
||||
class ProcurementGroup(models.Model):
|
||||
_inherit = 'procurement.group'
|
||||
|
||||
picking_ids = fields.One2many(
|
||||
'stock.picking', 'group_id', string='Pickings', readonly=True)
|
||||
|
||||
|
||||
class StockQuant(models.Model):
|
||||
_inherit = 'stock.quant'
|
||||
|
||||
def action_stock_move_lines_reserved(self):
|
||||
self.ensure_one()
|
||||
action = self.action_view_stock_moves()
|
||||
action['context'] = {'search_default_todo': True}
|
||||
return action
|
||||
@@ -1,429 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2014-2019 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_form" model="ir.ui.view">
|
||||
<field name="name">stock_usability.view_picking_form</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="backorder_id" position="attributes">
|
||||
<attribute name="attrs">{}</attribute>
|
||||
</field>
|
||||
<field name="partner_id" position="attributes">
|
||||
<attribute name="context">{'show_address': 1}</attribute>
|
||||
<attribute name="options">{'always_reload': True}</attribute>
|
||||
</field>
|
||||
<button name="action_cancel" type="object" position="attributes">
|
||||
<attribute name="confirm">Are you sure you want to cancel this picking?</attribute>
|
||||
</button>
|
||||
<!-- STOCK MOVE -->
|
||||
<!-- This sum is useful to check the 'number of items' to transfer... -->
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_uom_qty']" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='location_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='location_dest_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after">
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_dest_id" groups="stock.group_stock_multi_locations"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/button[@name='action_show_details']" position="after">
|
||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||
groups="stock.group_stock_user"
|
||||
states="partially_available,assigned"
|
||||
icon="fa-ban"/>
|
||||
</xpath>
|
||||
<!-- STOCK MOVE LINE -->
|
||||
<xpath expr="//field[@name='move_line_ids_without_package']/tree/field[@name='location_id']" position="attributes">
|
||||
<attribute name="attrs">{}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='move_line_ids_without_package']/tree/field[@name='location_dest_id']" 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="scheduled_date" position="after">
|
||||
<field name="date_done"/>
|
||||
</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>
|
||||
<field name="inherit_id" ref="stock.view_picking_internal_search" />
|
||||
<field name="arch" type="xml">
|
||||
<filter name="picking_type" position="after">
|
||||
<filter string="Partner" name="partner_groupby" context="{'group_by': 'partner_id'}"/>
|
||||
</filter>
|
||||
<filter name="origin" position="replace"/>
|
||||
<filter name="expected_date" position="after">
|
||||
<filter name="date_done_groupby" string="Date Done"
|
||||
context="{'group_by': 'date_done:day'}"/>
|
||||
</filter>
|
||||
<filter name="expected_date" position="attributes">
|
||||
<!-- group per day -->
|
||||
<attribute name="context">"{'group_by': 'scheduled_date:day'}"</attribute>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_picking_pivot" model="ir.ui.view">
|
||||
<field name="name">stock_usability.picking_pivot</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Transfers">
|
||||
<field name="date_done" type="row" interval="month"/>
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_all" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.stock_picking_action_picking_type" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_done" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_ready" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_done_grouped" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_waiting" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_late" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_backorder" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree" model="ir.actions.act_window">
|
||||
<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>
|
||||
|
||||
<!-- Display advanced fields in stock moves form view -->
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="name">stock.usability.stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<!--
|
||||
<field name="state" position="before">
|
||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||
groups="stock.group_stock_user"
|
||||
attrs="{'invisible': [('reserved_quant_ids', '=', [])]}"/>
|
||||
</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">
|
||||
<field name="warehouse_id" readonly="1"/>
|
||||
<field name="route_ids" widget="many2many_tags" readonly="1"/>
|
||||
<field name="rule_id" readonly="1"/>
|
||||
<field name="propagate" readonly="1"/>
|
||||
<field name="price_unit" readonly="1"/>
|
||||
<field name="partner_id" readonly="1"/>
|
||||
<field name="restrict_partner_id" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_move_picking_form" model="ir.ui.view">
|
||||
<field name="name">stock.usability.stock.move.picking.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_picking_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="state" position="before">
|
||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||
groups="stock.group_stock_user"
|
||||
states="partially_available,assigned"/>
|
||||
</field>
|
||||
<field name="group_id" position="replace"/>
|
||||
<group name="quants_grp" position="after">
|
||||
<group string="Advanced" name="advanced" groups="stock.group_stock_manager">
|
||||
<field name="origin" readonly="1"/>
|
||||
<field name="warehouse_id" readonly="1"/>
|
||||
<field name="group_id" readonly="1"/>
|
||||
<field name="route_ids" widget="many2many_tags" readonly="1"/>
|
||||
<field name="rule_id" readonly="1"/>
|
||||
<field name="propagate" readonly="1"/>
|
||||
<field name="price_unit" readonly="1"/>
|
||||
<field name="partner_id" readonly="1"/>
|
||||
<field name="restrict_partner_id" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
<record id="view_move_picking_tree" model="ir.ui.view">
|
||||
<field name="name">stock_usability.src_location.in.picking.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_picking_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="location_id" position="attributes">
|
||||
<attribute name="invisible">0</attribute>
|
||||
</field>
|
||||
<field name="location_dest_id" position="attributes">
|
||||
<attribute name="invisible">0</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>
|
||||
</record>
|
||||
-->
|
||||
|
||||
|
||||
<!-- By default, stock.move have:
|
||||
_order = 'picking_id, 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"
|
||||
states="partially_available,assigned"
|
||||
icon="fa-ban"/>
|
||||
</field>
|
||||
</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>
|
||||
</record>
|
||||
|
||||
<record id="stock.stock_move_line_action" model="ir.actions.act_window">
|
||||
<field name="context">{'search_default_done': 1}</field>
|
||||
</record>
|
||||
|
||||
<record id="view_warehouse" model="ir.ui.view">
|
||||
<field name="name">stock.usability.warehouse.form</field>
|
||||
<field name="model">stock.warehouse</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='out_type_id']/.." position="after">
|
||||
<group name="routes" string="Routes">
|
||||
<field name="route_ids" widget="many2many_tags"/>
|
||||
<field name="crossdock_route_id"/>
|
||||
<field name="reception_route_id"/>
|
||||
<field name="delivery_route_id"/>
|
||||
<field name="resupply_route_ids"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<field name="wh_input_stock_loc_id" position="before">
|
||||
<field name="lot_stock_id" readonly="1" required="0"/>
|
||||
<field name="view_location_id" groups="base.group_no_one"
|
||||
readonly="1" required="0"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_location_search" model="ir.ui.view">
|
||||
<field name="name">stock.usability.stock.location.search</field>
|
||||
<field name="model">stock.location</field>
|
||||
<field name="inherit_id" ref="stock.view_location_search" />
|
||||
<field name="arch" type="xml">
|
||||
<filter name="inactive" position="after">
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="usage_groupby" string="Location Type"
|
||||
context="{'group_by': 'usage'}"/>
|
||||
<filter name="removal_strategy_groupby" string="Removal Strategy"
|
||||
context="{'group_by': 'removal_strategy_id'}"/>
|
||||
<filter name="putaway_strategy_groupby" string="Put Away Strategy"
|
||||
context="{'group_by': 'putaway_strategy_id'}"/>
|
||||
</group>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="location_open_orderpoint" model="ir.actions.act_window">
|
||||
<field name="name">Reordering Rules</field>
|
||||
<field name="res_model">stock.warehouse.orderpoint</field>
|
||||
<field name="context">{'default_location_id': active_id, 'search_default_location_id': active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="view_location_form" model="ir.ui.view">
|
||||
<field name="name">stock.usability.stock.location.form</field>
|
||||
<field name="model">stock.location</field>
|
||||
<field name="inherit_id" ref="stock.view_location_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button class="oe_stat_button" icon="fa-filter" position="after">
|
||||
<button type="action" name="%(location_open_orderpoint)d"
|
||||
string="Reordering Rules"
|
||||
class="oe_stat_button" icon="fa-refresh"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- By default, the menu entry for stock location is only under
|
||||
Configuration > Warehouse management
|
||||
But, the view of stock location is very useful to be able to list
|
||||
of the items present on a particular stock location => so every user
|
||||
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_stock_inventory_control"
|
||||
groups="stock.group_stock_multi_locations"
|
||||
sequence="50"/>
|
||||
|
||||
|
||||
<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">
|
||||
<xpath expr="//field[@name='line_ids']/tree" position="attributes">
|
||||
<!-- native : decoration-info="product_qty != theoretical_qty" decoration-danger="theoretical_qty < 0" -->
|
||||
<attribute name="decoration-info">product_qty > theoretical_qty</attribute>
|
||||
<attribute name="decoration-warning">product_qty < theoretical_qty</attribute>
|
||||
</xpath>
|
||||
<button name="action_reset_product_qty" type="object" position="attributes">
|
||||
<attribute name="confirm">Are you sure you want to reset all quantities to 0 ?</attribute>
|
||||
</button>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_inventory_tree" model="ir.ui.view">
|
||||
<field name="name">usability.stock.inventory.tree</field>
|
||||
<field name="model">stock.inventory</field>
|
||||
<field name="inherit_id" ref="stock.view_inventory_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date" position="after">
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations"/>
|
||||
</field>
|
||||
<tree position="attributes">
|
||||
<attribute name="decoration-info">state == 'draft'</attribute>
|
||||
<attribute name="decoration-warning">state == 'confirm'</attribute>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_stock_quant_tree" model="ir.ui.view">
|
||||
<field name="name">stock.usability.quant.tree</field>
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quant_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="quantity" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</field>
|
||||
<field name="reserved_quantity" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_stock_quant_form" model="ir.ui.view">
|
||||
<field name="name">stock.usability.quant.form</field>
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quant_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" icon="fa-arrows-v" type="object" name="action_stock_move_lines_reserved" string="Reservations"/>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- more detailed stock.move tree view when using the button from product form -->
|
||||
<!-- TODO TEST
|
||||
<record id="stock.act_product_stock_move_open" model="ir.actions.act_window">
|
||||
<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">
|
||||
<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_stock_inventory_control"
|
||||
sequence="135"/>
|
||||
|
||||
<record id="stock.action_production_lot_form" model="ir.actions.act_window">
|
||||
<field name="context">{}</field> <!-- remove group by product -->
|
||||
</record>
|
||||
|
||||
<record id="stock.view_production_lot_form_simple" model="ir.ui.view">
|
||||
<!-- This view doesn't include smart buttons:
|
||||
- Locate
|
||||
- Traceability Report
|
||||
-->
|
||||
<field name="active" eval="0"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
21
stock_usability/views/procurement_group.xml
Normal file
21
stock_usability/views/procurement_group.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2015-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="procurement_group_form_view" model="ir.ui.view">
|
||||
<field name="name">stock_usability.procurement.group.form</field>
|
||||
<field name="model">procurement.group</field>
|
||||
<field name="inherit_id" ref="stock.procurement_group_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="move_type" position="after">
|
||||
<field name="partner_id" readonly="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -1,23 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2015-2019 Akretion (http://www.akretion.com/)
|
||||
Copyright 2015-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="procurement_group_form_view" model="ir.ui.view">
|
||||
<field name="name">stock_usability.procurement.group.form</field>
|
||||
<field name="model">procurement.group</field>
|
||||
<field name="inherit_id" ref="stock.procurement_group_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="move_type" position="after">
|
||||
<field name="partner_id" readonly="True"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="procurement_scheduler_log_tree" model="ir.ui.view">
|
||||
<field name="name">procurement_scheduler_log_tree</field>
|
||||
<field name="model">procurement.scheduler.log</field>
|
||||
@@ -39,6 +28,6 @@
|
||||
|
||||
<menuitem id="procurement_scheduler_log_menu"
|
||||
action="procurement_scheduler_log_action"
|
||||
parent="stock.menu_stock_inventory_control" sequence="50"/>
|
||||
parent="stock.menu_stock_warehouse_mgmt" sequence="140"/>
|
||||
|
||||
</odoo>
|
||||
39
stock_usability/views/stock_inventory.xml
Normal file
39
stock_usability/views/stock_inventory.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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="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">
|
||||
<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 > theoretical_qty</attribute>
|
||||
<attribute name="decoration-danger">product_qty < theoretical_qty</attribute>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_inventory_tree" model="ir.ui.view">
|
||||
<field name="name">usability.stock.inventory.tree</field>
|
||||
<field name="model">stock.inventory</field>
|
||||
<field name="inherit_id" ref="stock.view_inventory_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree position="attributes">
|
||||
<attribute name="decoration-info">state == 'draft'</attribute>
|
||||
<attribute name="decoration-warning">state == 'confirm'</attribute>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
57
stock_usability/views/stock_location.xml
Normal file
57
stock_usability/views/stock_location.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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_location_search" model="ir.ui.view">
|
||||
<field name="name">stock.usability.stock.location.search</field>
|
||||
<field name="model">stock.location</field>
|
||||
<field name="inherit_id" ref="stock.view_location_search" />
|
||||
<field name="arch" type="xml">
|
||||
<filter name="inactive" position="after">
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="usage_groupby" string="Location Type"
|
||||
context="{'group_by': 'usage'}"/>
|
||||
<filter name="removal_strategy_groupby" string="Removal Strategy"
|
||||
context="{'group_by': 'removal_strategy_id'}"/>
|
||||
</group>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="location_open_orderpoint" model="ir.actions.act_window">
|
||||
<field name="name">Reordering Rules</field>
|
||||
<field name="res_model">stock.warehouse.orderpoint</field>
|
||||
<field name="context">{'default_location_id': active_id, 'search_default_location_id': active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="view_location_form" model="ir.ui.view">
|
||||
<field name="name">stock.usability.stock.location.form</field>
|
||||
<field name="model">stock.location</field>
|
||||
<field name="inherit_id" ref="stock.view_location_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button type="action" name="%(location_open_orderpoint)d"
|
||||
string="Reordering Rules"
|
||||
class="oe_stat_button" icon="fa-refresh"/>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- By default, the menu entry for stock location is only under
|
||||
Configuration > Warehouse management
|
||||
But, the view of stock location is very useful to be able to list
|
||||
of the items present on a particular stock location => so every user
|
||||
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"/>
|
||||
|
||||
</odoo>
|
||||
84
stock_usability/views/stock_move.xml
Normal file
84
stock_usability/views/stock_move.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?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>
|
||||
|
||||
|
||||
<!-- Display advanced fields in stock moves form view -->
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="name">stock.usability.stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<!--
|
||||
<field name="state" position="before">
|
||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||
groups="stock.group_stock_user"
|
||||
attrs="{'invisible': [('reserved_quant_ids', '=', [])]}"/>
|
||||
</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">
|
||||
<field name="warehouse_id" readonly="1"/>
|
||||
<field name="route_ids" widget="many2many_tags" readonly="1"/>
|
||||
<field name="rule_id" readonly="1"/>
|
||||
<field name="propagate_cancel" readonly="1"/>
|
||||
<field name="price_unit" readonly="1"/>
|
||||
<field name="partner_id" readonly="1"/>
|
||||
<field name="restrict_partner_id" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</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"
|
||||
states="partially_available,assigned"
|
||||
icon="fa-ban"/>
|
||||
</field>
|
||||
</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>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
133
stock_usability/views/stock_picking.xml
Normal file
133
stock_usability/views/stock_picking.xml
Normal file
@@ -0,0 +1,133 @@
|
||||
<?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_picking_form" model="ir.ui.view">
|
||||
<field name="name">stock_usability.view_picking_form</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="backorder_id" position="attributes">
|
||||
<attribute name="attrs">{}</attribute>
|
||||
</field>
|
||||
<field name="partner_id" position="attributes">
|
||||
<attribute name="context">{'show_address': 1}</attribute>
|
||||
<attribute name="options">{'always_reload': True}</attribute>
|
||||
</field>
|
||||
<button name="action_cancel" type="object" position="attributes">
|
||||
<attribute name="confirm">Are you sure you want to cancel this picking?</attribute>
|
||||
</button>
|
||||
<!-- STOCK MOVE -->
|
||||
<!-- This sum is useful to check the 'number of items' to transfer... -->
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_uom_qty']" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='location_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='location_dest_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after">
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_dest_id" groups="stock.group_stock_multi_locations"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/button[@name='action_assign_serial']" position="after">
|
||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||
groups="stock.group_stock_user"
|
||||
states="partially_available,assigned"
|
||||
icon="fa-ban"/>
|
||||
</xpath>
|
||||
<!-- STOCK MOVE LINE -->
|
||||
<!--
|
||||
<xpath expr="//field[@name='move_line_ids_without_package']/tree/field[@name='location_id']" position="attributes">
|
||||
<attribute name="attrs">{}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='move_line_ids_without_package']/tree/field[@name='location_dest_id']" 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>
|
||||
<field name="inherit_id" ref="stock.view_picking_internal_search" />
|
||||
<field name="arch" type="xml">
|
||||
<filter name="picking_type" position="after">
|
||||
<filter string="Partner" name="partner_groupby" context="{'group_by': 'partner_id'}"/>
|
||||
</filter>
|
||||
<filter name="origin" position="replace"/>
|
||||
<filter name="expected_date" position="after">
|
||||
<filter name="date_done_groupby" string="Date Done"
|
||||
context="{'group_by': 'date_done:day'}"/>
|
||||
</filter>
|
||||
<filter name="expected_date" position="attributes">
|
||||
<!-- group per day -->
|
||||
<attribute name="context">{'group_by': 'scheduled_date:day'}</attribute>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_picking_pivot" model="ir.ui.view">
|
||||
<field name="name">stock_usability.picking_pivot</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Transfers">
|
||||
<field name="date_done" type="row" interval="month"/>
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_all" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.stock_picking_action_picking_type" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_ready" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_waiting" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_late" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
|
||||
</record>
|
||||
|
||||
<record id="stock.action_picking_tree_backorder" model="ir.actions.act_window">
|
||||
<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>
|
||||
64
stock_usability/views/stock_quant.xml
Normal file
64
stock_usability/views/stock_quant.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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_stock_quant_tree" model="ir.ui.view">
|
||||
<field name="name">stock.usability.quant.tree</field>
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quant_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="quantity" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</field>
|
||||
<field name="available_quantity" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
<record id="view_stock_quant_form" model="ir.ui.view">
|
||||
<field name="name">stock.usability.quant.form</field>
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quant_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" icon="fa-arrows-v" type="object" name="action_stock_move_lines_reserved" string="Reservations"/>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<!-- more detailed stock.move tree view when using the button from product form -->
|
||||
<!-- TODO TEST
|
||||
<record id="stock.act_product_stock_move_open" model="ir.actions.act_window">
|
||||
<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">
|
||||
<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"/>
|
||||
|
||||
<!--
|
||||
<record id="stock.action_production_lot_form" model="ir.actions.act_window">
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
</odoo>
|
||||
29
stock_usability/views/stock_warehouse.xml
Normal file
29
stock_usability/views/stock_warehouse.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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_warehouse" model="ir.ui.view">
|
||||
<field name="name">stock.usability.warehouse.form</field>
|
||||
<field name="model">stock.warehouse</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='out_type_id']/.." position="after">
|
||||
<group name="routes" string="Routes">
|
||||
<field name="route_ids" widget="many2many_tags"/>
|
||||
<field name="crossdock_route_id"/>
|
||||
<field name="reception_route_id"/>
|
||||
<field name="delivery_route_id"/>
|
||||
<field name="resupply_route_ids"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -1,3 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import stock_quantity_history
|
||||
@@ -1,30 +0,0 @@
|
||||
# Copyright 2019 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).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockQuantityHistory(models.TransientModel):
|
||||
_inherit = 'stock.quantity.history'
|
||||
|
||||
location_id = fields.Many2one(
|
||||
'stock.location', string='Stock Location',
|
||||
domain=[('usage', '=', 'internal')],
|
||||
help="If you select a stock location, the inventory report will be "
|
||||
"for this stock location and its children locations. If you leave "
|
||||
"this field empty, the inventory report will be for all the internal "
|
||||
"stock locations.")
|
||||
|
||||
def open_table(self):
|
||||
action = super(StockQuantityHistory, self).open_table()
|
||||
if self.compute_at_date:
|
||||
action['domain'] = "[('type', '=', 'product'), ('qty_available', '!=', 0)]"
|
||||
if self.location_id:
|
||||
if self.compute_at_date:
|
||||
# insert "location" in context for qty computation
|
||||
action['context']['location'] = self.location_id.id
|
||||
else:
|
||||
action['domain'] = [('location_id', 'child_of', self.location_id.id)]
|
||||
action['context'] = {}
|
||||
return action
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2019 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).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_stock_quantity_history" model="ir.ui.view">
|
||||
<field name="name">stock_usability.stock.quantity.history.form</field>
|
||||
<field name="model">stock.quantity.history</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quantity_history"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date" position="after">
|
||||
<field name="location_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user