Skip to content

Commit

Permalink
[FIX] account: allow xls,xlsx,csv attachment from alias
Browse files Browse the repository at this point in the history
Set up email alias for Vendor Bill journal
Send email with xls attachment to alias
Bill is created
Issue: No attachment is present

This occurs because after 9b735f7
the system will not add binary attachments to the created bill
The change was meant to filter out rogue images often present in emails
but it is too restrictive so this commit add a second check with
the mimetype of the parsed attachment in order to keep useful
attachments

opw-4092311

closes odoo#176004

Signed-off-by: Ricardo Gomes Rodrigues (rigr) <rigr@odoo.com>
  • Loading branch information
agr-odoo committed Aug 22, 2024
1 parent e616648 commit 827b536
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
is_html_empty,
create_index,
)
from odoo.addons.base_import.models.base_import import FILE_TYPE_DICT

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -3152,6 +3153,7 @@ def add_file_data_results(file_data, invoice):
file_data['type'] == 'binary'
and self._context.get('from_alias')
and not attachments_by_invoice.get(file_data['attachment'])
and file_data['attachment'].mimetype not in FILE_TYPE_DICT
):
close_file(file_data)
continue
Expand Down Expand Up @@ -3189,7 +3191,7 @@ def add_file_data_results(file_data, invoice):
invoice = current_invoice or self.create({})
success = decoder(invoice, file_data, new)

if success or file_data['type'] == 'pdf':
if success or file_data['type'] == 'pdf' or file_data['attachment'].mimetype in FILE_TYPE_DICT:
invoice._link_bill_origin_to_purchase_orders(timeout=4)
invoices |= invoice
current_invoice = self.env['account.move']
Expand Down

0 comments on commit 827b536

Please sign in to comment.