Odoo fields. Selection: displays different selection contents based on permissions,
Abstract: As a drop-down option, the content of the selection option is fixed. For some special requirements, you can refer to odoo source code to display different selection content according to the permission group.
Prerequisites: source code based on odoo10.0
Source code 1: odoo-dev/odoo/addons/stock/models/stock. py
Source code 2: odoo-dev/odoo/addons/procurement/models/procurement. py
Note: The red font is my local directory folder.
Stock. py source code:
Procurement. py source code:
Red Warning: if it is related to the permission group, there will be A problem if selection is displayed in this way: If the selection content of the two permission groups A and B are different, however, if B is required to see the content of the selection created by A, the value of the selection created by A is XX, and the value of B is unkonown. An error is returned when you click it.
For reference only: similar to the source code, different selection contents can be displayed in the view based on different permission user groups.
If the description of the article is inappropriate or incorrect, you are welcome to criticize and correct it. If there are other better usage options, please contact us!