@@ -11,6 +11,8 @@ export class Activity {
1111 summary : string ;
1212 dateDeadlineStr : string ;
1313 dateDeadlineTimestamp : number ;
14+ resId : string ;
15+ resModel : string ;
1416 resName : string ;
1517
1618 /**
@@ -22,6 +24,8 @@ export class Activity {
2224 activity . summary = values . summary ;
2325 activity . dateDeadlineStr = values . dateDeadlineStr ;
2426 activity . dateDeadlineTimestamp = values . dateDeadlineTimestamp ;
27+ activity . resId = values . resId ;
28+ activity . resModel = values . resModel ;
2529 activity . resName = values . resName ;
2630 return activity ;
2731 }
@@ -35,12 +39,16 @@ export class Activity {
3539 activity . summary = values . summary ;
3640 activity . dateDeadlineStr = values . date_deadline_str ;
3741 activity . dateDeadlineTimestamp = values . date_deadline_timestamp ;
42+ activity . resId = values . res_id ;
43+ activity . resModel = values . res_model ;
3844 activity . resName = values . res_name ;
3945 return activity ;
4046 }
4147
4248 static getActivities ( ) : [ string , Activity [ ] ] [ ] | null {
43- const url = PropertiesService . getUserProperties ( ) . getProperty ( "ODOO_SERVER_URL" ) + URLS . GET_ACTIVITIES ;
49+ const url =
50+ PropertiesService . getUserProperties ( ) . getProperty ( "ODOO_SERVER_URL" ) +
51+ URLS . GET_ACTIVITIES ;
4452 const odooAccessToken = getAccessToken ( ) ;
4553 if ( ! odooAccessToken || ! odooAccessToken ) {
4654 return null ;
@@ -51,26 +59,41 @@ export class Activity {
5159 return null ;
5260 }
5361
54- return response . map ( ( values : any ) => [ values [ 0 ] , values [ 1 ] . map ( ( v ) => Activity . fromOdooResponse ( v ) ) ] ) ;
62+ return response . map ( ( values : any ) => [
63+ values [ 0 ] ,
64+ values [ 1 ] . map ( ( v ) => Activity . fromOdooResponse ( v ) ) ,
65+ ] ) ;
5566 }
5667
5768 /**
5869 * Make a RPC call to the Odoo database to mark as done the activity.
5970 */
6071 markDone ( ) : boolean {
61- const url = PropertiesService . getUserProperties ( ) . getProperty ( "ODOO_SERVER_URL" ) + URLS . DONE_ACTIVITY ;
72+ const url =
73+ PropertiesService . getUserProperties ( ) . getProperty ( "ODOO_SERVER_URL" ) +
74+ URLS . DONE_ACTIVITY ;
6275 const accessToken = getAccessToken ( ) ;
63- const response = postJsonRpc ( url , { activity_id : this . id } , { Authorization : "Bearer " + accessToken } ) ;
76+ const response = postJsonRpc (
77+ url ,
78+ { activity_id : this . id } ,
79+ { Authorization : "Bearer " + accessToken } ,
80+ ) ;
6481 return response ?. ok || false ;
6582 }
6683
6784 /**
6885 * Make a RPC call to the Odoo database to cancel the activity.
6986 */
7087 markCancel ( ) : boolean {
71- const url = PropertiesService . getUserProperties ( ) . getProperty ( "ODOO_SERVER_URL" ) + URLS . CANCEL_ACTIVITY ;
88+ const url =
89+ PropertiesService . getUserProperties ( ) . getProperty ( "ODOO_SERVER_URL" ) +
90+ URLS . CANCEL_ACTIVITY ;
7291 const accessToken = getAccessToken ( ) ;
73- const response = postJsonRpc ( url , { activity_id : this . id } , { Authorization : "Bearer " + accessToken } ) ;
92+ const response = postJsonRpc (
93+ url ,
94+ { activity_id : this . id } ,
95+ { Authorization : "Bearer " + accessToken } ,
96+ ) ;
7497 return response ?. ok || false ;
7598 }
7699
@@ -79,16 +102,25 @@ export class Activity {
79102 * Return the new state of the activities.
80103 */
81104 edit ( summary : string , dateDeadlineTimestamp : number ) : [ string , Activity [ ] ] [ ] | null {
82- const url = PropertiesService . getUserProperties ( ) . getProperty ( "ODOO_SERVER_URL" ) + URLS . EDIT_ACTIVITY ;
105+ const url =
106+ PropertiesService . getUserProperties ( ) . getProperty ( "ODOO_SERVER_URL" ) +
107+ URLS . EDIT_ACTIVITY ;
83108 const accessToken = getAccessToken ( ) ;
84109 const response = postJsonRpc (
85110 url ,
86- { activity_id : this . id , summary, date_deadline_timestamp : Math . floor ( dateDeadlineTimestamp / 1000 ) } ,
111+ {
112+ activity_id : this . id ,
113+ summary,
114+ date_deadline_timestamp : Math . floor ( dateDeadlineTimestamp / 1000 ) ,
115+ } ,
87116 { Authorization : "Bearer " + accessToken } ,
88117 ) ;
89118 if ( ! response ) {
90119 return null ;
91120 }
92- return response . map ( ( values : any ) => [ values [ 0 ] , values [ 1 ] . map ( ( v ) => Activity . fromOdooResponse ( v ) ) ] ) ;
121+ return response . map ( ( values : any ) => [
122+ values [ 0 ] ,
123+ values [ 1 ] . map ( ( v ) => Activity . fromOdooResponse ( v ) ) ,
124+ ] ) ;
93125 }
94126}
0 commit comments