-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
[17.0][IMP] account_invoice_inter_company: Add pdf invoices in both companies #769
Conversation
pdf = report._render_qweb_pdf(report.report_name, [self.id])[0] | ||
self.env["ir.attachment"].create( | ||
{ | ||
"name": self.name + ".pdf", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()
.
There was a problem hiding this comment.
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.
e40d996
to
8096567
Compare
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ocabot merge patch
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 0cc8051. Thanks a lot for contributing to OCA. ❤️ |
FWP from 16.0: #766
Add pdf invoices in both companies
@Tecnativa TT54805