@@ -28,7 +28,7 @@ action ={
2828 "default_folder_id": 2,
2929 "default_res_id": record.id or False,
3030 "default_res_model": env.context.get("default_res_model", False),
31- "default_name": "Identity Document" ,
31+ "default_name": "Identity Document - " + record.name ,
3232 "default_requestee_id": record.id,
3333 "default_partner_id": record.id,
3434 "default_activity_date_deadline_range": 7,
@@ -47,6 +47,13 @@ action ={
4747for ubo in records.filtered('attachment_ids'):
4848 ubo.holder_id['x_id_scan'] = ubo.attachment_ids[-1].datas
4949 ubo.holder_id['x_id_expiration_date'] = ubo.attachment_expiration_date
50+ ubo.holder_id.message_post(
51+ body="The Identity Document Scan changed for this one: ",
52+ attachment_ids=[env['ir.attachment'].create({
53+ 'name': 'Identity Document - ' + ubo.holder_id.name + ' - History',
54+ 'datas': ubo.holder_id.x_id_scan,
55+ }).id]
56+ )
5057action = {
5158 'type': 'ir.actions.client',
5259 'tag': 'display_notification',
@@ -65,6 +72,43 @@ action = {
6572doc = record.request_document()
6673doc['x_is_identity_document_request'] = True
6774record.partner_id.message_post(body="Document request has been sent")
75+ ]]> </field >
76+ </record >
77+ <record id =" server_action_keep_scan_in_chatter" model =" ir.actions.server" >
78+ <field name =" model_id" ref =" base.model_res_partner" />
79+ <field name =" state" >code</field >
80+ <field name =" name" >Keep Scan in Chatter</field >
81+ <field name =" code" ><![CDATA[
82+ for partner in records:
83+ partner.message_post(
84+ body="The Identity Document Scan changed for this one: ",
85+ attachment_ids=[env['ir.attachment'].create({
86+ 'name': 'Identity Document - ' + record.name + ' - History',
87+ 'datas': record.x_id_scan,
88+ }).id]
89+ )
90+ ]]> </field >
91+ </record >
92+ <record id =" server_action_update_document_partner_identity" model =" ir.actions.server" >
93+ <field name =" model_id" ref =" documents.model_documents_document" />
94+ <field name =" state" >code</field >
95+ <field name =" name" >Update Document Partner ID</field >
96+ <field name =" code" ><![CDATA[
97+ for document in records:
98+ document.partner_id['x_id_scan'] = document.attachment_id.datas
99+ document.partner_id.message_post(
100+ body="The Identity Document Scan changed for this one: ",
101+ attachment_ids=[env['ir.attachment'].create({
102+ 'name': 'Identity Document - ' + document.partner_id.name + ' - History',
103+ 'datas': document.partner_id.x_id_scan,
104+ }).id]
105+ )
106+ action = {
107+ 'view_mode': 'form',
108+ 'res_model': 'res.partner',
109+ 'res_id': document.partner_id.id,
110+ 'type': 'ir.actions.act_window',
111+ }
68112]]> </field >
69113 </record >
70114</odoo >
0 commit comments