diff --git a/odex25_project/account_attachments/models/account_move.py b/odex25_project/account_attachments/models/account_move similarity index 90% rename from odex25_project/account_attachments/models/account_move.py rename to odex25_project/account_attachments/models/account_move index 01bd4c22e..8fee250ad 100755 --- a/odex25_project/account_attachments/models/account_move.py +++ b/odex25_project/account_attachments/models/account_move @@ -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'] = [