[MIG] stock_usability_akretion to v18
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright 2015-2022 Akretion (http://www.akretion.com)
|
||||
# Copyright 2015-2024 Akretion France (https://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2016-2022 Akretion France
|
||||
# Copyright 2016-2024 Akretion France (https://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017-2022 Akretion France (https://akretion.com/)
|
||||
# Copyright 2017-2024 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).
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2014-2022 Akretion (http://www.akretion.com)
|
||||
# Copyright 2014-2024 Akretion (https://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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</a> qty %s %s <b>unreserved</b>")
|
||||
% (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()
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# Copyright 2014-2022 Akretion (http://www.akretion.com)
|
||||
# Copyright 2014-2024 Akretion (https://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models, _
|
||||
from odoo.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(
|
||||
"<a href=# data-oe-model=product.product data-oe-id=%s>%s</a>" % (product.id, product.display_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.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()
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
# Copyright 2014-2022 Akretion (http://www.akretion.com)
|
||||
# Copyright 2014-2024 Akretion (https://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
|
||||
# In the stock module: _order = "is_favorite desc, sequence, id"
|
||||
|
||||
partner_id = fields.Many2one(tracking=True)
|
||||
picking_type_id = fields.Many2one(tracking=True)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2023 Akretion (http://www.akretion.com)
|
||||
# Copyright 2023-2024 Akretion (https://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2014-2022 Akretion (http://www.akretion.com)
|
||||
# Copyright 2014-2024 Akretion (https://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2015-2022 Akretion (http://www.akretion.com)
|
||||
# Copyright 2015-2024 Akretion (https://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user