Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] account_invoice_import: allow to create empty invoices when nothing is extracted from the PDF #630

Merged
merged 5 commits into from
Sep 27, 2022

Conversation

alexis-via
Copy link
Contributor

Implement what is described in issue #610 :

  • account_invoice_import_simple_pdf and account_invoice_import_invoice2data can now be use
    d together
  • when importing an invoice for an unknown partner, it creates an empty invoice with PDF a
    s attachment
  • when importing an invoice via mail gateway and the from email is set
    on a partner that doesn't have any import config, create a supplier
    invoice with PDF as attachment and with that partner
  • when importing an invoice via mail gateway and the from email is set
    on a partner that has a single-line import config, create a supplier
    invoice with PDF as attachment, that partner and 1 invoice line with price_unit=0.0

@alexis-via alexis-via changed the title [14.0] account_invoice_import: improve handling of simple PDF invoices [14.0] account_invoice_import: allow to create empty invoices when nothing is extracted from the PDF Jul 14, 2022
Implement what is described in issue OCA#610:
- account_invoice_import_simple_pdf and account_invoice_import_invoice2data can now be use
d together
- when importing an invoice for an unknown partner, it creates an empty invoice with PDF a
s attachment
- when importing an invoice via mail gateway and the from email is set
on a partner that doesn't have any import config, create a supplier
invoice with PDF as attachment and with that partner
- when importing an invoice via mail gateway and the from email is set
on a partner that has a single-line import config, create a supplier
invoice with PDF as attachment, that partner and 1 invoice line with price_unit=0.
@alexis-via alexis-via force-pushed the 14-account_invoice_import-empty branch from 2b93b22 to 6c25de9 Compare July 15, 2022 07:21
@alexis-via
Copy link
Contributor Author

Travis is red. It is caused by the fact that my Bouygues Telecom test invoice that I shipped in account_invoice_import_simple_pdf also matches a template of invoice2data ! Now that the 2 modules are compatible, I should ship an invoice that will not match an invoice2data template.

FIX import of XML files via mail gateway
FIX attachment number in logs
I don't use the Bouygues Telecom test invoice in the test suite, because
Bouygues Telecom also has an invoice2data template and invoice2data and
simple_pdf are now compatible so both modules are installed during the
test.
@bosd
Copy link
Contributor

bosd commented Sep 22, 2022

Can you add the feature to toggle the "To Check" value if an empty invoice is created?
(maybe also force auto_post to false)

@alexis-via
Copy link
Contributor Author

Cool, tests are green now!

@alexis-via
Copy link
Contributor Author

@bosd: ok, I'll have a look at it, but not today.

@alexis-via
Copy link
Contributor Author

@bosd When the invoice import doesn't match any partner, and you try to confirm it, you get the message "You need to add a line before posting."
When the invoice import matches a partner that has a single line import config and you try to confirm it without modification, you get the message "The Bill/Refund date is required to validate this document.".
So, anyway, you have to update the vendor bill before being able to confirm it. So I don't see any advantage of checking the "To check" boolean ; if must update/verify the invoice anyway to be able to confirm it. And once you have updated the invoice, you may not want it to have the "To check" option.
Setting auto_post to False doesn't have any advantage either, because the empty invoice is created without date, so it will never be auto-posted anyway.

@bosd
Copy link
Contributor

bosd commented Sep 27, 2022

That makes sense. So it is not nedeed here.

However it might be useful to add support of the to_check parameter for businesses_document_import.

In case when product match fails.
#604

Or when a uom, tax is not correctly matched.

Copy link

@nibraun nibraun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used in production, no code review

Copy link
Collaborator

@njeudy njeudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this in production, very basic code review

@alexis-via
Copy link
Contributor Author

/ocabot merge major

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 14.0-ocabot-merge-pr-630-by-alexis-via-bump-major, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit f0bc7f7 into OCA:14.0 Sep 27, 2022
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 6ebc915. Thanks a lot for contributing to OCA. ❤️

bosd added a commit to bosd/edi that referenced this pull request Nov 25, 2023
… PDF invoices

Restore implementation in OCA#630:
- when importing an invoice for an unknown partner, it creates an empty invoice with PDF a
s attachment
V3st1g3 pushed a commit to V3st1g3/oca-edi that referenced this pull request Dec 5, 2024
… PDF invoices

Restore implementation in OCA#630:
- when importing an invoice for an unknown partner, it creates an empty invoice with PDF a
s attachment
V3st1g3 pushed a commit to V3st1g3/oca-edi that referenced this pull request Dec 5, 2024
… PDF invoices

Restore implementation in OCA#630:
- when importing an invoice for an unknown partner, it creates an empty invoice with PDF a
s attachment
V3st1g3 pushed a commit to V3st1g3/oca-edi that referenced this pull request Dec 11, 2024
… PDF invoices

Restore implementation in OCA#630:
- when importing an invoice for an unknown partner, it creates an empty invoice with PDF a
s attachment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants