[IMP] pre-commit: first run on whole repo

This commit is contained in:
Kevin Khao
2021-11-26 18:54:38 +03:00
parent a04b8980e1
commit 167aefee13
289 changed files with 6020 additions and 4170 deletions

View File

@@ -4,12 +4,12 @@
{
'name': 'Stock Usability',
'version': '14.0.1.0.0',
'category': 'Inventory, Logistic, Storage',
'license': 'AGPL-3',
'summary': 'Several usability enhancements in Warehouse management',
'description': """
"name": "Stock Usability",
"version": "14.0.1.0.0",
"category": "Inventory, Logistic, Storage",
"license": "AGPL-3",
"summary": "Several usability enhancements in Warehouse management",
"description": """
Stock Usability
===============
@@ -22,22 +22,22 @@ The usability enhancements include:
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['stock'],
'data': [
'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/stock_warehouse_orderpoint.xml',
'views/product.xml',
'views/procurement_group.xml',
'views/procurement_scheduler_log.xml',
'security/ir.model.access.csv',
],
'post_init_hook': 'create_config_parameter_immediate_tranfer',
'installable': True,
"author": "Akretion",
"website": "https://github.com/OCA/odoo-usability",
"depends": ["stock"],
"data": [
"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/stock_warehouse_orderpoint.xml",
"views/product.xml",
"views/procurement_group.xml",
"views/procurement_scheduler_log.xml",
"security/ir.model.access.csv",
],
"post_init_hook": "create_config_parameter_immediate_tranfer",
"installable": True,
}

View File

