diff --git a/stock_usability_akretion/__init__.py b/stock_usability_akretion/__init__.py index f01eec1..0650744 100644 --- a/stock_usability_akretion/__init__.py +++ b/stock_usability_akretion/__init__.py @@ -1,2 +1 @@ from . import models -from .post_install import create_config_parameter_immediate_tranfer diff --git a/stock_usability_akretion/__manifest__.py b/stock_usability_akretion/__manifest__.py index 3cfeb11..73d0e6f 100644 --- a/stock_usability_akretion/__manifest__.py +++ b/stock_usability_akretion/__manifest__.py @@ -1,11 +1,11 @@ -# Copyright 2014-2022 Akretion (http://www.akretion.com) +# Copyright 2014-2024 Akretion (https://www.akretion.com) # @author Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Stock Usability', - 'version': '16.0.1.0.0', + 'version': '18.0.1.0.0', 'category': 'Inventory, Logistic, Storage', 'license': 'AGPL-3', 'summary': 'Several usability enhancements in Warehouse management', @@ -23,7 +23,7 @@ The usability enhancements include: This module has been written by Alexis de Lattre from Akretion . """, 'author': 'Akretion', - 'website': 'http://www.akretion.com', + 'website': 'https://github.com/akretion/odoo-usability', 'depends': ['stock'], 'data': [ 'views/stock_quant.xml', @@ -40,6 +40,5 @@ This module has been written by Alexis de Lattre from Akretion # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/stock_usability_akretion/models/product.py b/stock_usability_akretion/models/product.py index 5f1a205..cc42186 100644 --- a/stock_usability_akretion/models/product.py +++ b/stock_usability_akretion/models/product.py @@ -1,4 +1,4 @@ -# Copyright 2016-2022 Akretion France +# Copyright 2016-2024 Akretion France (https://www.akretion.com/) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -10,12 +10,9 @@ class ProductTemplate(models.Model): tracking = fields.Selection(tracking=True) sale_delay = fields.Float(tracking=True) - # the 'stock' module adds 'product' in detailed_type... - # but forgets to make it the default - detailed_type = fields.Selection(default='product') def action_view_stock_move(self): - action = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_action") + action = self.env["ir.actions.actions"]._for_xml_id("stock_usability_akretion.stock_move_list_first_action") action['domain'] = [('product_id.product_tmpl_id', 'in', self.ids)] action['context'] = {'search_default_done': True} return action @@ -25,7 +22,7 @@ class ProductProduct(models.Model): _inherit = 'product.product' def action_view_stock_move(self): - action = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_action") + action = self.env["ir.actions.actions"]._for_xml_id("stock_usability_akretion.stock_move_list_first_action") action['domain'] = [('product_id', 'in', self.ids)] action['context'] = {'search_default_done': True} return action diff --git a/stock_usability_akretion/models/res_partner.py b/stock_usability_akretion/models/res_partner.py index 189ef62..7f12793 100644 --- a/stock_usability_akretion/models/res_partner.py +++ b/stock_usability_akretion/models/res_partner.py @@ -1,4 +1,4 @@ -# Copyright 2017-2022 Akretion France (https://akretion.com/) +# Copyright 2017-2024 Akretion France (https://akretion.com/) # @author Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/stock_usability_akretion/models/stock_move.py b/stock_usability_akretion/models/stock_move.py index c996af5..83dda19 100644 --- a/stock_usability_akretion/models/stock_move.py +++ b/stock_usability_akretion/models/stock_move.py @@ -1,4 +1,4 @@ -# Copyright 2014-2022 Akretion (http://www.akretion.com) +# Copyright 2014-2024 Akretion (https://www.akretion.com) # @author Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -26,5 +26,6 @@ class StockMove(models.Model): "data-oe-id=%d>%s qty %s %s unreserved") % (product.id, product.display_name, move.product_qty, product.uom_id.name)) + # fields 'product_qty' has digits=0... strange. So I can't use formatLang() # Copied from do_unreserved of stock.picking picking.package_level_ids.filtered(lambda p: not p.move_ids).unlink() diff --git a/stock_usability_akretion/models/stock_move_line.py b/stock_usability_akretion/models/stock_move_line.py index 4d41eea..23a2257 100644 --- a/stock_usability_akretion/models/stock_move_line.py +++ b/stock_usability_akretion/models/stock_move_line.py @@ -1,9 +1,11 @@ -# Copyright 2014-2022 Akretion (http://www.akretion.com) +# Copyright 2014-2024 Akretion (https://www.akretion.com) # @author Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields, models, _ +from odoo.tools.misc import formatLang from odoo.exceptions import UserError +from markupsafe import Markup import logging logger = logging.getLogger(__name__) @@ -12,7 +14,7 @@ logger = logging.getLogger(__name__) class StockMoveLine(models.Model): _inherit = 'stock.move.line' - # for optional display in tree view + # for optional display in list view product_barcode = fields.Char( related='product_id.barcode', string="Product Barcode") @@ -27,11 +29,13 @@ class StockMoveLine(models.Model): picking = moveline.move_id.picking_id if picking: product = moveline.product_id + product_link = Markup( + "%s" % (product.id, product.display_name)) picking.message_post(body=_( - "Product %s qty %s %s unreserved") - % (product.id, product.display_name, - moveline.reserved_qty, product.uom_id.name)) + "Product %(product_link)s qty %(qty)s %(uom)s unreserved", + product_link=product_link, + qty=formatLang(self.env, moveline.quantity, dp='Product Unit of Measure'), + uom=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() diff --git a/stock_usability_akretion/models/stock_picking.py b/stock_usability_akretion/models/stock_picking.py index 96991c7..b67f23d 100644 --- a/stock_usability_akretion/models/stock_picking.py +++ b/stock_usability_akretion/models/stock_picking.py @@ -1,18 +1,13 @@ -# Copyright 2014-2022 Akretion (http://www.akretion.com) +# Copyright 2014-2024 Akretion (https://www.akretion.com) # @author Alexis de Lattre # 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 + # In the stock module: _order = "is_favorite desc, sequence, id" partner_id = fields.Many2one(tracking=True) picking_type_id = fields.Many2one(tracking=True) diff --git a/stock_usability_akretion/models/stock_picking_type.py b/stock_usability_akretion/models/stock_picking_type.py index adee65d..01fbc93 100644 --- a/stock_usability_akretion/models/stock_picking_type.py +++ b/stock_usability_akretion/models/stock_picking_type.py @@ -1,4 +1,4 @@ -# Copyright 2023 Akretion (http://www.akretion.com) +# Copyright 2023-2024 Akretion (https://www.akretion.com) # @author Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/stock_usability_akretion/models/stock_quant.py b/stock_usability_akretion/models/stock_quant.py index 4a8e6b2..b446672 100644 --- a/stock_usability_akretion/models/stock_quant.py +++ b/stock_usability_akretion/models/stock_quant.py @@ -1,4 +1,4 @@ -# Copyright 2014-2022 Akretion (http://www.akretion.com) +# Copyright 2014-2024 Akretion (https://www.akretion.com) # @author Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -17,7 +17,7 @@ class StockQuant(models.Model): "stock.stock_move_line_action") action['domain'] = [ ('state', 'not in', ('draft', 'done', 'cancel')), - ('reserved_uom_qty', '!=', 0), + ('quantity', '!=', 0), ('product_id', '=', self.product_id.id), ('location_id', '=', self.location_id.id), ('lot_id', '=', self.lot_id.id or False), diff --git a/stock_usability_akretion/models/stock_warehouse_orderpoint.py b/stock_usability_akretion/models/stock_warehouse_orderpoint.py index 83f734c..1d6086d 100644 --- a/stock_usability_akretion/models/stock_warehouse_orderpoint.py +++ b/stock_usability_akretion/models/stock_warehouse_orderpoint.py @@ -1,4 +1,4 @@ -# Copyright 2015-2022 Akretion (http://www.akretion.com) +# Copyright 2015-2024 Akretion (https://www.akretion.com) # @author Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/stock_usability_akretion/post_install.py b/stock_usability_akretion/post_install.py deleted file mode 100644 index 22c2830..0000000 --- a/stock_usability_akretion/post_install.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2021-2022 Akretion France (http://www.akretion.com/) -# @author: Alexis de Lattre -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import logging -from odoo import SUPERUSER_ID, api - -logger = logging.getLogger(__name__) - - -def create_config_parameter_immediate_tranfer(cr, registry): - env = api.Environment(cr, SUPERUSER_ID, {}) - ico = env["ir.config_parameter"] - conf_param = ico.search([('key', '=', 'stock.no_default_immediate_tranfer')]) - if not conf_param: - ico.create({ - 'key': 'stock.no_default_immediate_tranfer', - 'value': 'True', - }) - logger.info( - 'ir.config_parameter stock.no_default_immediate_tranfer created') - else: - logger.info( - 'ir.config_parameter stock.no_default_immediate_tranfer ' - 'already exists') diff --git a/stock_usability_akretion/views/procurement_group.xml b/stock_usability_akretion/views/procurement_group.xml index b196a66..342ef37 100644 --- a/stock_usability_akretion/views/procurement_group.xml +++ b/stock_usability_akretion/views/procurement_group.xml @@ -1,6 +1,6 @@ diff --git a/stock_usability_akretion/views/procurement_scheduler_log.xml b/stock_usability_akretion/views/procurement_scheduler_log.xml index aee4258..fbff9ef 100644 --- a/stock_usability_akretion/views/procurement_scheduler_log.xml +++ b/stock_usability_akretion/views/procurement_scheduler_log.xml @@ -1,6 +1,6 @@ @@ -11,19 +11,35 @@ procurement_scheduler_log_tree procurement.scheduler.log - + - + + + + + + + procurement.scheduler.log + + + + + + + + + + Scheduler Logs procurement.scheduler.log - tree + list product.template - - hide - - - - - - - - - 1 - - - 1 - + + + + + + + + 1 + + + 1 + @@ -37,13 +34,17 @@ @@ -57,7 +58,7 @@ - + 1 - + 1 - - - - + + + + - + + - 1 show @@ -65,38 +61,6 @@ - - stock.quant - 100 - - - - - - - - - -