Skip to content

Commit 4a6f00c

Browse files
[FIX] price_security_sale_margin: hide margin and margin_percent for price-restricted users
X-original-commit: 7420b7f
1 parent f520a6e commit 4a6f00c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

price_security_sale_margin/models/sale_order.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ def _get_view(self, view_id=None, view_type="form", **options):
2222
modifiers["readonly"] = True
2323
node.set("modifiers", json.dumps(modifiers))
2424
if self.env.user.has_group("price_security.group_only_view_sale_price"):
25-
invisible_fields = (
26-
arch.xpath("//field[@name='purchase_price']")
27-
+ arch.xpath("//field[@name='margin']")
28-
+ arch.xpath("//field[@name='margin_percent']")
29-
+ arch.xpath("//field[@name='margin_percent']/..")
25+
invisible_fields = arch.xpath(
26+
"//field[@name='purchase_price']"
27+
"|//field[@name='order_line']//field[@name='margin']"
28+
"|//field[@name='order_line']//field[@name='margin_percent']"
29+
"|//div[@class='d-flex float-end']"
3030
)
3131
for node in invisible_fields:
32-
node.set("column_invisible", "1")
32+
node.set("invisible", "1")
3333
modifiers = json.loads(node.get("modifiers") or "{}")
34-
modifiers["column_invisible"] = True
34+
modifiers["invisible"] = True
3535
node.set("modifiers", json.dumps(modifiers))
3636
return arch, view

0 commit comments

Comments
 (0)