[IMP] event,website_event_questions: improve attendees list view

In this commit we have improved the attendees list
view, changes done are listed below,

- We have changed the cancel button
  color to red in attendees list view.

- We have added badge widget for the
  state field in attendees list view, the following
  states uses these colors,

  - draft - blue
  - cancel - grey
  - open - blue
  - done - green

- We have added a `activity_ids` before the field `state`
  field in attendees list view.

- We have added the field `registration_answer_ids` with
  `many2many_tags` and default hide in attendees list view
  just before the status field.

TaskID-2670765

Part-of: odoo/odoo#79166
This commit is contained in:
ijas ahammed
2021-11-30 12:52:16 +00:00
parent 0900675903
commit bf0bb8497e
4 changed files with 36 additions and 2 deletions
+9
View File
@@ -24,3 +24,12 @@
}
}
}
.o_event_registration_view_tree {
.o_list_button > .o_btn_cancel_registration {
color: $danger;
&:hover {
color: darken($danger, $emphasized-link-hover-darken-percentage);
}
}
}
+7 -2
View File
@@ -510,12 +510,17 @@
<field name="mobile" optional="hide"/>
<field name="event_id" invisible="context.get('default_event_id')"/>
<field name="event_ticket_id" domain="[('event_id', '=', event_id)]"/>
<field name="state" readonly="0"/>
<field name="activity_ids" widget="list_activity"/>
<field name="state" decoration-info="state in ('draft', 'open')"
decoration-success="state == 'done'"
decoration-muted="state == 'cancel'" widget="badge"/>
<field name="company_id" groups="base.group_multi_company" optional="hide"/>
<field name="message_needaction" invisible="1"/>
<button name="action_confirm" string="Confirm" states="draft" type="object" icon="fa-check"/>
<button name="action_set_done" string="Mark as Attending" states="open" type="object" icon="fa-level-down"/>
<button name="action_cancel" string="Cancel" states="draft,open" type="object" icon="fa-times"/>
<button name="action_cancel" string="Cancel"
states="draft,open" type="object"
class="o_btn_cancel_registration" icon="fa-times"/>
<field name="activity_exception_decoration" widget="activity_exception"/>
</tree>
</field>
@@ -28,3 +28,12 @@ class EventRegistrationAnswer(models.Model):
_sql_constraints = [
('value_check', "CHECK(value_answer_id IS NOT NULL OR COALESCE(value_text_box, '') <> '')", "There must be a suggested value or a text value.")
]
# for displaying selected answers by attendees in attendees list view
def name_get(self):
return [
(reg.id,
reg.value_answer_id.name if reg.question_type == "simple_choice" else reg.value_text_box
)
for reg in self
]
@@ -24,4 +24,15 @@
</sheet>
</field>
</record>
<record id="event_registration_view_tree" model="ir.ui.view">
<field name="name">event.registration.view.tree.inherit.website.event.questions</field>
<field name="model">event.registration</field>
<field name="inherit_id" ref="event.view_event_registration_tree"/>
<field name="arch" type="xml">
<field name="state" position="before">
<field name="registration_answer_ids" string="Selected Answers" widget="many2many_tags" optional="hide"/>
</field>
</field>
</record>
</odoo>