Update and rename account_move.py to account_move

This commit is contained in:
zainab2097 2024-09-09 16:52:19 +03:00 committed by GitHub
parent fe8e2638c6
commit 56254bf21c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -4,6 +4,8 @@ class AccountMove(models.Model):
_inherit = "account.move"
attach_no = fields.Integer(compute='get_attachments')
res_model = fields.Char()
res_id = fields.Integer()
# def get_attachments(self):
# action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
@ -19,13 +21,13 @@ class AccountMove(models.Model):
# Prepare domain for attachments related to account.move and project.invoice
account_move_ids = self.ids # IDs of account.move
# Get all related project.invoice records based on the invoice_id
project_invoice_ids = self.env['project.invoice'].search([('invoice_id', 'in', account_move_ids)]).ids
# project_invoice_ids = self.env['project.invoice'].search([('invoice_id', 'in', account_move_ids)]).ids
# Expand the domain to include both account.move and project.invoice attachments
# Combine account.move and project.invoice ids
related_ids = account_move_ids + project_invoice_ids
related_ids = account_move_ids + [res_id]
action['domain'] = [
('res_model', 'in', ['account.move', 'project.invoice']),
('res_model', 'in', ['account.move', self.res_model]),
('res_id', 'in', related_ids),]
# action['domain'] = [