Skip to content

Commit 9d60213

Browse files
author
Miracle Ayomir
committed
record_keeping_attachment: add fields on attachment to keep connection
1 parent 62db406 commit 9d60213

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

record_keeping_attachment/models/attachment.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,46 @@
44

55
class Attachment(models.Model):
66
_name = 'ir.attachment'
7-
_inherit = ['ir.attachment', 'mail.thread', 'rk.document.mixin']
7+
_inherit = ['ir.attachment', 'mail.thread'] # 'rk.document.mixin'
8+
9+
# Add document_id directly without the mixin
10+
document_id = fields.Many2one(
11+
'rk.document',
12+
string='Document',
13+
help='The record-keeping document id',
14+
ondelete='restrict',
15+
auto_join=True,
16+
copy=False,
17+
index=True
18+
)
19+
20+
# Related fields from document
21+
classification_id = fields.Many2one(
22+
'rk.classification',
23+
related='document_id.classification_id',
24+
store=True,
25+
readonly=False
26+
)
27+
28+
document_type_id = fields.Many2one(
29+
'rk.document.type',
30+
related='document_id.document_type_id',
31+
store=True,
32+
readonly=False
33+
)
34+
35+
matter_id = fields.Many2one(
36+
'rk.matter',
37+
related='document_id.matter_id',
38+
store=True,
39+
readonly=False
40+
)
41+
42+
is_official = fields.Boolean(
43+
related='document_id.is_official',
44+
store=True,
45+
readonly=False
46+
)
847

948
rk_file_name = fields.Char(string="Original file Name", readonly=True)
1049

0 commit comments

Comments
 (0)