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:
committed by
ArnauCForgeFlow
parent
6d20fa9f5f
commit
723621ec7a
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user