diff --git a/odex25_project/account_attachments/models/account_move b/odex25_project/account_attachments/models/account_move
index 9922d62bc..185a95bd3 100755
--- a/odex25_project/account_attachments/models/account_move
+++ b/odex25_project/account_attachments/models/account_move
@@ -1,11 +1,45 @@
-from odoo import api, fields, models, _
+# -*- coding: utf-8 -*-
+from odoo import api, fields, models
class AccountMove(models.Model):
- _inherit = "account.move"
+
+ _inherit = 'account.move'
attach_no = fields.Integer(compute='get_attachments')
- res_model = fields.Char()
res_id = fields.Integer()
+ res_model = fields.Char()
+
+ def get_attachments(self):
+ self.ensure_one()
+
+ action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
+ action['domain'] = [
+ ('res_model', '=', 'account.move'),
+ ('res_id', 'in',self.ids), ]
+ domain = [
+ ('res_model', '=', 'account.move'),
+ ('res_id', 'in', self.ids), ]
+ related_ids = self.ids
+ related_models = 'account.move'
+
+ if self.res_id and self.res_model:
+ related_ids = self.ids + [self.res_id]
+ related_models = ['account.move', self.res_model]
+ action['domain'] = [
+ ('res_model', 'in', related_models),
+ ('res_id', 'in', related_ids), ]
+ domain = [
+ ('res_model', 'in', related_models),
+ ('res_id', 'in', related_ids), ]
+
+ # Context for creating new attachments
+ action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
+ # Update attachment count for smart button
+
+
+ self.attach_no = self.env['ir.attachment'].search_count(domain)
+
+ return action
# def get_attachments(self):
# action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
@@ -14,30 +48,3 @@ class AccountMove(models.Model):
# domain = [('res_model', '=', 'account.move'), ('res_id', '=', self.id)]
# self.attach_no = self.env['ir.attachment'].search_count(domain)
# return action
-
- def get_attachments(self):
- self.ensure_one()
-
- action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
- related_ids = self.ids
- related_models = 'account.move'
-
- if self.res_id and self.res_model:
- related_ids = self.ids + [res_id]
- related_models = ['account.move', self.res_model]
-
- action['domain'] = [
- ('res_model', 'in',related_models),
- ('res_id', 'in', related_ids),]
-
- # Context for creating new attachments
- action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
- # Update attachment count for smart button
- domain = [
- ('res_model', 'in', related_models),
- ('res_id', 'in', related_ids),]
-
- self.attach_no = self.env['ir.attachment'].search_count(domain)
-
- return action
-
diff --git a/odex25_project/account_attachments/views/account_move_view.xml b/odex25_project/account_attachments/views/account_move_view.xml
index 264fe0518..ecdb45c71 100755
--- a/odex25_project/account_attachments/views/account_move_view.xml
+++ b/odex25_project/account_attachments/views/account_move_view.xml
@@ -12,13 +12,12 @@
-
-
-
-
-
+
+
+
+
+
-