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
|
return True
|
||||||
|
|
||||||
def action_view_inventory(self):
|
def action_view_inventory(self):
|
||||||
action = self.env.ref("stock.action_inventory_form")
|
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||||
result = action.read()[0]
|
"stock.action_inventory_form"
|
||||||
result["context"] = {}
|
)
|
||||||
|
action["context"] = {}
|
||||||
adjustment_ids = self.mapped("stock_adjustment_ids").ids
|
adjustment_ids = self.mapped("stock_adjustment_ids").ids
|
||||||
if len(adjustment_ids) > 1:
|
if len(adjustment_ids) > 1:
|
||||||
result["domain"] = [("id", "in", adjustment_ids)]
|
action["domain"] = [("id", "in", adjustment_ids)]
|
||||||
elif len(adjustment_ids) == 1:
|
elif len(adjustment_ids) == 1:
|
||||||
res = self.env.ref("stock.view_inventory_form", False)
|
res = self.env.ref("stock.view_inventory_form", False)
|
||||||
result["views"] = [(res and res.id or False, "form")]
|
action["views"] = [(res and res.id or False, "form")]
|
||||||
result["res_id"] = adjustment_ids and adjustment_ids[0] or False
|
action["res_id"] = adjustment_ids and adjustment_ids[0] or False
|
||||||
return result
|
return action
|
||||||
|
|||||||
@@ -113,8 +113,9 @@ class StockLocation(models.Model):
|
|||||||
|
|
||||||
def action_accuracy_stats(self):
|
def action_accuracy_stats(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
action = self.env.ref("stock_cycle_count.act_accuracy_stats")
|
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||||
result = action.read()[0]
|
"stock_cycle_count.act_accuracy_stats"
|
||||||
new_domain = result["domain"][:-1] + ", ('location_ids', 'in', active_ids)]"
|
)
|
||||||
result["domain"] = new_domain
|
new_domain = action["domain"][:-1] + ", ('location_ids', 'in', active_ids)]"
|
||||||
return result
|
action["domain"] = new_domain
|
||||||
|
return action
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ class StockPickingType(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def action_move_location(self):
|
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"
|
"stock_move_location.wiz_stock_move_location_action"
|
||||||
).read()[0]
|
)
|
||||||
action["context"] = {
|
action["context"] = {
|
||||||
"default_origin_location_id": self.default_location_src_id.id,
|
"default_origin_location_id": self.default_location_src_id.id,
|
||||||
"default_destination_location_id": self.default_location_dest_id.id,
|
"default_destination_location_id": self.default_location_dest_id.id,
|
||||||
|
|||||||
@@ -221,11 +221,13 @@ class StockMoveLocationWizard(models.TransientModel):
|
|||||||
self.picking_id = picking
|
self.picking_id = picking
|
||||||
return self._get_picking_action(picking.id)
|
return self._get_picking_action(picking.id)
|
||||||
|
|
||||||
def _get_picking_action(self, pickinig_id):
|
def _get_picking_action(self, picking_id):
|
||||||
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"
|
||||||
|
)
|
||||||
form_view = self.env.ref("stock.view_picking_form").id
|
form_view = self.env.ref("stock.view_picking_form").id
|
||||||
action.update(
|
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
|
return action
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,14 @@ class StockWarehouseOrderpoint(models.Model):
|
|||||||
_inherit = "stock.warehouse.orderpoint"
|
_inherit = "stock.warehouse.orderpoint"
|
||||||
|
|
||||||
def action_view_stock_picking(self):
|
def action_view_stock_picking(self):
|
||||||
action = self.env.ref("stock.action_picking_tree_all")
|
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||||
result = action.read()[0]
|
"stock.action_picking_tree_all"
|
||||||
result["context"] = {}
|
)
|
||||||
|
action["context"] = {}
|
||||||
picking_ids = (
|
picking_ids = (
|
||||||
self.env["stock.move"]
|
self.env["stock.move"]
|
||||||
.search([("orderpoint_ids", "in", self.id)])
|
.search([("orderpoint_ids", "in", self.id)])
|
||||||
.mapped("picking_id")
|
.mapped("picking_id")
|
||||||
)
|
)
|
||||||
result["domain"] = "[('id','in',%s)]" % picking_ids.ids
|
action["domain"] = "[('id','in',%s)]" % picking_ids.ids
|
||||||
return result
|
return action
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ class StockPicking(models.Model):
|
|||||||
"""
|
"""
|
||||||
:return dict: dictionary value for created view
|
: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")
|
requests = self.mapped("stock_request_ids")
|
||||||
if len(requests) > 1:
|
if len(requests) > 1:
|
||||||
action["domain"] = [("id", "in", requests.ids)]
|
action["domain"] = [("id", "in", requests.ids)]
|
||||||
|
|||||||
@@ -348,8 +348,9 @@ class StockRequest(models.Model):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def action_view_transfer(self):
|
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")
|
pickings = self.mapped("picking_ids")
|
||||||
if len(pickings) > 1:
|
if len(pickings) > 1:
|
||||||
action["domain"] = [("id", "in", pickings.ids)]
|
action["domain"] = [("id", "in", pickings.ids)]
|
||||||
|
|||||||
@@ -248,7 +248,9 @@ class StockRequestOrder(models.Model):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def action_view_transfer(self):
|
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")
|
pickings = self.mapped("picking_ids")
|
||||||
if len(pickings) > 1:
|
if len(pickings) > 1:
|
||||||
@@ -259,7 +261,9 @@ class StockRequestOrder(models.Model):
|
|||||||
return action
|
return action
|
||||||
|
|
||||||
def action_view_stock_requests(self):
|
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:
|
if len(self.stock_request_ids) > 1:
|
||||||
action["domain"] = [("order_id", "in", self.ids)]
|
action["domain"] = [("order_id", "in", self.ids)]
|
||||||
elif self.stock_request_ids:
|
elif self.stock_request_ids:
|
||||||
@@ -353,7 +357,9 @@ class StockRequestOrder(models.Model):
|
|||||||
"administrator."
|
"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"] = [
|
action["views"] = [
|
||||||
(self.env.ref("stock_request.stock_request_order_form").id, "form")
|
(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):
|
def action_back_to_settings(self):
|
||||||
self.release_vertical_lift_tray()
|
self.release_vertical_lift_tray()
|
||||||
action_xmlid = "stock_vertical_lift.vertical_lift_shuttle_action"
|
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"
|
action["target"] = "main"
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user