diff --git a/addons/event/models/event_event.py b/addons/event/models/event_event.py
index 40f29276f66..4219c4bd4de 100644
--- a/addons/event/models/event_event.py
+++ b/addons/event/models/event_event.py
@@ -140,6 +140,8 @@ class EventEvent(models.Model):
tag_ids = fields.Many2many(
'event.tag', string="Tags", readonly=False,
store=True, compute="_compute_tag_ids")
+ # properties
+ registration_properties_definition = fields.PropertiesDefinition('Registration Properties')
# Kanban fields
kanban_state = fields.Selection([('normal', 'In Progress'), ('done', 'Done'), ('blocked', 'Blocked')], default='normal', copy=False)
kanban_state_label = fields.Char(
@@ -197,7 +199,6 @@ class EventEvent(models.Model):
start_sale_datetime = fields.Datetime(
'Start sale date', compute='_compute_start_sale_date',
help='If ticketing is used, contains the earliest starting sale date of tickets.')
-
# Date fields
date_tz = fields.Selection(
_tz_get, string='Timezone', required=True,
diff --git a/addons/event/models/event_registration.py b/addons/event/models/event_registration.py
index fc3f002497d..f319038088f 100644
--- a/addons/event/models/event_registration.py
+++ b/addons/event/models/event_registration.py
@@ -37,7 +37,6 @@ class EventRegistration(models.Model):
'event.event.ticket', string='Event Ticket', ondelete='restrict')
active = fields.Boolean(default=True)
barcode = fields.Char(string='Barcode', default=lambda self: self._get_random_barcode(), readonly=True, copy=False)
-
# utm informations
utm_campaign_id = fields.Many2one('utm.campaign', 'Campaign', index=True, ondelete='set null')
utm_source_id = fields.Many2one('utm.source', 'Source', index=True, ondelete='set null')
@@ -66,9 +65,14 @@ class EventRegistration(models.Model):
('draft', 'Unconfirmed'), ('cancel', 'Cancelled'),
('open', 'Confirmed'), ('done', 'Attended')],
string='Status', default='draft', readonly=True, copy=False, tracking=6)
+ # properties
+ registration_properties = fields.Properties(
+ 'Properties', definition='event_id.registration_properties_definition', copy=True)
+
_sql_constraints = [
('barcode_event_uniq', 'unique(barcode)', "Barcode should be unique")
]
+
@api.depends('partner_id')
def _compute_name(self):
for registration in self:
diff --git a/addons/event/views/event_registration_views.xml b/addons/event/views/event_registration_views.xml
index 470c8acc5df..8ee5bce1001 100644
--- a/addons/event/views/event_registration_views.xml
+++ b/addons/event/views/event_registration_views.xml
@@ -83,6 +83,7 @@
+
diff --git a/addons/fleet/data/fleet_data.xml b/addons/fleet/data/fleet_data.xml
index 395c8cd65c4..3f87f150199 100644
--- a/addons/fleet/data/fleet_data.xml
+++ b/addons/fleet/data/fleet_data.xml
@@ -13,14 +13,6 @@
-
- Add Properties
- fleet.vehicle
- action_configure_properties_field
-
- form
-
-
New Request
4
diff --git a/addons/fleet/views/fleet_vehicle_views.xml b/addons/fleet/views/fleet_vehicle_views.xml
index 474f300d826..84d94c60811 100644
--- a/addons/fleet/views/fleet_vehicle_views.xml
+++ b/addons/fleet/views/fleet_vehicle_views.xml
@@ -112,8 +112,7 @@
-
+
diff --git a/addons/project/__manifest__.py b/addons/project/__manifest__.py
index aa37bcfd017..dd2db436234 100644
--- a/addons/project/__manifest__.py
+++ b/addons/project/__manifest__.py
@@ -24,7 +24,6 @@
'security/ir.model.access.csv',
'security/ir.model.access.xml',
'data/digest_data.xml',
- 'data/ir_actions_client_data.xml',
'report/project_task_burndown_chart_report_views.xml',
'views/account_analytic_account_views.xml',
'views/digest_digest_views.xml',
diff --git a/addons/project/data/ir_actions_client_data.xml b/addons/project/data/ir_actions_client_data.xml
deleted file mode 100644
index 3cd1414f935..00000000000
--- a/addons/project/data/ir_actions_client_data.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- Add Properties
- project.task
- action_configure_properties_field
-
- form
-
-
diff --git a/addons/project/views/project_task_views.xml b/addons/project/views/project_task_views.xml
index 168c2ebb2dd..a9cf8f9a7fc 100644
--- a/addons/project/views/project_task_views.xml
+++ b/addons/project/views/project_task_views.xml
@@ -372,8 +372,7 @@
-
+
diff --git a/addons/web/static/src/views/fields/properties/properties_field.js b/addons/web/static/src/views/fields/properties/properties_field.js
index 7c6c910c8c5..e0e829f3475 100644
--- a/addons/web/static/src/views/fields/properties/properties_field.js
+++ b/addons/web/static/src/views/fields/properties/properties_field.js
@@ -8,7 +8,7 @@ import { PropertyDefinition } from "./property_definition";
import { Dropdown } from "@web/core/dropdown/dropdown";
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
import { PropertyValue } from "./property_value";
-import { useService } from "@web/core/utils/hooks";
+import { useBus, useService } from "@web/core/utils/hooks";
import { usePopover } from "@web/core/popover/popover_hook";
import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
import { reposition } from "@web/core/position_hook";
@@ -30,7 +30,7 @@ export class PropertiesField extends Component {
...standardFieldProps,
context: { type: Object, optional: true },
columns: { type: Number, optional: true },
- hideAddButton: { type: Boolean, optional: true },
+ showAddButton: { type: Boolean, optional: true },
hideKanbanOption: { type: Boolean, optional: true },
};
@@ -56,10 +56,17 @@ export class PropertiesField extends Component {
this.state = useState({
canChangeDefinition: true,
movedPropertyName: null,
- hideAddButton: this.props.hideAddButton,
+ showAddButton: this.props.showAddButton,
unfoldedSeparators: this._getUnfoldedSeparators(),
});
+ // Properties can be added from the cogmenu of the form controller
+ if (this.env.config?.viewType === "form") {
+ useBus(this.env.model.bus, "PROPERTY_FIELD:ADD_PROPERTY_VALUE", () => {
+ this.onPropertyCreate();
+ });
+ }
+
onWillStart(async () => {
await this._checkDefinitionAccess();
});
@@ -609,7 +616,7 @@ export class PropertiesField extends Component {
definition_changed: true,
});
this.openPropertyDefinition = newName;
- this.state.hideAddButton = false;
+ this.state.showAddButton = true;
this.props.record.update({ [this.props.name]: propertiesDefinitions });
}
@@ -939,29 +946,10 @@ export const propertiesField = {
return {
context: dynamicInfo.context,
columns: parseInt(attrs.columns || "1"),
- hideAddButton: archParseBoolean(attrs.hideAddButton),
+ showAddButton: archParseBoolean(attrs.showAddButton),
hideKanbanOption: archParseBoolean(attrs.hideKanbanOption),
};
},
};
registry.category("fields").add("properties", propertiesField);
-
-/**
- * This action is meant to be called from a form client action
- * and will let the user create properties, typically used along
- * with the "hideAddButton" option of the properties field.
- *
- * @param {object} env
- */
-async function actionAddProperty(env) {
- const addProperty = document.querySelector(".o_field_property_add button");
- if (addProperty) {
- addProperty.click();
- } else {
- const message = _t("You can not create a new property.");
- env.services.notification.add(message, { type: "danger" });
- }
-}
-
-registry.category("actions").add("action_configure_properties_field", actionAddProperty);
diff --git a/addons/web/static/src/views/fields/properties/properties_field.xml b/addons/web/static/src/views/fields/properties/properties_field.xml
index cf48f2ea65c..911b973edf8 100644
--- a/addons/web/static/src/views/fields/properties/properties_field.xml
+++ b/addons/web/static/src/views/fields/properties/properties_field.xml
@@ -2,7 +2,7 @@
@@ -76,9 +76,9 @@
+ t-att-class="{'g-col-2': props.columns !== 1}">