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
Florian da Costa
parent
ce3faa653e
commit
d0c010e5c1
@@ -18,6 +18,6 @@ class ResPartner(models.Model):
|
|||||||
|
|
||||||
def action_open_partner_rma(self):
|
def action_open_partner_rma(self):
|
||||||
action = self.env.ref("rma.action_rma_customer_lines")
|
action = self.env.ref("rma.action_rma_customer_lines")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
result["context"] = {"search_default_partner_id": self.id}
|
result["context"] = {"search_default_partner_id": self.id}
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ class RmaOrder(models.Model):
|
|||||||
|
|
||||||
def action_view_in_shipments(self):
|
def action_view_in_shipments(self):
|
||||||
action = self.env.ref("stock.action_picking_tree_all")
|
action = self.env.ref("stock.action_picking_tree_all")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
picking_ids = []
|
picking_ids = []
|
||||||
for line in self.rma_line_ids:
|
for line in self.rma_line_ids:
|
||||||
for move in line.move_ids:
|
for move in line.move_ids:
|
||||||
@@ -207,7 +207,7 @@ class RmaOrder(models.Model):
|
|||||||
|
|
||||||
def action_view_out_shipments(self):
|
def action_view_out_shipments(self):
|
||||||
action = self.env.ref("stock.action_picking_tree_all")
|
action = self.env.ref("stock.action_picking_tree_all")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
picking_ids = []
|
picking_ids = []
|
||||||
for line in self.rma_line_ids:
|
for line in self.rma_line_ids:
|
||||||
for move in line.move_ids:
|
for move in line.move_ids:
|
||||||
@@ -237,7 +237,7 @@ class RmaOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
action = self.env.ref("rma.action_rma_supplier_lines")
|
action = self.env.ref("rma.action_rma_supplier_lines")
|
||||||
res = self.env.ref("rma.view_rma_line_supplier_form", False)
|
res = self.env.ref("rma.view_rma_line_supplier_form", False)
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
lines = self._get_valid_lines()
|
lines = self._get_valid_lines()
|
||||||
# choose the view_mode accordingly
|
# choose the view_mode accordingly
|
||||||
if len(lines.ids) != 1:
|
if len(lines.ids) != 1:
|
||||||
@@ -250,7 +250,7 @@ class RmaOrder(models.Model):
|
|||||||
|
|
||||||
def action_view_supplier_lines(self):
|
def action_view_supplier_lines(self):
|
||||||
action = self.env.ref("rma.action_rma_supplier_lines")
|
action = self.env.ref("rma.action_rma_supplier_lines")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
lines = self.rma_line_ids
|
lines = self.rma_line_ids
|
||||||
for line_id in lines:
|
for line_id in lines:
|
||||||
related_lines = [line.id for line in line_id.supplier_rma_line_ids]
|
related_lines = [line.id for line in line_id.supplier_rma_line_ids]
|
||||||
|
|||||||
@@ -667,7 +667,7 @@ class RmaOrderLine(models.Model):
|
|||||||
|
|
||||||
def action_view_in_shipments(self):
|
def action_view_in_shipments(self):
|
||||||
action = self.env.ref("stock.action_picking_tree_all")
|
action = self.env.ref("stock.action_picking_tree_all")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
picking_ids = []
|
picking_ids = []
|
||||||
for line in self:
|
for line in self:
|
||||||
for move in line.move_ids:
|
for move in line.move_ids:
|
||||||
@@ -689,7 +689,7 @@ class RmaOrderLine(models.Model):
|
|||||||
|
|
||||||
def action_view_out_shipments(self):
|
def action_view_out_shipments(self):
|
||||||
action = self.env.ref("stock.action_picking_tree_all")
|
action = self.env.ref("stock.action_picking_tree_all")
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
picking_ids = []
|
picking_ids = []
|
||||||
for line in self:
|
for line in self:
|
||||||
for move in line.move_ids:
|
for move in line.move_ids:
|
||||||
@@ -717,7 +717,7 @@ class RmaOrderLine(models.Model):
|
|||||||
action = self.env.ref("rma.action_rma_customer_lines")
|
action = self.env.ref("rma.action_rma_customer_lines")
|
||||||
rma_lines = self.customer_rma_id.ids
|
rma_lines = self.customer_rma_id.ids
|
||||||
res = self.env.ref("rma.view_rma_line_form", False)
|
res = self.env.ref("rma.view_rma_line_form", False)
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
# choose the view_mode accordingly
|
# choose the view_mode accordingly
|
||||||
if rma_lines and len(rma_lines) != 1:
|
if rma_lines and len(rma_lines) != 1:
|
||||||
result["domain"] = rma_lines.ids
|
result["domain"] = rma_lines.ids
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ class RmaLineMakeSupplierRma(models.TransientModel):
|
|||||||
rma_line_obj.create(rma_line_data)
|
rma_line_obj.create(rma_line_data)
|
||||||
action = self.env.ref("rma.action_rma_supplier_lines")
|
action = self.env.ref("rma.action_rma_supplier_lines")
|
||||||
rma_lines = self.item_ids.mapped("line_id.supplier_rma_line_ids").ids
|
rma_lines = self.item_ids.mapped("line_id.supplier_rma_line_ids").ids
|
||||||
result = action.read()[0]
|
result = action.sudo().read()[0]
|
||||||
result["domain"] = [("id", "in", rma_lines)]
|
result["domain"] = [("id", "in", rma_lines)]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user