mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[14.0][MIG] rma*: ir.actions.act_window has different access
right in v14. Actions that read those records need to use `sudo` to allow non-admin users to be able to use these actions.
This commit is contained in:
committed by
Jordi Ballester Alomar
parent
7892cab9e8
commit
5f0652a09d
@@ -32,7 +32,7 @@ class RmaOrder(models.Model):
|
|||||||
|
|
||||||
def action_view_purchase_order(self):
|
def action_view_purchase_order(self):
|
||||||
action = self.env.ref("purchase.purchase_rfq")
|
action = self.env.ref("purchase.purchase_rfq")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
po_ids = self.env["purchase.order"].search([("origin", "=", self.name)]).ids
|
po_ids = self.env["purchase.order"].search([("origin", "=", self.name)]).ids
|
||||||
for line in self.rma_line_ids:
|
for line in self.rma_line_ids:
|
||||||
po_ids += (
|
po_ids += (
|
||||||
@@ -43,7 +43,7 @@ class RmaOrder(models.Model):
|
|||||||
|
|
||||||
def action_view_origin_purchase_order(self):
|
def action_view_origin_purchase_order(self):
|
||||||
action = self.env.ref("purchase.purchase_rfq")
|
action = self.env.ref("purchase.purchase_rfq")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
po_ids = self.mapped("rma_line_ids.purchase_order_line_id.order_id").ids
|
po_ids = self.mapped("rma_line_ids.purchase_order_line_id.order_id").ids
|
||||||
result["domain"] = [("id", "in", po_ids)]
|
result["domain"] = [("id", "in", po_ids)]
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ class RmaOrderLine(models.Model):
|
|||||||
|
|
||||||
def action_view_purchase_order(self):
|
def action_view_purchase_order(self):
|
||||||
action = self.env.ref("purchase.purchase_rfq")
|
action = self.env.ref("purchase.purchase_rfq")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
orders = self.mapped("purchase_order_line_ids.order_id")
|
orders = self.mapped("purchase_order_line_ids.order_id")
|
||||||
result["domain"] = [("id", "in", orders.ids)]
|
result["domain"] = [("id", "in", orders.ids)]
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class RmaMakePicking(models.TransientModel):
|
|||||||
po_list.append(procurement.purchase_id.id)
|
po_list.append(procurement.purchase_id.id)
|
||||||
if len(po_list):
|
if len(po_list):
|
||||||
action = self.env.ref("purchase.purchase_rfq")
|
action = self.env.ref("purchase.purchase_rfq")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
result["domain"] = [("id", "in", po_list)]
|
result["domain"] = [("id", "in", po_list)]
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class RmaLineMakePurchaseOrder(models.TransientModel):
|
|||||||
res.append(purchase.id)
|
res.append(purchase.id)
|
||||||
|
|
||||||
action = self.env.ref("purchase.purchase_rfq")
|
action = self.env.ref("purchase.purchase_rfq")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
result["domain"] = "[('id','in', [" + ",".join(map(str, res)) + "])]"
|
result["domain"] = "[('id','in', [" + ",".join(map(str, res)) + "])]"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user