Skip to content

Conversation

@victoralmau
Copy link
Member

Suitable value of sort_weight in _unwrap_edi_attachments() method if applicable

Example of use case:

  • Create a pdf template linked to invoices.
  • Define an email alias to automatically create the invoices and process the attachments
  • Send an email to the alias with 2 attachments: example.xml and example.pdf

Before:
The _unwrap_edi_attachments() method indirectly applied a lower sort_weight value (10) to the example.xml file than to the example.pdf file (20), which meant that the https://github.com/odoo/odoo/blob/399da69818d22860a808f5416829863f002ad38a/addons/account/models/account_move.py#L3202 condition was met for the example.pdf file and the pdf was not processed correctly (https://github.com/odoo/odoo/blob/399da69818d22860a808f5416829863f002ad38a/addons/account/models/account_move.py#L3215).

After:
The _unwrap_edi_attachments() method modifies the value of sort_weight in .pdf files if there is +1 file and if there is any pdf import template that applies to the corresponding record.

Future:
In v19 (master for now) the process has been improved using the account.document.import.mixin and https://github.com/odoo/odoo/blob/cf4e5b95c34357e5129adf9c78429f7c1a4ea33e/addons/account/models/account_document_import_mixin.py#L318 template.

@Tecnativa TT56274

@victoralmau victoralmau force-pushed the 17.0-imp-base_import_pdf_by_template_account-TT56274 branch 4 times, most recently from 4d0eb4e to aae2a51 Compare July 1, 2025 09:16
@victoralmau victoralmau changed the title [17.0][WIP] base_import_pdf_by_template_account: Suitable value of sort_weight in _unwrap_edi_attachments() method if applicable [17.0][IMP+FIX] base_import_pdf_by_template_account: Suitable value of sort_weight in _unwrap_edi_attachments() method if applicable Jul 1, 2025
@victoralmau victoralmau marked this pull request as ready for review July 1, 2025 09:59
…ght in _unwrap_edi_attachments() method if applicable

Example of use case:
- Create a pdf template linked to invoices.
- Define an email alias to automatically create the invoices and process the attachments
- Send an email to the alias with 2 attachments: example.xml and example.pdf

Before:
The _unwrap_edi_attachments() method indirectly applied a lower sort_weight value (10) to the example.xml file than to the example.pdf file (20), which meant that the https://github.com/odoo/odoo/blob/399da69818d22860a808f5416829863f002ad38a/addons/account/models/account_move.py#L3202 condition was met for the example.pdf file and the pdf was not processed correctly (https://github.com/odoo/odoo/blob/399da69818d22860a808f5416829863f002ad38a/addons/account/models/account_move.py#L3215).

After:
The _unwrap_edi_attachments() method modifies the value of sort_weight in .pdf files if there is +1 file and if there is any pdf import template that applies to the corresponding record.

Future:
In v19 (master for now) the process has been improved using the account.document.import.mixin and https://github.com/odoo/odoo/blob/cf4e5b95c34357e5129adf9c78429f7c1a4ea33e/addons/account/models/account_document_import_mixin.py#L318 template.

TT56274
…ontext value to avoid error when processing the record

TT56274
…d process

It is very important to have a log of the exception to better understand what is
happening (a badly formatted value or a field that does not exist in the view
by the user who is executing it).

TT56274
@victoralmau victoralmau force-pushed the 17.0-imp-base_import_pdf_by_template_account-TT56274 branch from aae2a51 to 0b59513 Compare September 30, 2025 10:19
@victoralmau
Copy link
Member Author

Please @pedrobaeza and @sergio-teruel can you review it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant