Add mail_content field
This commit is contained in:
parent
4401086dc5
commit
4d46d81fb8
|
@ -46,6 +46,7 @@ class Activity(metaclass=PoolMeta):
|
|||
#related_activity = fields.Many2One('activity.activity', 'Related activity',
|
||||
# domain=[('id', 'in', Eval('resource.activities', []))], depends=['resource'])
|
||||
related_activity = fields.Many2One('activity.activity', 'Related activity')
|
||||
mail_content = fields.Function(fields.Binary('Mail Content'), 'get_mail_content')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -92,12 +93,18 @@ class Activity(metaclass=PoolMeta):
|
|||
return result
|
||||
|
||||
@classmethod
|
||||
def get_have_mail(self, activities, name):
|
||||
def get_have_mail(cls, activities, name):
|
||||
result = {}
|
||||
for activity in activities:
|
||||
result[activity.id] = activity.mail and True or False
|
||||
return result
|
||||
|
||||
def get_mail_content(self, name):
|
||||
pool = Pool()
|
||||
ElectronicMail = pool.get('electronic.mail')
|
||||
if isinstance(self.origin, ElectronicMail):
|
||||
return self.origin.preview
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def new(cls, activities):
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
<xpath expr="/form/group[@id='buttons']" position="inside">
|
||||
<button name="guess"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook" position="inside">
|
||||
<page name="mail_content">
|
||||
<field name="mail_content" widget="document" colspan="4" height="400"/>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="/form/label[@name='state']" position="replace" />
|
||||
<xpath expr="/form/field[@name='state']" position="replace">
|
||||
<group id="state" colspan="4" col="6">
|
||||
|
|
Loading…
Reference in New Issue