[MIG] stock_usability from v14 to v16

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

View File

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