Add _json to attachment and commits

This commit is contained in:
Sharoon Thomas 2013-09-07 20:47:59 +05:30
parent 41a8ef8e85
commit 30393243d6
2 changed files with 27 additions and 2 deletions

View File

@ -11,7 +11,8 @@ from trytond.pool import Pool
from project import (
WebSite, ProjectUsers, ProjectInvitation,
TimesheetEmployeeDay, ProjectWorkInvitation, Project, Tag,
TaskTags, ProjectHistory, ProjectWorkCommit, TimesheetLine, Activity
TaskTags, ProjectHistory, ProjectWorkCommit, TimesheetLine, Activity,
Attachment,
)
from company import Company, CompanyProjectAdmins, NereidUser
@ -35,5 +36,6 @@ def register():
Company,
CompanyProjectAdmins,
NereidUser,
Attachment,
module='nereid_project', type_='model',
)

View File

@ -43,7 +43,7 @@ __all__ = [
'WebSite', 'ProjectUsers', 'ProjectInvitation',
'TimesheetEmployeeDay', 'ProjectWorkInvitation', 'Project', 'Tag',
'TaskTags', 'ProjectHistory', 'ProjectWorkCommit', 'TimesheetLine',
'Activity'
'Activity', 'Attachment',
]
__metaclass__ = PoolMeta
@ -2436,6 +2436,14 @@ class ProjectWorkCommit(ModelSQL, ModelView):
})
return 'OK'
def _json(self):
return {
'create_date': self.create_date.isoformat(),
"objectType": self.__name__,
"id": self.id,
"updatedBy": self.nereid_user._json(),
}
@classmethod
def commit_bitbucket_hook_handler(cls):
"""
@ -2609,3 +2617,18 @@ class Activity:
project = fields.Many2One(
'project.work', 'Project', domain=[('type', '=', 'project')]
)
class Attachment:
'''
Ir Attachment
'''
__name__ = "ir.attachment"
def _json(self):
return {
'create_date': self.create_date.isoformat(),
"objectType": self.__name__,
"id": self.id,
"updatedBy": self.updated_by._json(),
}