[IMP] website_event_track: allow archiving of event sponsors

Before this commit, event sponsors could not be archived, only deleted.
Now, users are able to archive event sponsors if they want to set them
as inactive but do not wish to delete them from the database.

A filter was also added in the Event Sponsor view to quickly retrieve
archived records. Also, archived sponsors will show an "Archived" ribbon
in their form view.

Task: 2205443
This commit is contained in:
dmonzonis
2020-04-01 07:06:04 +00:00
committed by dmonzonis
parent 707522cb01
commit e84bd187e0
2 changed files with 4 additions and 0 deletions
@@ -31,6 +31,7 @@ class Sponsor(models.Model):
sequence = fields.Integer('Sequence')
image_128 = fields.Image(
string="Logo", related='partner_id.image_128', store=True, readonly=False)
active = fields.Boolean(default=True)
def _message_get_suggested_recipients(self):
recipients = super(Sponsor, self)._message_get_suggested_recipients()
@@ -42,6 +42,7 @@
<search string="Event Sponsors">
<field name="partner_id"/>
<field name="event_id"/>
<filter string="Archived" name="archived" domain="[('active', '=', False)]"/>
</search>
</field>
</record>
@@ -52,6 +53,8 @@
<field name="arch" type="xml">
<form>
<sheet>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="active" invisible="1"/>
<field name="image_128" widget="image" class="oe_avatar"/>
<h1><field name="partner_id"/></h1>
<group>