sale_usability: add no-attachment filter on sale.order

account_usability: small code improvement on has_attachment
This commit is contained in:
Alexis de Lattre
2021-05-20 19:29:31 +02:00
parent e70e3b23cf
commit 42e014bcb1
3 changed files with 35 additions and 3 deletions

View File

@@ -50,11 +50,11 @@ class AccountMove(models.Model):
def _compute_has_attachment(self):
iao = self.env['ir.attachment']
for move in self:
if iao.search([
if iao.search_count([
('res_model', '=', 'account.move'),
('res_id', '=', move.id),
('type', '=', 'binary'),
('company_id', '=', move.company_id.id)], limit=1):
('company_id', '=', move.company_id.id)]):
move.has_attachment = True
else:
move.has_attachment = False