Skip to content

Commit 0b416f2

Browse files
committed
[FIX] accounting_firm: fix review 21/10
1 parent 18397e7 commit 0b416f2

File tree

7 files changed

+79
-5
lines changed

7 files changed

+79
-5
lines changed

accounting_firm/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'data/ir_model_fields.xml',
2424
'data/ir_default.xml',
2525
'data/ir_actions_server.xml',
26+
'data/base_automation.xml',
2627
'data/ir_cron.xml',
2728
'data/ir_ui_view.xml',
2829
'data/ir_actions_act_window.xml',
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<odoo>
3+
<record id="base_automation_on_id_scan_changed" model="base.automation">
4+
<field name="name">Accounting Firm: On ID Scan Changed</field>
5+
<field name="action_server_ids" eval="[(6, 0, [ref('server_action_keep_scan_in_chatter')])]"/>
6+
<field name="model_id" ref="base.model_res_partner"/>
7+
<field name="on_change_field_ids" eval="[(6, 0, [ref('x_id_scan_field_res_partner')])]"/>
8+
<field name="trigger">on_change</field>
9+
</record>
10+
</odoo>

accounting_firm/data/ir_actions_server.xml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 ={
4747
for 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+
)
5057
action = {
5158
'type': 'ir.actions.client',
5259
'tag': 'display_notification',
@@ -65,6 +72,43 @@ action = {
6572
doc = record.request_document()
6673
doc['x_is_identity_document_request'] = True
6774
record.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>

accounting_firm/data/ir_cron.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ for contact in model.search([('x_id_expiration_date', '!=', False)]):
1313
"folder_id": 2,
1414
"res_id": contact.id or False,
1515
"res_model": env.context.get("default_res_model", False),
16-
"name": "Identity Document " + contact.name,
16+
"name": "Identity Document - " + contact.name,
1717
"requestee_id": contact.id,
1818
"partner_id": contact.id,
1919
"activity_date_deadline_range": 7,

accounting_firm/data/ir_ui_view.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,22 @@
183183
</field>
184184
</record>
185185

186+
<!-- Documents Document views-->
187+
<record id="document_document_kanban_view_inherited" model="ir.ui.view">
188+
<field name="name">documents.document.kanban.view.inherited</field>
189+
<field name="model">documents.document</field>
190+
<field name="type">kanban</field>
191+
<field name="inherit_id" ref="documents.document_view_kanban"/>
192+
<field name="active" eval="True"/>
193+
<field name="arch" type="xml">
194+
<xpath expr="/kanban//field[@name='id']" position="before">
195+
<header>
196+
<button name="%(server_action_update_document_partner_identity)d" string="Update Identity Document" type="action" />
197+
</header>
198+
</xpath>
199+
</field>
200+
</record>
201+
186202
<!-- Documents Request Wizard -->
187203
<record id="document_request_wizard_form_view_inherited" model="ir.ui.view">
188204
<field name="name">documents.request.wizard.form.view.inherited</field>

accounting_firm/data/knowledge_article.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ Otherwise, open the <strong>Sales App</strong> and create a new quote.
9292
</div>
9393
</div>
9494
<p>&#xFEFF;<a href="https://www.odoo.com/documentation/latest/applications/sales/sales.html" class="btn btn-secondary">&#xFEFF;🎓 Sales&#xFEFF;</a>&#xFEFF;</p>
95-
<h3>Customer identity management</h3>
95+
<p>
96+
<strong>Customer identity management</strong>
97+
</p>
9698
<p>Identity management is a must do activity in your business and to support you with that, the contacts encompass all the necessary.</p>
9799
<ul>
98100
<li>
@@ -125,7 +127,9 @@ Otherwise, open the <strong>Sales App</strong> and create a new quote.
125127
</div>
126128
</div>
127129
<p>&#xFEFF;<a href="https://www.odoo.com/documentation/latest/applications/essentials/contacts.html" class="btn btn-secondary">&#xFEFF;🎓 Contacts&#xFEFF;</a>&#xFEFF;</p>
128-
<h3>Setup the project</h3>
130+
<p>
131+
<strong>Setup the project</strong>
132+
</p>
129133
<p>The project creation created as well some tasks to handle from now on.</p>
130134
<ul>
131135
<li>

accounting_firm/demo/sale_order_post_action.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,4 @@
4141
<function model="base.automation" name="unlink">
4242
<value model="base.automation" eval="obj().search([('id', 'in', [ref('accounting_firm.base_automation_1'), ref('accounting_firm.base_automation_2')])]).ids"/>
4343
</function>
44-
<function name="button_immediate_uninstall" model="ir.module.module" eval="[ref('base.module_web_studio', raise_if_not_found=False)]"/>
4544
</odoo>

0 commit comments

Comments
 (0)