Skip to content
Snippets Groups Projects
Commit 7ad33dea1d2a authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

Provides a way for other modules to define a message type.

parent 486a0d54fc21
No related branches found
No related tags found
1 merge request!13Provides a way for other modules to define a message type.
Changelog Changelog
========= =========
18.0.2.0.0
----------
* Provide another way for other modules to define a message type.
18.0.1.0.1 18.0.1.0.1
---------- ----------
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"license": "AGPL-3", "license": "AGPL-3",
"summary": "Xbus common elements", "summary": "Xbus common elements",
"icon": "/xbus_common/static/description/icon.svg", "icon": "/xbus_common/static/description/icon.svg",
"version": "18.0.1.0.1", "version": "18.0.2.0.0",
"category": "Technical", "category": "Technical",
"author": "XCG Consulting", "author": "XCG Consulting",
"website": "https://orbeet.io/", "website": "https://orbeet.io/",
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
# is only used to display information # is only used to display information
uid = fields.Char(string="UID", readonly=True) uid = fields.Char(string="UID", readonly=True)
type = fields.Selection([], required=True) type = fields.Selection(selection="_get_type_selection", required=True)
header = fields.Binary(attachment=False) header = fields.Binary(attachment=False)
...@@ -88,6 +88,14 @@ ...@@ -88,6 +88,14 @@
return False return False
return False return False
def _get_type_selection(self) -> list[tuple[str, str]]:
"""Provides a list of message type selection values.
When adding elements, remember to clean up the message table when your
module is uninstalled.
"""
return []
link_ids = fields.One2many( link_ids = fields.One2many(
comodel_name="xbus.message.link", comodel_name="xbus.message.link",
string="Linked Records", string="Linked Records",
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
_inherit = "xbus.message" _inherit = "xbus.message"
type = fields.Selection( def _get_type_selection(self):
selection_add=[ return [
("test_1", "Test Message Type 1"), ("test_1", "Test Message Type 1"),
("test_2", "Test Message Type 2"), ("test_2", "Test Message Type 2"),
...@@ -31,5 +31,3 @@ ...@@ -31,5 +31,3 @@
("test_1", "Test Message Type 1"), ("test_1", "Test Message Type 1"),
("test_2", "Test Message Type 2"), ("test_2", "Test Message Type 2"),
], ]
ondelete={"test_1": "cascade", "test_2": "cascade"},
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment