-
-
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
[16.0][port][account_invoice_inter_company] attach pdf #766
Conversation
3e5bc62
to
c4ab9a5
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.
I think it would be more appropriate to make the copy()
of the ir.attachment
of the source invoice indicating the res_id
of the destination invoice reducing and simplifying the code. What do you think?
Hello, I think the pdf is not always generated in the other company, and in case of several attachments, how to know which one to take ? |
293dcc2
to
7050f70
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.
LGTM
I also think it is safer to generate the report.
AFAIK, at this stage, it is probable that the pdf does not exist yet on the customer invoice.
Ping @pedrobaeza |
supplier_invoice = self.auto_invoice_id | ||
if not supplier_invoice: | ||
supplier_invoice = self.search([("auto_invoice_id", "=", self.id)], limit=1) | ||
report = self.env.ref("account.account_invoices").with_company(self.company_id) |
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.
report = self.env.ref("account.account_invoices").with_company(self.company_id) | |
report = self.env.ref("account.account_invoices").with_company(supplier_invoice.company_id) |
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 think we really want the customer invoice's pdf here (to attach it on the supplier invoice).
Why would we generate the pdf of customer invoice (which is self
) using the supplier invoice's company ?
Maybe the with_company
is kind of useless since the current company should already be self.company_id
, but I don't understand why we would want to use the supplier 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.
OK, right. I have mixed things, but I think this would help if self
is the supplier invoice, as it's the target of the action to do (attach there the customer invoice), and it's also advised to add docstrings. Let's not block this anyway.
7050f70
to
42aec43
Compare
42aec43
to
8829e90
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.
/ocabot merge patch
On my way to merge this fine PR! |
And the commit messages are horrible too... Please next time stick to guidelines: |
Congratulations, your PR was merged at e91a86b. Thanks a lot for contributing to OCA. ❤️ |
Hello,
This is a port of #283 to add the invoice pdf in both companies