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

[17.0][IMP] account_invoice_inter_company: Add pdf invoices in both companies #769

Conversation

victoralmau
Copy link
Member

FWP from 16.0: #766

Add pdf invoices in both companies

@Tecnativa TT54805

@pedrobaeza pedrobaeza added this to the 17.0 milestone Feb 6, 2025
pdf = report._render_qweb_pdf(report.report_name, [self.id])[0]
self.env["ir.attachment"].create(
{
"name": self.name + ".pdf",
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking that the name may contain illegal characters for a file name, like /, so you should mask it. It may be also advisable to switch the method for self being the target invoice where the PDF is attached, as the method name suggest.

Copy link
Member

Choose a reason for hiding this comment

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

and put self.ensure_one().

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm thinking that the name may contain illegal characters for a file name, like /, so you should mask it.

Checking the process of creating an attachment through a report or sending an email, I confirm that no characters are replaced (although normally the name defined in the _get_report_base_filename() method is used so it has been changed).

It may be also advisable to switch the method for self being the target invoice where the PDF is attached, as the method name suggest.

I think changing the whole method to do the opposite can be even more confusing, IMO it is clear, from a sales invoice, you create the attachment and link it to the purchase invoice.

@victoralmau victoralmau force-pushed the 17.0-imp-account_invoice_inter_company-TT54805 branch from e40d996 to 8096567 Compare February 6, 2025 09:48
Copy link
Contributor

@bguillot bguillot left a comment

Choose a reason for hiding this comment

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

Thanks for the port

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 17.0-ocabot-merge-pr-769-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit ce7c744 into OCA:17.0 Feb 7, 2025
6 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

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

@pedrobaeza pedrobaeza deleted the 17.0-imp-account_invoice_inter_company-TT54805 branch February 7, 2025 07:48
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.

6 participants