You can define a new widget that inherits the many2manyattendee
to color tags based on the attendee state
field
You will need to define the name of the color field and set its value for each attendee (tag)
Example: (many2manyattendee.js)
/** @odoo-module **/
import fieldRegistry from 'web.field_registry';
import relationalFields from 'web.relational_fields';
const STATE_SELECTION = new Map([
['needsAction', 0],
['tentative', 2],
['declined', 1],
['accepted', 10]
]);
const Many2ManyAttendeeColored = fieldRegistry.get("many2manyattendee").extend({
_renderTags: function () {
var self = this;
var context = this._getRenderTagsContext();
this.colorField = 'state_index';
context.elements.forEach(function(item) {
item[self.colorField] = STATE_SELECTION.get(self.record.specialData.partner_ids.find(partner => partner.id === item.id).status);
});
this._super.apply(this, arguments);
},
});
fieldRegistry.add('many2many_attendee_colored', Many2ManyAttendeeColored);
To load the JS code, add the following entry to the manifest file:
'assets': {
'web.assets_backend': [
'MODULE_NAME/static/src/js/many2manyattendee.js',
],
}
To use it, change the widget on the partners' field to many2many_attendee_colored