@@ -2,45 +2,53 @@
# @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
from datetime import datetime
import logging
from datetime import datetime
from odoo import api, fields, models
logger = logging.getLogger(__name__)
class ProcurementGroup(models.Model):
_inherit = 'procurement.group'
_inherit = "procurement.group"
picking_ids = fields.One2many(
'stock.picking', 'group_id', string='Pickings', readonly=True)
"stock.picking", "group_id", string="Pickings", readonly=True
)
@api.model
def run_scheduler(self, use_new_cursor=False, company_id=False):
'''Inherit to add info logs'''
"""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 procurement scheduler " "(company ID=%d, uid=%d, use_new_cursor=%s)",
company_id,
self._uid,
use_new_cursor,
)
start_datetime = datetime.now()
res = super().run_scheduler(
use_new_cursor=use_new_cursor, company_id=company_id)
use_new_cursor=use_new_cursor, company_id=company_id
)
logger.info(
'END procurement scheduler '
'(company ID=%d, uid=%d, use_new_cursor=%s)',
company_id, self._uid, use_new_cursor)
"END procurement scheduler " "(company ID=%d, uid=%d, use_new_cursor=%s)",
company_id,
self._uid,
use_new_cursor,
)
try:
# I put it in a try/except, to be sure that, even if the user
# the execute the scheduler doesn't have create right on
# procurement.scheduler.log
self.env['procurement.scheduler.log'].create({
'company_id': company_id,
'start_datetime': start_datetime,
})
self.env["procurement.scheduler.log"].create(
{
"company_id": company_id,
"start_datetime": start_datetime,
}
)
# If I don't do an explicit cr.commit(), it doesn't create
# the procurement.scheduler.log... I don't know why
self._cr.commit()
except Exception as e:
logger.warning(
'Could not create procurement.scheduler.log (error: %s)', e)
logger.warning("Could not create procurement.scheduler.log (error: %s)", e)
return res

View File

@@ -6,10 +6,9 @@ from odoo import fields, models
class ProcurementSchedulerLog(models.Model):
_name = 'procurement.scheduler.log'
_description = 'Logs of the Procurement Scheduler'
_order = 'create_date desc'
_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)
company_id = fields.Many2one("res.company", string="Company", readonly=True)
start_datetime = fields.Datetime(string="Start Date", readonly=True)

View File

@@ -6,26 +6,26 @@ from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
_inherit = "product.template"
tracking = fields.Selection(tracking=True)
sale_delay = fields.Float(tracking=True)
# the 'stock' module adds 'product' in type...
# but forgets to make it the default
type = fields.Selection(default='product')
type = fields.Selection(default="product")
def action_view_stock_move(self):
action = self.env.ref('stock.stock_move_action').sudo().read()[0]
action['domain'] = [('product_id.product_tmpl_id', 'in', self.ids)]
action['context'] = {'search_default_done': True}
action = self.env.ref("stock.stock_move_action").sudo().read()[0]
action["domain"] = [("product_id.product_tmpl_id", "in", self.ids)]
action["context"] = {"search_default_done": True}
return action
class ProductProduct(models.Model):
_inherit = 'product.product'
_inherit = "product.product"
def action_view_stock_move(self):
action = self.env.ref('stock.stock_move_action').sudo().read()[0]
action['domain'] = [('product_id', 'in', self.ids)]
action['context'] = {'search_default_done': True}
action = self.env.ref("stock.stock_move_action").sudo().read()[0]
action["domain"] = [("product_id", "in", self.ids)]
action["context"] = {"search_default_done": True}
return action

View File

@@ -6,6 +6,6 @@ from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
_inherit = "res.partner"
picking_warn = fields.Selection(tracking=True)

View File

@@ -2,44 +2,66 @@
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from odoo import _, fields, models
from odoo.tools import float_compare, float_is_zero
class StockInventory(models.Model):
_inherit = 'stock.inventory'
_inherit = "stock.inventory"
prefill_counted_quantity = fields.Selection(
readonly=True, states={'draft': [('readonly', False)]})
readonly=True, states={"draft": [("readonly", False)]}
)
class StockInventoryLine(models.Model):
_inherit = 'stock.inventory.line'
_inherit = "stock.inventory.line"
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
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'))])
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 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):
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:
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:
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)]
return [("id", "in", line_ids)]

View File

@@ -6,6 +6,6 @@ from odoo import fields, models
class StockLocationRoute(models.Model):
_inherit = 'stock.location.route'
_inherit = "stock.location.route"
name = fields.Char(translate=False)

View File

@@ -2,37 +2,40 @@
# @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
from odoo import _, fields, models
from odoo.exceptions import UserError
logger = logging.getLogger(__name__)
class StockMove(models.Model):
_inherit = 'stock.move'
_inherit = "stock.move"
# for optional display in tree view
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
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
# 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:
@@ -40,37 +43,52 @@ class StockMove(models.Model):
picking = move.picking_id
if picking:
product = move.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,
move.product_qty, product.uom_id.name))
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,
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'
_inherit = "stock.move.line"
# for optional display in tree view
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
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':
if moveline.state == "cancel":
continue
elif moveline.state == 'done':
raise UserError(_(
"You cannot unreserve a move line in done state."))
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))
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

@@ -2,15 +2,16 @@
# @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
from odoo import _, fields, models
logger = logging.getLogger(__name__)
class StockPicking(models.Model):
_inherit = 'stock.picking'
# _order = 'id desc'
_inherit = "stock.picking"
# _order = 'id desc'
# In the stock module: _order = "priority desc, scheduled_date asc, id desc"
# The problem is date asc
@@ -27,6 +28,6 @@ class StockPicking(models.Model):
class StockPickingType(models.Model):
_inherit = 'stock.picking.type'
_inherit = "stock.picking.type"
name = fields.Char(translate=False)

View File

@@ -6,12 +6,14 @@ from odoo import fields, models
class StockQuant(models.Model):
_inherit = 'stock.quant'
_inherit = "stock.quant"
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
product_barcode = fields.Char(
related="product_id.barcode", string="Product Barcode"
)
def action_stock_move_lines_reserved(self):
self.ensure_one()
action = self.action_view_stock_moves()
action['context'] = {'search_default_todo': True}
action["context"] = {"search_default_todo": True}
return action

View File

@@ -2,27 +2,27 @@
# @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
from odoo import api, models
logger = logging.getLogger(__name__)
class StockWarehouseOrderpoint(models.Model):
_inherit = 'stock.warehouse.orderpoint'
_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')
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')
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
@@ -30,9 +30,10 @@ class StockWarehouseOrderpoint(models.Model):
# 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'])
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)
@@ -42,9 +43,11 @@ class StockWarehouseOrderpoint(models.Model):
# 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.'
)]
_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

@@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import SUPERUSER_ID, api
logger = logging.getLogger(__name__)
@@ -12,15 +13,19 @@ 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')])
conf_param = ico.search([("key", "=", "stock.no_default_immediate_tranfer")])
if not conf_param:
ico.create({
'key': 'stock.no_default_immediate_tranfer',
'value': 'True',
})
ico.create(
{
"key": "stock.no_default_immediate_tranfer",
"value": "True",
}
)
logger.info(
'ir.config_parameter stock.no_default_immediate_tranfer created')
"ir.config_parameter stock.no_default_immediate_tranfer created"
)
else:
logger.info(
'ir.config_parameter stock.no_default_immediate_tranfer '
'already exists')
"ir.config_parameter stock.no_default_immediate_tranfer "
"already exists"
)

View File

@@ -27,7 +27,7 @@ index bbb6f301834..48d016010dc 100644
product.virtual_available = res[product.id]['virtual_available']
+ product.reserved_qty = res[product.id]['reserved_qty']
+ product.free_qty = res[product.id]['free_qty']
def _product_available(self, field_names=None, arg=False):
""" Compatibility method """
@@ -124,7 +138,7 @@ class Product(models.Model):
@@ -58,7 +58,7 @@ index bbb6f301834..48d016010dc 100644
@@ -261,10 +278,16 @@ class Product(models.Model):
# TDE FIXME: should probably clean the search methods
return self._search_product_quantity(operator, value, 'outgoing_qty')
+ def _search_reserved_qty(self, operator, value):
+ return self._search_product_quantity(operator, value, 'reserved_qty')
+
@@ -76,7 +76,7 @@ index bbb6f301834..48d016010dc 100644
@@ -387,6 +410,12 @@ class Product(models.Model):
action['context'] = {'search_default_internal_loc': 1}
return action
+ def action_open_move_lines(self):
+ action = self.env.ref('stock.stock_move_line_action').read()[0]
+ action['domain'] = [('product_id', '=', self.id), ('state', 'not in', ('done', 'cancel'))]
@@ -140,7 +140,7 @@ index bbb6f301834..48d016010dc 100644
@@ -524,6 +573,16 @@ class ProductTemplate(models.Model):
product_variant_ids = self.env['product.product'].search(domain)
return [('product_variant_ids', 'in', product_variant_ids.ids)]
+ def _search_reserved_qty(self, operator, value):
+ domain = [('reserved_qty', operator, value)]
+ product_variant_ids = self.env['product.product'].search(domain)
@@ -157,7 +157,7 @@ index bbb6f301834..48d016010dc 100644
@@ -609,6 +668,13 @@ class ProductTemplate(models.Model):
action['context'] = {'search_default_internal_loc': 1}
return action
+ def action_open_move_lines(self):
+ products = self.mapped('product_variant_ids')
+ action = self.env.ref('stock.stock_move_line_action').read()[0]

View File

@@ -1,19 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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 name="partner_id" readonly="1" />
</field>
</field>
</record>

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?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_scheduler_log_tree" model="ir.ui.view">
@@ -12,10 +11,10 @@
<field name="model">procurement.scheduler.log</field>
<field name="arch" type="xml">
<tree string="Procurement Scheduler Logs">
<field name="start_datetime"/>
<field name="create_date" string="Scheduler End Time"/>
<field name="create_uid" string="Scheduler Executed by"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="start_datetime" />
<field name="create_date" string="Scheduler End Time" />
<field name="create_uid" string="Scheduler Executed by" />
<field name="company_id" groups="base.group_multi_company" />
</tree>
</field>
</record>
@@ -26,8 +25,11 @@
<field name="view_mode">tree</field>
</record>
<menuitem id="procurement_scheduler_log_menu"
action="procurement_scheduler_log_action"
parent="stock.menu_stock_warehouse_mgmt" sequence="140"/>
<menuitem
id="procurement_scheduler_log_menu"
action="procurement_scheduler_log_action"
parent="stock.menu_stock_warehouse_mgmt"
sequence="140"
/>
</odoo>

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2021 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>
@@ -22,15 +21,20 @@
<record id="product_template_form_view_procurement_button" model="ir.ui.view">
<field name="name">stock_usability.product.template.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/>
<field
name="inherit_id"
ref="stock.product_template_form_view_procurement_button"
/>
<field name="arch" type="xml">
<button name="action_view_stock_move_lines" position="before">
<button string="Stock Moves"
type="object"
name= "action_view_stock_move"
attrs="{'invisible': [('type', 'not in', ('product', 'consu'))]}"
groups="stock.group_stock_user"
class="oe_stat_button" icon="fa-exchange"
<button
string="Stock Moves"
type="object"
name="action_view_stock_move"
attrs="{'invisible': [('type', 'not in', ('product', 'consu'))]}"
groups="stock.group_stock_user"
class="oe_stat_button"
icon="fa-exchange"
/>
</button>
</field>
@@ -39,15 +43,17 @@
<record id="product_form_view_procurement_button" model="ir.ui.view">
<field name="name">stock_usability.product.product.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="stock.product_form_view_procurement_button"/>
<field name="inherit_id" ref="stock.product_form_view_procurement_button" />
<field name="arch" type="xml">
<button name="action_view_stock_move_lines" position="before">
<button string="Stock Moves"
type="object"
name= "action_view_stock_move"
attrs="{'invisible': [('type', 'not in', ('product', 'consu'))]}"
groups="stock.group_stock_user"
class="oe_stat_button" icon="fa-exchange"
<button
string="Stock Moves"
type="object"
name="action_view_stock_move"
attrs="{'invisible': [('type', 'not in', ('product', 'consu'))]}"
groups="stock.group_stock_user"
class="oe_stat_button"
icon="fa-exchange"
/>
</button>
</field>

View File

@@ -1,33 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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
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="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 name="product_barcode" optional="hide" />
</field>
<tree position="attributes">
<!-- native :
@@ -35,8 +39,12 @@
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>
<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>
@@ -47,22 +55,35 @@
<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="inherit_id" ref="stock.stock_inventory_line_search" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="categ_id"/>
<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
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,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -15,10 +14,16 @@
<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="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>
@@ -27,18 +32,24 @@
<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>
<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="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"/>
<button
type="action"
name="%(location_open_orderpoint)d"
string="Reordering Rules"
class="oe_stat_button"
icon="fa-refresh"
/>
</div>
</field>
</record>
@@ -49,9 +60,12 @@ 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"/>
<menuitem
id="stock_location_menu"
action="stock.action_location_form"
parent="stock.menu_warehouse_report"
groups="stock.group_stock_multi_locations"
sequence="50"
/>
</odoo>

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -21,18 +20,18 @@
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 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"/>
<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>
@@ -53,13 +52,17 @@
<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"/>
<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 name="product_barcode" optional="hide" />
</field>
</field>
</record>
@@ -70,19 +73,23 @@
<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 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"/>
<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 name="product_barcode" optional="hide" />
</field>
</field>
</record>
@@ -93,7 +100,7 @@
<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 name="product_barcode" optional="hide" />
</field>
</field>
</record>

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -21,27 +20,63 @@
<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>
<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">
<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='name']" position="replace"/>
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after">
<field name="product_barcode" optional="hide"/>
<field name="name" optional="hide"/>
<field name="location_id" groups="stock.group_stock_multi_locations" optional="show" domain="[('id', 'child_of', 'parent.location_id')]" options="{'no_create': True}"/>
<field name="location_dest_id" groups="stock.group_stock_multi_locations" optional="show" domain="[('id', 'child_of', 'parent.location_dest_id')]" options="{'no_create': True}"/>
<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='name']"
position="replace"
/>
<xpath
expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']"
position="after"
>
<field name="product_barcode" optional="hide" />
<field name="name" optional="hide" />
<field
name="location_id"
groups="stock.group_stock_multi_locations"
optional="show"
domain="[('id', 'child_of', 'parent.location_id')]"
options="{'no_create': True}"
/>
<field
name="location_dest_id"
groups="stock.group_stock_multi_locations"
optional="show"
domain="[('id', 'child_of', 'parent.location_dest_id')]"
options="{'no_create': True}"
/>
</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
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>
</field>
</record>
@@ -52,7 +87,7 @@
<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 name="date_done" optional="show" />
</field>
</field>
</record>
@@ -63,12 +98,19 @@
<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
string="Partner"
name="partner_groupby"
context="{'group_by': 'partner_id'}"
/>
</filter>
<filter name="origin" position="replace"/>
<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
name="date_done_groupby"
string="Date Done"
context="{'group_by': 'date_done:day'}"
/>
</filter>
<filter name="expected_date" position="attributes">
<!-- group per day -->
@@ -82,7 +124,7 @@
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<pivot string="Transfers">
<field name="date_done" type="row" interval="month"/>
<field name="date_done" type="row" interval="month" />
</pivot>
</field>
</record>
@@ -114,11 +156,11 @@
<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="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 name="default_location_src_id" />
<field name="default_location_dest_id" />
</field>
</field>
</record>

View File

@@ -1,20 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="inherit_id" ref="stock.view_stock_quant_tree" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_barcode" optional="hide"/>
<field name="product_barcode" optional="hide" />
</field>
<field name="quantity" position="attributes">
<attribute name="sum">1</attribute>
@@ -54,9 +53,12 @@ So I create another "regular" Quants" menu entry -->
<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"/>
<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">

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -15,11 +14,11 @@
<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"/>
<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>

View File

@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -13,7 +12,7 @@
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_form" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="trigger"/>
<field name="trigger" />
</field>
</field>
</record>
@@ -30,7 +29,10 @@
<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="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>