mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] adapt syntax for act_window lookup
This commit is contained in:
@@ -99,14 +99,15 @@ class StockCycleCount(models.Model):
|
||||
return True
|
||||
|
||||
def action_view_inventory(self):
|
||||
action = self.env.ref("stock.action_inventory_form")
|
||||
result = action.read()[0]
|
||||
result["context"] = {}
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock.action_inventory_form"
|
||||
)
|
||||
action["context"] = {}
|
||||
adjustment_ids = self.mapped("stock_adjustment_ids").ids
|
||||
if len(adjustment_ids) > 1:
|
||||
result["domain"] = [("id", "in", adjustment_ids)]
|
||||
action["domain"] = [("id", "in", adjustment_ids)]
|
||||
elif len(adjustment_ids) == 1:
|
||||
res = self.env.ref("stock.view_inventory_form", False)
|
||||
result["views"] = [(res and res.id or False, "form")]
|
||||
result["res_id"] = adjustment_ids and adjustment_ids[0] or False
|
||||
return result
|
||||
action["views"] = [(res and res.id or False, "form")]
|
||||
action["res_id"] = adjustment_ids and adjustment_ids[0] or False
|
||||
return action
|
||||
|
||||
@@ -113,8 +113,9 @@ class StockLocation(models.Model):
|
||||
|
||||
def action_accuracy_stats(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref("stock_cycle_count.act_accuracy_stats")
|
||||
result = action.read()[0]
|
||||
new_domain = result["domain"][:-1] + ", ('location_ids', 'in', active_ids)]"
|
||||
result["domain"] = new_domain
|
||||
return result
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock_cycle_count.act_accuracy_stats"
|
||||
)
|
||||
new_domain = action["domain"][:-1] + ", ('location_ids', 'in', active_ids)]"
|
||||
action["domain"] = new_domain
|
||||
return action
|
||||
|
||||
@@ -14,9 +14,9 @@ class StockPickingType(models.Model):
|
||||
)
|
||||
|
||||
def action_move_location(self):
|
||||
action = self.env.ref(
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock_move_location.wiz_stock_move_location_action"
|
||||
).read()[0]
|
||||
)
|
||||
action["context"] = {
|
||||
"default_origin_location_id": self.default_location_src_id.id,
|
||||
"default_destination_location_id": self.default_location_dest_id.id,
|
||||
|
||||
@@ -221,11 +221,13 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
self.picking_id = picking
|
||||
return self._get_picking_action(picking.id)
|
||||
|
||||
def _get_picking_action(self, pickinig_id):
|
||||
action = self.env.ref("stock.action_picking_tree_all").read()[0]
|
||||
def _get_picking_action(self, picking_id):
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock.action_picking_tree_all"
|
||||
)
|
||||
form_view = self.env.ref("stock.view_picking_form").id
|
||||
action.update(
|
||||
{"view_mode": "form", "views": [(form_view, "form")], "res_id": pickinig_id}
|
||||
{"view_mode": "form", "views": [(form_view, "form")], "res_id": picking_id}
|
||||
)
|
||||
return action
|
||||
|
||||
|
||||
@@ -9,13 +9,14 @@ class StockWarehouseOrderpoint(models.Model):
|
||||
_inherit = "stock.warehouse.orderpoint"
|
||||
|
||||
def action_view_stock_picking(self):
|
||||
action = self.env.ref("stock.action_picking_tree_all")
|
||||
result = action.read()[0]
|
||||
result["context"] = {}
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock.action_picking_tree_all"
|
||||
)
|
||||
action["context"] = {}
|
||||
picking_ids = (
|
||||
self.env["stock.move"]
|
||||
.search([("orderpoint_ids", "in", self.id)])
|
||||
.mapped("picking_id")
|
||||
)
|
||||
result["domain"] = "[('id','in',%s)]" % picking_ids.ids
|
||||
return result
|
||||
action["domain"] = "[('id','in',%s)]" % picking_ids.ids
|
||||
return action
|
||||
|
||||
@@ -26,8 +26,9 @@ class StockPicking(models.Model):
|
||||
"""
|
||||
:return dict: dictionary value for created view
|
||||
"""
|
||||
action = self.env.ref("stock_request.action_stock_request_form").read()[0]
|
||||
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock_request.action_stock_request_form"
|
||||
)
|
||||
requests = self.mapped("stock_request_ids")
|
||||
if len(requests) > 1:
|
||||
action["domain"] = [("id", "in", requests.ids)]
|
||||
|
||||
@@ -348,8 +348,9 @@ class StockRequest(models.Model):
|
||||
return True
|
||||
|
||||
def action_view_transfer(self):
|
||||
action = self.env.ref("stock.action_picking_tree_all").read()[0]
|
||||
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock.action_picking_tree_all"
|
||||
)
|
||||
pickings = self.mapped("picking_ids")
|
||||
if len(pickings) > 1:
|
||||
action["domain"] = [("id", "in", pickings.ids)]
|
||||
|
||||
@@ -248,7 +248,9 @@ class StockRequestOrder(models.Model):
|
||||
return
|
||||
|
||||
def action_view_transfer(self):
|
||||
action = self.env.ref("stock.action_picking_tree_all").sudo().read()[0]
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock.action_picking_tree_all"
|
||||
)
|
||||
|
||||
pickings = self.mapped("picking_ids")
|
||||
if len(pickings) > 1:
|
||||
@@ -259,7 +261,9 @@ class StockRequestOrder(models.Model):
|
||||
return action
|
||||
|
||||
def action_view_stock_requests(self):
|
||||
action = self.env.ref("stock_request.action_stock_request_form").read()[0]
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock_request.action_stock_request_form"
|
||||
)
|
||||
if len(self.stock_request_ids) > 1:
|
||||
action["domain"] = [("order_id", "in", self.ids)]
|
||||
elif self.stock_request_ids:
|
||||
@@ -353,7 +357,9 @@ class StockRequestOrder(models.Model):
|
||||
"administrator."
|
||||
)
|
||||
)
|
||||
action = self.env.ref("stock_request.stock_request_order_action").read()[0]
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"stock_request.stock_request_order_action"
|
||||
)
|
||||
action["views"] = [
|
||||
(self.env.ref("stock_request.stock_request_order_form").id, "form")
|
||||
]
|
||||
|
||||
@@ -180,7 +180,7 @@ class VerticalLiftShuttle(models.Model):
|
||||
def action_back_to_settings(self):
|
||||
self.release_vertical_lift_tray()
|
||||
action_xmlid = "stock_vertical_lift.vertical_lift_shuttle_action"
|
||||
action = self.env.ref(action_xmlid).read()[0]
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(action_xmlid)
|
||||
action["target"] = "main"
|
||||
return action
|
||||
|
||||
|
||||
Reference in New Issue
Block a user