[FIX] sale: access right for name_get of SOL

Sometimes, we want to give access to sale lines only for some users. But to
allow them to read a SOL, they need the read access of the sale order (as
the name is part of the name_get of SOL), which might break the saleperson
rights. This commit makes the name_get of sOL as  to allow fetching
the name of SOL without having the access right on the order.
This commit is contained in:
jem-odoo
2018-09-05 15:05:46 +02:00
parent a6401391ed
commit 0d16d65eb4
+1 -1
View File
@@ -1387,7 +1387,7 @@ class SaleOrderLine(models.Model):
@api.multi
def name_get(self):
result = []
for so_line in self:
for so_line in self.sudo():
name = '%s - %s' % (so_line.order_id.name, so_line.name.split('\n')[0] or so_line.product_id.name)
if so_line.order_partner_id.ref:
name = '%s (%s)' % (name, so_line.order_partner_id.ref)