From 56254bf21c5eabeab86fcaf160cad09ae706e4da Mon Sep 17 00:00:00 2001 From: zainab2097 <149927291+zainab2097@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:52:19 +0300 Subject: [PATCH] Update and rename account_move.py to account_move --- .../models/{account_move.py => account_move} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename odex25_project/account_attachments/models/{account_move.py => account_move} (90%) 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'] = [