Skip to content

Commit fceb259

Browse files
committed
[ADD] web_portal_properties
1 parent 5817d9d commit fceb259

18 files changed

+865
-0
lines changed

web_portal_properties/README.rst

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
=====================
2+
Web Portal Properties
3+
=====================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:78e97cb87d23dcc9399efaa2ef26bdaed9413fd691e1725b324c23c1461a71b7
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
20+
:target: https://github.com/OCA/web/tree/17.0/web_portal_properties
21+
:alt: OCA/web
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_portal_properties
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module creates a new field that can be used to add a new parameter
32+
on field property description. This parameter will allow us to show some
33+
parameters on portal view.
34+
35+
**Table of contents**
36+
37+
.. contents::
38+
:local:
39+
40+
Configuration
41+
=============
42+
43+
Just modify the definition field like
44+
45+
.. code:: python
46+
47+
from odoo import models
48+
49+
from odoo.addons.web_portal_properties.fields import PortalPropertiesDefinition
50+
51+
52+
class ProjectProject(models.Model):
53+
_inherit = "project.project"
54+
55+
task_properties_definition = PortalPropertiesDefinition()
56+
57+
Then, use the widget ``portal_properties`` on your field to allow the
58+
edition for the user.
59+
60+
Finally, on the portal template add this snippet with the right
61+
parameters:
62+
63+
.. code:: xml
64+
65+
<?xml version="1.0" encoding="UTF-8" ?>
66+
<odoo>
67+
<template id="portal_my_task" inherit_id="project.portal_my_task">
68+
<xpath expr="//div[@id='card_body']" position="inside">
69+
70+
<t t-call="web_portal_properties.portal_properties">
71+
<t t-set="properties_record" t-value="task" />
72+
<t t-set="properties_field" t-value="'task_properties'" />
73+
</t>
74+
</xpath>
75+
</template>
76+
</odoo>
77+
78+
Usage
79+
=====
80+
81+
On form view, we will be able to set a new parameter,
82+
``Show in portal``.
83+
84+
|image|
85+
86+
On portal, we will be able to see the parameters.
87+
88+
|image1|
89+
90+
.. |image| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_portal_properties/static/description/form_view.png
91+
.. |image1| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_portal_properties/static/description/portal_view.png
92+
93+
Known issues / Roadmap
94+
======================
95+
96+
97+
98+
Bug Tracker
99+
===========
100+
101+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
102+
In case of trouble, please check there if your issue has already been reported.
103+
If you spotted it first, help us to smash it by providing a detailed and welcomed
104+
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_portal_properties%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
105+
106+
Do not contact contributors directly about support or help with technical issues.
107+
108+
Credits
109+
=======
110+
111+
Authors
112+
-------
113+
114+
* Dixmit
115+
116+
Contributors
117+
------------
118+
119+
- `Dixmit <https://www.dixmit.com>`__
120+
121+
- Enric Tobella
122+
123+
Maintainers
124+
-----------
125+
126+
This module is maintained by the OCA.
127+
128+
.. image:: https://odoo-community.org/logo.png
129+
:alt: Odoo Community Association
130+
:target: https://odoo-community.org
131+
132+
OCA, or the Odoo Community Association, is a nonprofit organization whose
133+
mission is to support the collaborative development of Odoo features and
134+
promote its widespread use.
135+
136+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_portal_properties>`_ project on GitHub.
137+
138+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

web_portal_properties/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import fields
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Web Portal Properties",
6+
"summary": """Add a new field on properties to show them on portal""",
7+
"version": "17.0.1.0.0",
8+
"license": "AGPL-3",
9+
"author": "Dixmit,Odoo Community Association (OCA)",
10+
"website": "https://github.com/OCA/web",
11+
"depends": ["portal"],
12+
"data": ["views/portal_templates.xml"],
13+
"demo": [],
14+
"assets": {
15+
"web.assets_backend": [
16+
"web_portal_properties/static/src/**/*.esm.js",
17+
"web_portal_properties/static/src/**/*.xml",
18+
],
19+
},
20+
}

web_portal_properties/fields.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from odoo import fields
2+
3+
4+
class PortalPropertiesDefinition(fields.PropertiesDefinition):
5+
ALLOWED_KEYS = (
6+
"name",
7+
"string",
8+
"type",
9+
"comodel",
10+
"default",
11+
"selection",
12+
"tags",
13+
"domain",
14+
"view_in_cards",
15+
"view_in_portal",
16+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Just modify the definition field like
2+
3+
```python
4+
from odoo import models
5+
6+
from odoo.addons.web_portal_properties.fields import PortalPropertiesDefinition
7+
8+
9+
class ProjectProject(models.Model):
10+
_inherit = "project.project"
11+
12+
task_properties_definition = PortalPropertiesDefinition()
13+
14+
```
15+
16+
Then, use the widget `portal_properties` on your field to allow the edition for the user.
17+
18+
Finally, on the portal template add this snippet with the right parameters:
19+
20+
```xml
21+
<?xml version="1.0" encoding="UTF-8" ?>
22+
<odoo>
23+
<template id="portal_my_task" inherit_id="project.portal_my_task">
24+
<xpath expr="//div[@id='card_body']" position="inside">
25+
26+
<t t-call="web_portal_properties.portal_properties">
27+
<t t-set="properties_record" t-value="task" />
28+
<t t-set="properties_field" t-value="'task_properties'" />
29+
</t>
30+
</xpath>
31+
</template>
32+
</odoo>
33+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [Dixmit](https://www.dixmit.com)
2+
- Enric Tobella
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module creates a new field that can be used to add a new parameter on field property description.
2+
This parameter will allow us to show some parameters on portal view.

web_portal_properties/readme/ROADMAP.md

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
On form view, we will be able to set a new parameter, `Show in portal`.
2+
3+
![image](../static/description/form_view.png)
4+
5+
On portal, we will be able to see the parameters.
6+
7+
![image](../static/description/portal_view.png)

0 commit comments

Comments
 (0)