Fix strings, setup.py and pyflakes.
This commit is contained in:
parent
6aae5b1bc0
commit
f5268570cd
21
activity.py
21
activity.py
|
@ -2,17 +2,13 @@
|
||||||
#the top level of this repository contains the full copyright notices and
|
#the top level of this repository contains the full copyright notices and
|
||||||
#license terms.
|
#license terms.
|
||||||
|
|
||||||
from trytond.model import ModelSQL, ModelView, fields
|
from trytond.model import ModelView, fields
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.transaction import Transaction
|
|
||||||
|
|
||||||
|
|
||||||
__metaclass__ = PoolMeta
|
__metaclass__ = PoolMeta
|
||||||
|
|
||||||
__all__ = ['Activity']
|
__all__ = ['Activity']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Activity:
|
class Activity:
|
||||||
'Activity'
|
'Activity'
|
||||||
__name__ = "activity.activity"
|
__name__ = "activity.activity"
|
||||||
|
@ -24,11 +20,10 @@ class Activity:
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(Activity, cls).__setup__()
|
super(Activity, cls).__setup__()
|
||||||
cls._error_messages.update({
|
cls._error_messages.update({
|
||||||
'no_calendar_selected': ('Please select calendar for Activity '
|
'no_calendar_selected': ('Please select calendar for activity '
|
||||||
' %s before create an event'),
|
'%s before creating an event.'),
|
||||||
'already_event': ('Activity %s has already and Event'),
|
'already_event': 'Activity %s already has an event.',
|
||||||
})
|
})
|
||||||
|
|
||||||
cls._buttons.update({
|
cls._buttons.update({
|
||||||
'create_calendar_event': {},
|
'create_calendar_event': {},
|
||||||
})
|
})
|
||||||
|
@ -37,14 +32,11 @@ class Activity:
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
def create_calendar_event(cls, activities):
|
def create_calendar_event(cls, activities):
|
||||||
Event = Pool().get('calendar.event')
|
Event = Pool().get('calendar.event')
|
||||||
events = []
|
|
||||||
for activity in activities:
|
for activity in activities:
|
||||||
if activity.calendar_event:
|
if activity.calendar_event:
|
||||||
cls.raise_user_error('already_event',
|
cls.raise_user_error('already_event', activity.rec_name)
|
||||||
(activity.rec_name,))
|
|
||||||
if not activity.calendar:
|
if not activity.calendar:
|
||||||
cls.raise_user_error('no_calendar_selected',
|
cls.raise_user_error('no_calendar_selected', activity.rec_name)
|
||||||
(activity.rec_name,))
|
|
||||||
|
|
||||||
event = Event()
|
event = Event()
|
||||||
event.dtstart = activity.dtstart
|
event.dtstart = activity.dtstart
|
||||||
|
@ -56,4 +48,3 @@ class Activity:
|
||||||
|
|
||||||
activity.calendar_event=event
|
activity.calendar_event=event
|
||||||
activity.save()
|
activity.save()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue