Additions to the events application
This commit is contained in:
parent
af22a94b1d
commit
43a5a9be06
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -65,3 +65,28 @@ msgstr ""
|
|||
#: model_terms:ir.ui.view,arch_db:odex25_website_event_track_gantt.event_track_view_gantt
|
||||
msgid "Tracks"
|
||||
msgstr ""
|
||||
|
||||
#. module: event
|
||||
#: model:ir.model.fields,field_description:event.field_event_event__address_id
|
||||
msgid "Venue"
|
||||
msgstr "مكان الفعاليه"
|
||||
|
||||
#. module: odex25_website_event_track_gantt
|
||||
#: model:ir.model.fields,field_description:odex25_website_event_track_gantt.field_event_event__Description_event
|
||||
msgid "Description event"
|
||||
msgstr "وصف الفعاليه"
|
||||
|
||||
#. module: odex25_website_event_track_gantt
|
||||
#: model:ir.model.fields,field_description:odex25_website_event_track_gantt.field_event_event__link
|
||||
msgid "Event website link"
|
||||
msgstr " رابط موقع الفعاليه"
|
||||
|
||||
#. module: odex25_website_event_track_gantt
|
||||
#: model:ir.model.fields,field_description:odex25_website_event_track_gantt.field_event_event__remaining_days
|
||||
msgid "Remaining Days"
|
||||
msgstr "الأيام المتبقية"
|
||||
|
||||
#. module: odex25_website_event_track_gantt
|
||||
#: model:ir.model.fields,field_description:odex25_website_event_track_gantt.field_event_event__remaining_hours
|
||||
msgid "Remaining Time"
|
||||
msgstr "الوقت المتبقي"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,31 @@ class Event(models.Model):
|
|||
# Initial date and scale of the track gantt view
|
||||
track_gantt_initial_date = fields.Date(compute='_compute_track_gantt_information')
|
||||
track_gantt_scale = fields.Char(compute='_compute_track_gantt_information')
|
||||
remaining_days = fields.Integer(string='Remaining Days', compute='_compute_remaining_time', store=True)
|
||||
remaining_hours = fields.Char(string='Remaining Time', compute='_compute_remaining_time', store=True)
|
||||
Description_event = fields.Text(string='Description event')
|
||||
link = fields.Char(string='Event website link', readonly=False)
|
||||
address_id = fields.Many2one(
|
||||
'res.partner', string='Venue', default=lambda self: self.env.company.partner_id.id,
|
||||
tracking=True, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
|
||||
|
||||
@api.depends('date_begin', 'date_end')
|
||||
def _compute_remaining_time(self):
|
||||
now = fields.Datetime.now()
|
||||
for record in self:
|
||||
if record.date_end and now < record.date_end:
|
||||
delta = record.date_end - now
|
||||
total_seconds = delta.total_seconds()
|
||||
record.remaining_days = int(total_seconds // (24 * 3600))
|
||||
remaining_seconds_after_days = total_seconds % (24 * 3600)
|
||||
hours = int(remaining_seconds_after_days // 3600)
|
||||
minutes = int((remaining_seconds_after_days % 3600) // 60)
|
||||
seconds = int(remaining_seconds_after_days % 60)
|
||||
|
||||
record.remaining_hours = f"{hours:02}:{minutes:02}:{seconds:02}"
|
||||
else:
|
||||
record.remaining_days = 0
|
||||
record.remaining_hours = "00:00:00"
|
||||
|
||||
@api.depends('track_ids.date', 'track_ids.date_end', 'date_begin', 'date_end')
|
||||
def _compute_track_gantt_information(self):
|
||||
|
|
|
|||
|
|
@ -9,14 +9,24 @@
|
|||
<field name="track_gantt_initial_date" invisible="1"/>
|
||||
<field name="track_gantt_scale" invisible="1"/>
|
||||
<button
|
||||
name="%(website_event_track.action_event_track_from_event)d"
|
||||
type="action"
|
||||
class="oe_stat_button"
|
||||
icon="fa-microphone"
|
||||
context="{'default_date': date_begin, 'initialDate': track_gantt_initial_date, 'default_scale': track_gantt_scale}">
|
||||
name="%(website_event_track.action_event_track_from_event)d"
|
||||
type="action"
|
||||
class="oe_stat_button"
|
||||
icon="fa-microphone"
|
||||
context="{'default_date': date_begin, 'initialDate': track_gantt_initial_date, 'default_scale': track_gantt_scale}">
|
||||
<field name="track_count" string="Tracks" widget="statinfo"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='date_tz']" position="before">
|
||||
<field name="remaining_days"/>
|
||||
<field name="remaining_hours"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='tag_ids']" position="after">
|
||||
<field name="Description_event"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='address_id']" position="after">
|
||||
<field name="link"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
|
|||
Loading…
Reference in New Issue